Mercurial > public > mercurial-scm > hg-stable
comparison mercurial/hgweb/hgweb_mod.py @ 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 | f02045645d12 |
children | 1dba26575dba |
comparison
equal
deleted
inserted
replaced
19487:8cfa3a3664a5 | 19488:60e060f4faa9 |
---|---|
174 if (cmd == 'unbundle' and | 174 if (cmd == 'unbundle' and |
175 (req.env.get('HTTP_EXPECT', | 175 (req.env.get('HTTP_EXPECT', |
176 '').lower() != '100-continue') or | 176 '').lower() != '100-continue') or |
177 req.env.get('X-HgHttp2', '')): | 177 req.env.get('X-HgHttp2', '')): |
178 req.drain() | 178 req.drain() |
179 else: | |
180 req.headers.append(('Connection', 'Close')) | |
179 req.respond(inst, protocol.HGTYPE, | 181 req.respond(inst, protocol.HGTYPE, |
180 body='0\n%s\n' % inst.message) | 182 body='0\n%s\n' % inst.message) |
181 return '' | 183 return '' |
182 | 184 |
183 # translate user-visible url structure to internal structure | 185 # translate user-visible url structure to internal structure |