Show More
@@ -230,8 +230,9 b' class requestcontext:' | |||
|
230 | 230 | |
|
231 | 231 | def sendtemplate(self, name, **kwargs): |
|
232 | 232 | """Helper function to send a response generated from a template.""" |
|
233 | kwargs = pycompat.byteskwargs(kwargs) | |
|
234 | self.res.setbodygen(self.tmpl.generate(name, kwargs)) | |
|
233 | if self.req.method != b'HEAD': | |
|
234 | kwargs = pycompat.byteskwargs(kwargs) | |
|
235 | self.res.setbodygen(self.tmpl.generate(name, kwargs)) | |
|
235 | 236 | return self.res.sendresponse() |
|
236 | 237 | |
|
237 | 238 |
@@ -485,6 +485,7 b' class wsgiresponse:' | |||
|
485 | 485 | self._bodybytes is None |
|
486 | 486 | and self._bodygen is None |
|
487 | 487 | and not self._bodywillwrite |
|
488 | and self._req.method != b'HEAD' | |
|
488 | 489 | ): |
|
489 | 490 | raise error.ProgrammingError(b'response body not defined') |
|
490 | 491 | |
@@ -594,6 +595,8 b' class wsgiresponse:' | |||
|
594 | 595 | yield chunk |
|
595 | 596 | elif self._bodywillwrite: |
|
596 | 597 | self._bodywritefn = write |
|
598 | elif self._req.method == b'HEAD': | |
|
599 | pass | |
|
597 | 600 | else: |
|
598 | 601 | error.ProgrammingError(b'do not know how to send body') |
|
599 | 602 |
@@ -151,6 +151,9 b' class _httprequesthandler(httpservermod.' | |||
|
151 | 151 | def do_GET(self): |
|
152 | 152 | self.do_POST() |
|
153 | 153 | |
|
154 | def do_HEAD(self): | |
|
155 | self.do_POST() | |
|
156 | ||
|
154 | 157 | def do_hgweb(self): |
|
155 | 158 | self.sent_headers = False |
|
156 | 159 | path, query = _splitURI(self.path) |
@@ -246,7 +249,11 b' class _httprequesthandler(httpservermod.' | |||
|
246 | 249 | self.send_header(*h) |
|
247 | 250 | if h[0].lower() == 'content-length': |
|
248 | 251 | self.length = int(h[1]) |
|
249 | if self.length is None and saved_status[0] != common.HTTP_NOT_MODIFIED: | |
|
252 | if ( | |
|
253 | self.length is None | |
|
254 | and saved_status[0] != common.HTTP_NOT_MODIFIED | |
|
255 | and self.command != 'HEAD' | |
|
256 | ): | |
|
250 | 257 | self._chunked = ( |
|
251 | 258 | not self.close_connection and self.request_version == 'HTTP/1.1' |
|
252 | 259 | ) |
General Comments 0
You need to be logged in to leave comments.
Login now