D5498: server: always close http socket if responding with an error (issue6033)
durin42 (Augie Fackler)
phabricator at mercurial-scm.org
Mon Jan 7 14:17:04 EST 2019
This revision was automatically updated to reflect the committed changes.
Closed by commit rHG197f092b2cd9: server: always close http socket if responding with an error (issue6033) (authored by durin42, committed by ).
REPOSITORY
rHG Mercurial
CHANGES SINCE LAST UPDATE
https://phab.mercurial-scm.org/D5498?vs=13020&id=13062
REVISION DETAIL
https://phab.mercurial-scm.org/D5498
AFFECTED FILES
mercurial/hgweb/server.py
CHANGE DETAILS
diff --git a/mercurial/hgweb/server.py b/mercurial/hgweb/server.py
--- a/mercurial/hgweb/server.py
+++ b/mercurial/hgweb/server.py
@@ -127,6 +127,13 @@
and not path.startswith(self.server.prefix + b'/')):
self._start_response(pycompat.strurl(common.statusmessage(404)),
[])
+ if self.command == 'POST':
+ # Paranoia: tell the client we're going to close the
+ # socket so they don't try and reuse a socket that
+ # might have a POST body waiting to confuse us. We do
+ # this by directly munging self.saved_headers because
+ # self._start_response ignores Connection headers.
+ self.saved_headers = [(r'Connection', r'Close')]
self._write(b"Not Found")
self._done()
return
To: durin42, #hg-reviewers, mharbison72, pulkit
Cc: mharbison72, mercurial-devel
More information about the Mercurial-devel
mailing list