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

login
register
mail settings
Submitter phabricator
Date April 11, 2018, 8:10 p.m.
Message ID <differential-rev-PHID-DREV-fr5ldocs5fwxpwevu742-req@phab.mercurial-scm.org>
Download mbox | patch
Permalink /patch/30738/
State Superseded
Headers show

Comments

phabricator - April 11, 2018, 8:10 p.m.
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




To: durin42, #hg-reviewers
Cc: mercurial-devel
phabricator - April 12, 2018, 3:18 p.m.
indygreg accepted this revision.
indygreg added a comment.
This revision is now accepted and ready to land.


  A low-level WSGI API that literally puts data on the wire uses Unicode. Because Python 3. Sadness.

REPOSITORY
  rHG Mercurial

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

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

Patch

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