[PATCH] http2: send an extra header to signal a non-broken client
Matt Mackall
mpm at selenic.com
Fri Jul 29 17:57:45 CDT 2011
On Wed, 2011-07-27 at 18:35 -0500, Augie Fackler wrote:
> # HG changeset patch
> # User Augie Fackler <durin42 at gmail.com>
> # Date 1311809735 18000
> # Node ID 9da96c0441e543498c516ec4e366a34d1dc44096
> # Parent b4c06b97dfe0cae28497bc3ab85c075a173de8e6
> http2: send an extra header to signal a non-broken client
>
> Some proxies strip the expect header because they forward requests in
> a non-compliant way or as a way to defend against bogus clients.
Is this for stable?
> diff --git a/mercurial/hgweb/hgweb_mod.py b/mercurial/hgweb/hgweb_mod.py
> --- a/mercurial/hgweb/hgweb_mod.py
> +++ b/mercurial/hgweb/hgweb_mod.py
> @@ -129,8 +129,9 @@
> # A client that sends unbundle without 100-continue will
> # break if we respond early.
> if (cmd == 'unbundle' and
> - req.env.get('HTTP_EXPECT',
> - '').lower() != '100-continue'):
> + (req.env.get('HTTP_EXPECT',
> + '').lower() != '100-continue') or
> + req.env.get('X-HgHttp2', '')):
> req.drain()
> req.respond(inst, protocol.HGTYPE)
> return '0\n%s\n' % inst.message
> diff --git a/mercurial/httprepo.py b/mercurial/httprepo.py
> --- a/mercurial/httprepo.py
> +++ b/mercurial/httprepo.py
> @@ -78,6 +78,7 @@
>
> if data and self.ui.configbool('ui', 'usehttp2', False):
> headers['Expect'] = '100-Continue'
> + headers['X-HgHttp2'] = '1'
>
> self.ui.debug("sending %s command\n" % cmd)
> q = [('cmd', cmd)]
> _______________________________________________
> Mercurial-devel mailing list
> Mercurial-devel at selenic.com
> http://selenic.com/mailman/listinfo/mercurial-devel
--
Mathematics is the supreme nostalgia of our time.
More information about the Mercurial-devel
mailing list