@@ -50,41 +50,41 @@
200 Script output follows
content-type: application/mercurial-0.1
date: $HTTP_DATE$
- server: * (glob)
+ server: testing stub value
transfer-encoding: chunked
Server should send application/mercurial-0.1 when client says it wants it
$ get-with-headers.py --hgproto '0.1' --headeronly $LOCALIP:$HGPORT '?cmd=getbundle&heads=e93700bd72895c5addab234c56d4024b487a362f&common=0000000000000000000000000000000000000000' -
200 Script output follows
content-type: application/mercurial-0.1
date: $HTTP_DATE$
- server: * (glob)
+ server: testing stub value
transfer-encoding: chunked
Server should send application/mercurial-0.2 when client says it wants it
$ get-with-headers.py --hgproto '0.2' --headeronly $LOCALIP:$HGPORT '?cmd=getbundle&heads=e93700bd72895c5addab234c56d4024b487a362f&common=0000000000000000000000000000000000000000' -
200 Script output follows
content-type: application/mercurial-0.2
date: $HTTP_DATE$
- server: * (glob)
+ server: testing stub value
transfer-encoding: chunked
$ get-with-headers.py --hgproto '0.1 0.2' --headeronly $LOCALIP:$HGPORT '?cmd=getbundle&heads=e93700bd72895c5addab234c56d4024b487a362f&common=0000000000000000000000000000000000000000' -
200 Script output follows
content-type: application/mercurial-0.2
date: $HTTP_DATE$
- server: * (glob)
+ server: testing stub value
transfer-encoding: chunked
Requesting a compression format that server doesn't support results will fall back to 0.1
$ get-with-headers.py --hgproto '0.2 comp=aa' --headeronly $LOCALIP:$HGPORT '?cmd=getbundle&heads=e93700bd72895c5addab234c56d4024b487a362f&common=0000000000000000000000000000000000000000' -
200 Script output follows
content-type: application/mercurial-0.1
date: $HTTP_DATE$
- server: * (glob)
+ server: testing stub value
transfer-encoding: chunked
#if zstd
@@ -106,7 +106,7 @@
content-length: 41
content-type: application/mercurial-0.1
date: $HTTP_DATE$
- server: * (glob)
+ server: testing stub value
e93700bd72895c5addab234c56d4024b487a362f
@@ -1923,7 +1923,7 @@
content-length: 12
content-type: application/mercurial-0.1
date: $HTTP_DATE$
- server: * (glob)
+ server: testing stub value
0
Not Found
@@ -215,6 +215,7 @@
ui.nontty=true
web.address=localhost
web\.ipv6=(?:True|False) (re)
+ web.server-header=testing stub value
*** runcommand init foo
*** runcommand -R foo showconfig ui defaults
ui.slash=True
@@ -12,6 +12,7 @@
ui.promptecho=True
web.address=localhost
web\.ipv6=(?:True|False) (re)
+ web.server-header=testing stub value
$ hg init t
$ cd t
@@ -128,24 +128,24 @@
content-type: application/x-gzip
date: $HTTP_DATE$
etag: W/"*" (glob)
- server: * (glob)
+ server: testing stub value
transfer-encoding: chunked
body: size=408, sha1=8fa06531bddecc365a9f5edb0f88b65974bfe505
% tar.bz2 and zip disallowed should both give 403
403 Archive type not allowed: bz2
content-type: text/html; charset=ascii
date: $HTTP_DATE$
etag: W/"*" (glob)
- server: * (glob)
+ server: testing stub value
transfer-encoding: chunked
body: size=1451, sha1=4c5cf0f574446c44feb7f88f4e0e2a56bd92c352
403 Archive type not allowed: zip
content-type: text/html; charset=ascii
date: $HTTP_DATE$
etag: W/"*" (glob)
- server: * (glob)
+ server: testing stub value
transfer-encoding: chunked
body: size=1451, sha1=cbfa5574b337348bfd0564cc534474d002e7d6c7
@@ -156,24 +156,24 @@
content-type: application/x-bzip2
date: $HTTP_DATE$
etag: W/"*" (glob)
- server: * (glob)
+ server: testing stub value
transfer-encoding: chunked
body: size=426, sha1=8d87f5aba6e14f1bfea6c232985982c278b2fb0b
% zip and tar.gz disallowed should both give 403
403 Archive type not allowed: zip
content-type: text/html; charset=ascii
date: $HTTP_DATE$
etag: W/"*" (glob)
- server: * (glob)
+ server: testing stub value
transfer-encoding: chunked
body: size=1451, sha1=cbfa5574b337348bfd0564cc534474d002e7d6c7
403 Archive type not allowed: gz
content-type: text/html; charset=ascii
date: $HTTP_DATE$
etag: W/"*" (glob)
- server: * (glob)
+ server: testing stub value
transfer-encoding: chunked
body: size=1450, sha1=71f0b12d59f85fdcfe8ff493e2dc66863f2f7734
@@ -184,24 +184,24 @@
content-type: application/zip
date: $HTTP_DATE$
etag: W/"*" (glob)
- server: * (glob)
+ server: testing stub value
transfer-encoding: chunked
body: size=1377, sha1=677b14d3d048778d5eb5552c14a67e6192068650
% tar.gz and tar.bz2 disallowed should both give 403
403 Archive type not allowed: gz
content-type: text/html; charset=ascii
date: $HTTP_DATE$
etag: W/"*" (glob)
- server: * (glob)
+ server: testing stub value
transfer-encoding: chunked
body: size=1450, sha1=71f0b12d59f85fdcfe8ff493e2dc66863f2f7734
403 Archive type not allowed: bz2
content-type: text/html; charset=ascii
date: $HTTP_DATE$
etag: W/"*" (glob)
- server: * (glob)
+ server: testing stub value
transfer-encoding: chunked
body: size=1451, sha1=4c5cf0f574446c44feb7f88f4e0e2a56bd92c352
@@ -215,24 +215,24 @@
content-type: application/x-gzip
date: $HTTP_DATE$
etag: W/"*" (glob)
- server: * (glob)
+ server: testing stub value
transfer-encoding: chunked
body: size=408, sha1=8fa06531bddecc365a9f5edb0f88b65974bfe505
% tar.bz2 and zip disallowed should both give 403
403 Archive type not allowed: bz2
content-type: text/html; charset=ascii
date: $HTTP_DATE$
etag: W/"*" (glob)
- server: * (glob)
+ server: testing stub value
transfer-encoding: chunked
body: size=1451, sha1=4c5cf0f574446c44feb7f88f4e0e2a56bd92c352
403 Archive type not allowed: zip
content-type: text/html; charset=ascii
date: $HTTP_DATE$
etag: W/"*" (glob)
- server: * (glob)
+ server: testing stub value
transfer-encoding: chunked
body: size=1451, sha1=cbfa5574b337348bfd0564cc534474d002e7d6c7
@@ -243,24 +243,24 @@
content-type: application/x-bzip2
date: $HTTP_DATE$
etag: W/"*" (glob)
- server: * (glob)
+ server: testing stub value
transfer-encoding: chunked
body: size=426, sha1=8d87f5aba6e14f1bfea6c232985982c278b2fb0b
% zip and tar.gz disallowed should both give 403
403 Archive type not allowed: zip
content-type: text/html; charset=ascii
date: $HTTP_DATE$
etag: W/"*" (glob)
- server: * (glob)
+ server: testing stub value
transfer-encoding: chunked
body: size=1451, sha1=cbfa5574b337348bfd0564cc534474d002e7d6c7
403 Archive type not allowed: gz
content-type: text/html; charset=ascii
date: $HTTP_DATE$
etag: W/"*" (glob)
- server: * (glob)
+ server: testing stub value
transfer-encoding: chunked
body: size=1450, sha1=71f0b12d59f85fdcfe8ff493e2dc66863f2f7734
@@ -271,24 +271,24 @@
content-type: application/zip
date: $HTTP_DATE$
etag: W/"*" (glob)
- server: * (glob)
+ server: testing stub value
transfer-encoding: chunked
body: size=1377, sha1=677b14d3d048778d5eb5552c14a67e6192068650
% tar.gz and tar.bz2 disallowed should both give 403
403 Archive type not allowed: gz
content-type: text/html; charset=ascii
date: $HTTP_DATE$
etag: W/"*" (glob)
- server: * (glob)
+ server: testing stub value
transfer-encoding: chunked
body: size=1450, sha1=71f0b12d59f85fdcfe8ff493e2dc66863f2f7734
403 Archive type not allowed: bz2
content-type: text/html; charset=ascii
date: $HTTP_DATE$
etag: W/"*" (glob)
- server: * (glob)
+ server: testing stub value
transfer-encoding: chunked
body: size=1451, sha1=4c5cf0f574446c44feb7f88f4e0e2a56bd92c352
@@ -1119,6 +1119,7 @@
hgrc.write(b'[web]\n')
hgrc.write(b'address = localhost\n')
hgrc.write(b'ipv6 = %s\n' % str(self._useipv6).encode('ascii'))
+ hgrc.write(b'server-header = testing stub value\n')
for opt in self._extraconfigopts:
section, key = opt.encode('utf-8').split(b'.', 1)
@@ -231,6 +231,11 @@
self.wfile.write('0\r\n\r\n')
self.wfile.flush()
+ def version_string(self):
+ if self.server.serverheader:
+ return self.server.serverheader
+ return httpservermod.basehttprequesthandler.version_string(self)
+
class _httprequesthandlerssl(_httprequesthandler):
"""HTTPS handler based on Python's ssl module"""
@@ -304,6 +309,8 @@
self.addr, self.port = self.socket.getsockname()[0:2]
self.fqaddr = socket.getfqdn(addr[0])
+ self.serverheader = ui.config('web', 'server-header')
+
class IPv6HTTPServer(MercurialHTTPServer):
address_family = getattr(socket, 'AF_INET6', None)
def __init__(self, *args, **kwargs):
@@ -2527,6 +2527,9 @@
Values less than or equal to 0 always refresh.
(default: 20)
+``server-header``
+ Value for HTTP ``Server`` response header.
+
``staticurl``
Base URL to use for static files. If unset, static files (e.g. the
hgicon.png favicon) will be served by the CGI script itself. Use
@@ -1252,6 +1252,9 @@
coreconfigitem('web', 'refreshinterval',
default=20,
)
+coreconfigitem('web', 'server-header',
+ default=None,
+)
coreconfigitem('web', 'staticurl',
default=None,
)