Skip to content
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

Fixed #17552 -- Removed a hack for IE6 and earlier. #2781

Closed
wants to merge 1 commit into from

Conversation

aaugustin
Copy link
Member

Thanks Aaron Cannon for the report.

ctype = response.get('Content-Type', '').lower()
if not ctype.startswith("text/") or "javascript" in ctype:
return response
patch_vary_headers(response, ('Accept-Encoding',))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you explain why it's okay to move patch_vary_headers()? (I know nothing about it and am just reading about it now.)

Also, remove (I think) the failing test.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Moving patch_vary_headers is a small performance optimization.

If this method returns before testing for the Accept-Encoding header, the response doesn't depend on Accept-Encoding, so it needs not be added to the Vary header. That's why it makes sense to put patch_vary_headers just before testing for Accept-Encoding.

(In fact, if the response already has a Content-Encoding header, a proper implementation willl have tested the Accept-Encoding header and called patch_vary_headers, so this doesn't change caching behavior in practice.)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I also removed the failing test (well done, pull request testing!)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay, I buy it. How about a more descriptive commit message (at least mention GZipMiddleware)?

Thanks Aaron Cannon for the report and Tim Graham for the review.
@timgraham
Copy link
Member

merged in df09d85.

@timgraham timgraham closed this Jun 10, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants