Patchwork D1085: hgweb: set sent_headers attr as early as practical

login
register
mail settings
Submitter phabricator
Date Oct. 15, 2017, 4:57 a.m.
Message ID <differential-rev-PHID-DREV-lr63ye56br7qwoncohcl-req@phab.mercurial-scm.org>
Download mbox | patch
Permalink /patch/24932/
State Superseded
Headers show

Comments

phabricator - Oct. 15, 2017, 4:57 a.m.
durin42 created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  While doing Python 3 porting work, I've seen exceptions happen in
  parts of hgweb we normally assume are robust. It won't hurt anything
  to set this attribute significantly earlier, so let's do so and save
  confusing during the porting process.

REPOSITORY
  rHG Mercurial

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

AFFECTED FILES
  mercurial/hgweb/server.py

CHANGE DETAILS




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

Patch

diff --git a/mercurial/hgweb/server.py b/mercurial/hgweb/server.py
--- a/mercurial/hgweb/server.py
+++ b/mercurial/hgweb/server.py
@@ -115,6 +115,7 @@ 
         self.do_POST()
 
     def do_hgweb(self):
+        self.sent_headers = False
         path, query = _splitURI(self.path)
 
         env = {}
@@ -167,7 +168,6 @@ 
 
         self.saved_status = None
         self.saved_headers = []
-        self.sent_headers = False
         self.length = None
         self._chunked = None
         for chunk in self.server.application(env, self._start_response):