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

Parse "pragma" field in response, honor "pragma" field in request #1120

Merged
merged 3 commits into from
Nov 28, 2018

Conversation

i-rinat
Copy link
Contributor

@i-rinat i-rinat commented Nov 27, 2018

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)

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.
Copy link
Contributor

@vankoven vankoven left a 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,
Copy link
Contributor

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.

Copy link
Contributor Author

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)
Copy link
Contributor

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.

Copy link
Contributor

@aleksostapenko aleksostapenko left a comment

Choose a reason for hiding this comment

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

Good to merge.

@i-rinat i-rinat merged commit 445470a into master Nov 28, 2018
@i-rinat i-rinat deleted the ri-pragma-no-cache branch November 28, 2018 20:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Process the Pragma header field
3 participants