changeset 19488:60e060f4faa9 stable

hgweb: force connection close on early response Not all WSGI servers close the socket when an early response is sent to a large POST request, which can cause the server to interpret the already-sent request body as an incoming (but hopelessly invalid) request.
author Augie Fackler <raf@durin42.com>
date Sat, 11 May 2013 20:40:15 -0500
parents 8cfa3a3664a5
children 42fcb2f7787d
files mercurial/hgweb/hgweb_mod.py
diffstat 1 files changed, 2 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/hgweb/hgweb_mod.py	Thu Jul 25 02:41:22 2013 +0400
+++ b/mercurial/hgweb/hgweb_mod.py	Sat May 11 20:40:15 2013 -0500
@@ -176,6 +176,8 @@
                                  '').lower() != '100-continue') or
                     req.env.get('X-HgHttp2', '')):
                     req.drain()
+                else:
+                    req.headers.append(('Connection', 'Close'))
                 req.respond(inst, protocol.HGTYPE,
                             body='0\n%s\n' % inst.message)
                 return ''