Patchwork D2310: wireprotoserver: py3 helpfully calls adds HTTP_ to CONTENT_LENGTH

login
register
mail settings
Submitter phabricator
Date Feb. 18, 2018, 5:42 a.m.
Message ID <differential-rev-PHID-DREV-dkv2ax3kqwrixt7ugtvg-req@phab.mercurial-scm.org>
Download mbox | patch
Permalink /patch/28050/
State Superseded
Headers show

Comments

phabricator - Feb. 18, 2018, 5:42 a.m.
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




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

Patch

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))