changeset 36280:685bcdd236b5

wireprotoserver: py3 helpfully calls adds HTTP_ to CONTENT_LENGTH Just handle both with a membership check, preferring the HTTP_ namespaced version. Sigh. Differential Revision: https://phab.mercurial-scm.org/D2310
author Augie Fackler <augie@google.com>
date Sun, 18 Feb 2018 00:02:33 -0500
parents 1e0c9f9f6f36
children d822f3fb6be8
files mercurial/wireprotoserver.py
diffstat 1 files changed, 4 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/wireprotoserver.py	Sun Feb 18 00:01:43 2018 -0500
+++ b/mercurial/wireprotoserver.py	Sun Feb 18 00:02:33 2018 -0500
@@ -142,7 +142,10 @@
         return args
 
     def forwardpayload(self, fp):
-        length = int(self._req.env[r'CONTENT_LENGTH'])
+        if r'HTTP_CONTENT_LENGTH' in self._req.env:
+            length = int(self._req.env[r'HTTP_CONTENT_LENGTH'])
+        else:
+            length = int(self._req.env[r'CONTENT_LENGTH'])
         # If httppostargs is used, we need to read Content-Length
         # minus the amount that was consumed by args.
         length -= int(self._req.env.get(r'HTTP_X_HGARGS_POST', 0))