-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix FileResponse sending empty chunked body on 304 #2144
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
Fix FileResponse sending empty chunked body on 304. |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -165,7 +165,9 @@ def handler(request): | |
resp.close() | ||
|
||
resp = yield from client.get('/', headers={'If-Modified-Since': lastmod}) | ||
body = yield from resp.read() | ||
assert 304 == resp.status | ||
assert b'' == body | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Hello @es1024 , According to what I read on the RFC:
The Content-Length header should not even be there. Can you add an assert to enforce it? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thx! This habit of so many dev to always use assert "Content-Length" not in resp.headers (Don't bother though, not important) |
||
resp.close() | ||
|
||
|
||
|
@@ -225,7 +227,9 @@ def handler(request): | |
lastmod = 'Fri, 31 Dec 9999 23:59:59 GMT' | ||
|
||
resp = yield from client.get('/', headers={'If-Modified-Since': lastmod}) | ||
body = yield from resp.read() | ||
assert 304 == resp.status | ||
assert b'' == body | ||
resp.close() | ||
|
||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think fix should be applied to
web_fileresponse.py
instead of baseStreamResponse
class.