D2768: hgweb: use a capped reader for WSGI input stream

indygreg (Gregory Szorc) phabricator at mercurial-scm.org
Mon Mar 12 17:32:20 EDT 2018


This revision was automatically updated to reflect the committed changes.
Closed by commit rHG290fc4c3d1e0: hgweb: use a capped reader for WSGI input stream (authored by indygreg, committed by ).

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D2768?vs=6830&id=6905

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

AFFECTED FILES
  mercurial/hgweb/request.py

CHANGE DETAILS

diff --git a/mercurial/hgweb/request.py b/mercurial/hgweb/request.py
--- a/mercurial/hgweb/request.py
+++ b/mercurial/hgweb/request.py
@@ -234,6 +234,14 @@
             raise RuntimeError("Unknown and unsupported WSGI version %d.%d"
                                % version)
         self.inp = wsgienv[r'wsgi.input']
+
+        if r'HTTP_CONTENT_LENGTH' in wsgienv:
+            self.inp = util.cappedreader(self.inp,
+                                         int(wsgienv[r'HTTP_CONTENT_LENGTH']))
+        elif r'CONTENT_LENGTH' in wsgienv:
+            self.inp = util.cappedreader(self.inp,
+                                         int(wsgienv[r'CONTENT_LENGTH']))
+
         self.err = wsgienv[r'wsgi.errors']
         self.threaded = wsgienv[r'wsgi.multithread']
         self.multiprocess = wsgienv[r'wsgi.multiprocess']



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


More information about the Mercurial-devel mailing list