-
Notifications
You must be signed in to change notification settings - Fork 104
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
Parse "pragma" field in response, honor "pragma" field in request #1120
Conversation
There are no anything about "Pragma" in response headers, but at least Firefox and Chrome/Chromium recognize that field in response headers, and do not cache such responses.
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.
Good to merge!
@@ -724,6 +724,10 @@ enum { | |||
|
|||
I_EoT, /* end of term */ | |||
I_EoL, | |||
|
|||
/* Pragma header */ | |||
I_Pragma, |
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.
Not a big deal, just seems like End of Term
and End of Line
should be last in the enumeration and Pragma header enum values should stand closer to other headers enums. Look a little bit messy as for me.
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.
Made follow-up changes in #1124.
@@ -1001,6 +1001,62 @@ TEST(http_parser, fills_hdr_tbl_for_resp) | |||
} | |||
} | |||
|
|||
TEST(http_parser, cache_control_flags) |
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.
New tests are only about parsing responses, requests are not checked, not all TFW_HTTP_CC_*
flags are tested. No need to address this comment in the PR, since functional tests from tempesta-tech/tempesta-test#59 will cover the some cases. Just wanted to link this test case with #1059 issue.
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.
Good to merge.
The patchset extends "pragma" field processing a bit. It's now parsed in both request and response headers. Also, both sources are used to decide whenever to cache a response.
Although RFC 7234, 5.4 doesn't explicitly specify meaning of "
Pragma: no-cache
" in response header, it is still used by various user agents — at least Firefox and Chromium — perhaps for compatibility reasons. So we probably want to abstain from caching if response comes with "pragma: no-cache
" too, even if it's not a standard-compliant behavior.(fixes #1116)