comparison mercurial/hgweb/server.py @ 34720:60e7da55e5e6

hgweb: set sent_headers attr as early as practical 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. Differential Revision: https://phab.mercurial-scm.org/D1085
author Augie Fackler <augie@google.com>
date Sat, 14 Oct 2017 15:37:33 -0400
parents 6e1b05692b2c
children b2601c5977a4
comparison
equal deleted inserted replaced
34719:6e1b05692b2c 34720:60e7da55e5e6
113 113
114 def do_GET(self): 114 def do_GET(self):
115 self.do_POST() 115 self.do_POST()
116 116
117 def do_hgweb(self): 117 def do_hgweb(self):
118 self.sent_headers = False
118 path, query = _splitURI(self.path) 119 path, query = _splitURI(self.path)
119 120
120 env = {} 121 env = {}
121 env[r'GATEWAY_INTERFACE'] = r'CGI/1.1' 122 env[r'GATEWAY_INTERFACE'] = r'CGI/1.1'
122 env[r'REQUEST_METHOD'] = self.command 123 env[r'REQUEST_METHOD'] = self.command
165 socketserver.ForkingMixIn) 166 socketserver.ForkingMixIn)
166 env[r'wsgi.run_once'] = 0 167 env[r'wsgi.run_once'] = 0
167 168
168 self.saved_status = None 169 self.saved_status = None
169 self.saved_headers = [] 170 self.saved_headers = []
170 self.sent_headers = False
171 self.length = None 171 self.length = None
172 self._chunked = None 172 self._chunked = None
173 for chunk in self.server.application(env, self._start_response): 173 for chunk in self.server.application(env, self._start_response):
174 self._write(chunk) 174 self._write(chunk)
175 if not self.sent_headers: 175 if not self.sent_headers: