comparison roundup/cgi/client.py @ 6649:33616bc80baf

Fix hang in unsatisfyable range or HEAD request for static file Also update CHANGES with last three changes.
author John Rouillard <rouilj@ieee.org>
date Thu, 28 Apr 2022 19:21:08 -0400
parents 91ab3e0ffcd0
children b83b90d57846
comparison
equal deleted inserted replaced
6648:53c9b62494e6 6649:33616bc80baf
2522 self.setHeader("Content-Length", str(length)) 2522 self.setHeader("Content-Length", str(length))
2523 # If the client doesn't actually want the body, or if we are 2523 # If the client doesn't actually want the body, or if we are
2524 # indicating an invalid range. 2524 # indicating an invalid range.
2525 if (self.env['REQUEST_METHOD'] == 'HEAD' 2525 if (self.env['REQUEST_METHOD'] == 'HEAD'
2526 or self.response_code == http_.client.REQUESTED_RANGE_NOT_SATISFIABLE): 2526 or self.response_code == http_.client.REQUESTED_RANGE_NOT_SATISFIABLE):
2527 self.setHeader("Content-Length", 0)
2528 self.header()
2527 return 2529 return
2528 # Use the optimized "sendfile" operation, if possible. 2530 # Use the optimized "sendfile" operation, if possible.
2529 if hasattr(self.request, "sendfile"): 2531 if hasattr(self.request, "sendfile"):
2530 self.header() 2532 self.header()
2531 self._socket_op(self.request.sendfile, filename, offset, length) 2533 self._socket_op(self.request.sendfile, filename, offset, length)

Roundup Issue Tracker: http://roundup-tracker.org/