Don't manually set Content-Length in StaticFileHandler.
Content-Length will be set automatically in RequestHandler.finish. This change fixes a bug in which RequestHandler.finish's Etag support strips the response body without changing any headers. Transfer headers (including Content-Length and Transfer-Encoding) are the responsibility of the framework, not the "application-level" handlers (which includes StaticFileHandler). Closes #160.
This commit is contained in:
parent
5e987aa6b2
commit
b914a94ac2
|
@ -1284,7 +1284,6 @@ class StaticFileHandler(RequestHandler):
|
||||||
|
|
||||||
if not include_body:
|
if not include_body:
|
||||||
return
|
return
|
||||||
self.set_header("Content-Length", stat_result[stat.ST_SIZE])
|
|
||||||
file = open(abspath, "rb")
|
file = open(abspath, "rb")
|
||||||
try:
|
try:
|
||||||
self.write(file.read())
|
self.write(file.read())
|
||||||
|
|
Loading…
Reference in New Issue