D969: request: coerce content-type to native str

durin42 (Augie Fackler) phabricator at mercurial-scm.org
Thu Oct 5 21:32:16 UTC 2017


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

REVISION SUMMARY
  Again, required by WSGI.

REPOSITORY
  rHG Mercurial

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

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
@@ -19,6 +19,7 @@
 )
 
 from .. import (
+    pycompat,
     util,
 )
 
@@ -89,6 +90,8 @@
             pass
 
     def respond(self, status, type, filename=None, body=None):
+        if not isinstance(type, str):
+            type = pycompat.sysstr(type)
         if self._start_response is not None:
             self.headers.append(('Content-Type', type))
             if filename:



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


More information about the Mercurial-devel mailing list