mercurial/hgweb/hgweb_mod.py
branchstable
changeset 37827 11ee9bf24791
parent 37746 b29f490eb904
child 38039 5b831053d9b6
equal deleted inserted replaced
37826:d105bbb74658 37827:11ee9bf24791
   397             # be a nonce.
   397             # be a nonce.
   398             if rctx.configbool('web', 'cache') and not rctx.nonce:
   398             if rctx.configbool('web', 'cache') and not rctx.nonce:
   399                 tag = 'W/"%d"' % self.mtime
   399                 tag = 'W/"%d"' % self.mtime
   400                 if req.headers.get('If-None-Match') == tag:
   400                 if req.headers.get('If-None-Match') == tag:
   401                     res.status = '304 Not Modified'
   401                     res.status = '304 Not Modified'
       
   402                     # Content-Type may be defined globally. It isn't valid on a
       
   403                     # 304, so discard it.
       
   404                     try:
       
   405                         del res.headers[b'Content-Type']
       
   406                     except KeyError:
       
   407                         pass
   402                     # Response body not allowed on 304.
   408                     # Response body not allowed on 304.
   403                     res.setbodybytes('')
   409                     res.setbodybytes('')
   404                     return res.sendresponse()
   410                     return res.sendresponse()
   405 
   411 
   406                 res.headers['ETag'] = tag
   412                 res.headers['ETag'] = tag