D3248: hgweb: put response headers back into str for Python 3

durin42 (Augie Fackler) phabricator at mercurial-scm.org
Wed Apr 11 20:10:41 UTC 2018


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

REVISION SUMMARY
  This fixes a lot of hanging tests on Python 3, because
  "Content-Length" was getting sent as "b'Content-Length'" (yes, really)
  and then clients would expect a close-is-end body instead of counting
  off a certain number of bytes.

REPOSITORY
  rHG Mercurial

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

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
@@ -520,8 +520,10 @@
                 if not chunk:
                     break
 
+        strheaders = [(pycompat.strurl(k), pycompat.strurl(v)) for
+                      k, v in self.headers.items()]
         write = self._startresponse(pycompat.sysstr(self.status),
-                                    self.headers.items())
+                                    strheaders)
 
         if self._bodybytes:
             yield self._bodybytes



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


More information about the Mercurial-devel mailing list