Mercurial > hg
diff mercurial/hgweb/server.py @ 14093:ce99d887585f
httprepo: long arguments support (issue2126)
Send the command arguments in the HTTP headers. The command is still part
of the URL. If the server does not have the 'httpheader' capability, the
client will send the command arguments in the URL as it did previously.
Web servers typically allow more data to be placed within the headers than
in the URL, so this approach will:
- Avoid HTTP errors due to using a URL that is too large.
- Allow Mercurial to implement a more efficient wire protocol.
An alternate approach is to send the arguments as part of the request body.
This approach has been rejected because it requires the use of POST
requests, so it would break any existing configuration that relies on the
request type for authentication or caching.
Extensibility:
- The header size is provided by the server, which makes it possible to
introduce an hgrc setting for it.
- The client ignores the capability value after the first comma, which
allows more information to be included in the future.
author | Steven Brown <StevenGBrown@gmail.com> |
---|---|
date | Sun, 01 May 2011 01:04:37 +0800 |
parents | 617a87cb7eb2 |
children | a7d5816087a9 |
line wrap: on
line diff
--- a/mercurial/hgweb/server.py Sat Apr 30 19:36:48 2011 +0200 +++ b/mercurial/hgweb/server.py Sun May 01 01:04:37 2011 +0800 @@ -59,6 +59,12 @@ def log_message(self, format, *args): self._log_any(self.server.accesslog, format, *args) + def log_request(self, code='-', size='-'): + xheaders = [h for h in self.headers.items() if h[0].startswith('x-')] + self.log_message('"%s" %s %s%s', + self.requestline, str(code), str(size), + ''.join([' %s:%s' % h for h in sorted(xheaders)])) + def do_write(self): try: self.do_hgweb()