mercurial/hgweb/server.py
branchstable
changeset 41023 197f092b2cd9
parent 39954 8c7ecd32ccce
child 41129 074c72a38423
--- a/mercurial/hgweb/server.py	Sat Jan 05 15:44:55 2019 +0900
+++ b/mercurial/hgweb/server.py	Sun Jan 06 14:58:54 2019 -0500
@@ -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