mercurial/hgweb/request.py
changeset 49846 fda5a4b853ab
parent 48946 642e31cb55f0
child 50817 9ed281bbf864
equal deleted inserted replaced
49845:e0c0545e2e55 49846:fda5a4b853ab
   483 
   483 
   484         if (
   484         if (
   485             self._bodybytes is None
   485             self._bodybytes is None
   486             and self._bodygen is None
   486             and self._bodygen is None
   487             and not self._bodywillwrite
   487             and not self._bodywillwrite
       
   488             and self._req.method != b'HEAD'
   488         ):
   489         ):
   489             raise error.ProgrammingError(b'response body not defined')
   490             raise error.ProgrammingError(b'response body not defined')
   490 
   491 
   491         # RFC 7232 Section 4.1 states that a 304 MUST generate one of
   492         # RFC 7232 Section 4.1 states that a 304 MUST generate one of
   492         # {Cache-Control, Content-Location, Date, ETag, Expires, Vary}
   493         # {Cache-Control, Content-Location, Date, ETag, Expires, Vary}
   592                     chunk = bytes(chunk)
   593                     chunk = bytes(chunk)
   593 
   594 
   594                 yield chunk
   595                 yield chunk
   595         elif self._bodywillwrite:
   596         elif self._bodywillwrite:
   596             self._bodywritefn = write
   597             self._bodywritefn = write
       
   598         elif self._req.method == b'HEAD':
       
   599             pass
   597         else:
   600         else:
   598             error.ProgrammingError(b'do not know how to send body')
   601             error.ProgrammingError(b'do not know how to send body')
   599 
   602 
   600     def getbodyfile(self):
   603     def getbodyfile(self):
   601         """Obtain a file object like object representing the response body.
   604         """Obtain a file object like object representing the response body.