D2310: wireprotoserver: py3 helpfully calls adds HTTP_ to CONTENT_LENGTH

durin42 (Augie Fackler) phabricator at mercurial-scm.org
Sun Feb 18 05:42:43 UTC 2018


durin42 created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  Just handle both with a membership check, preferring the HTTP_
  namespaced version. Sigh.

REPOSITORY
  rHG Mercurial

REVISION DETAIL
  https://phab.mercurial-scm.org/D2310

AFFECTED FILES
  mercurial/wireprotoserver.py

CHANGE DETAILS

diff --git a/mercurial/wireprotoserver.py b/mercurial/wireprotoserver.py
--- a/mercurial/wireprotoserver.py
+++ b/mercurial/wireprotoserver.py
@@ -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))



To: durin42, #hg-reviewers
Cc: mercurial-devel


More information about the Mercurial-devel mailing list