Mercurial > public > mercurial-scm > hg-stable
diff mercurial/url.py @ 30763:a520aefb96f1
httppeer: advertise and support application/mercurial-0.2
Now that servers expose a capability indicating they support
application/mercurial-0.2 and compression, clients can key off
this to say they support responses that are compressed with
various compression formats.
After this commit, the HTTP wire protocol client now sends an
"X-HgProto-<N>" request header indicating its support for
"application/mercurial-0.2" media type and various compression
formats.
This commit also implements support for handling
"application/mercurial-0.2" responses. It simply reads the header
compression engine identifier then routes the remainder of the
response to the appropriate decompressor.
There were some test changes, but only to logging. That points to
an obvious gap in our test coverage. This will be addressed in a
subsequent commit once server support is in place (it is hard to
test without server support).
author | Gregory Szorc <gregory.szorc@gmail.com> |
---|---|
date | Sat, 24 Dec 2016 15:22:18 -0700 |
parents | 69acfd2ca11e |
children | 6a70cf94d1b5 |
line wrap: on
line diff
--- a/mercurial/url.py Sat Dec 24 15:21:46 2016 -0700 +++ b/mercurial/url.py Sat Dec 24 15:22:18 2016 -0700 @@ -466,6 +466,11 @@ # user agent they deem appropriate. agent = 'mercurial/proto-1.0 (Mercurial %s)' % util.version() opener.addheaders = [('User-agent', agent)] + + # This header should only be needed by wire protocol requests. But it has + # been sent on all requests since forever. We keep sending it for backwards + # compatibility reasons. Modern versions of the wire protocol use + # X-HgProto-<N> for advertising client support. opener.addheaders.append(('Accept', 'application/mercurial-0.1')) return opener