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

Add option for set cache policy based on cookie name or pattern #1564

Merged
merged 5 commits into from
Feb 18, 2022

Conversation

ttaym
Copy link
Contributor

@ttaym ttaym commented Feb 10, 2022

Fixes #1544

PR adds new rule to http chains. Field 'cookie', field value string with prefix or postfix wildcard, forced (for now) equality sign, field argument string with prefix or postfix wildcard, action that typically should set new flag '$cache'.

The PR contains feature implementation and unit tests for http chains cookie rule. No functional tests.

Please note, that cookie field value string in TfwHttpMatchRule for cookie name matching is allocated string.

Implemented logic works only for requests. Header Set-Cookie not consulted.

In fact only setting $cache variable to zero works as expected. Setting it to 1 is just leaving Tempesta FW caching logic intact.

Currently in implemented logic setting $cache to 1 after some previous cookie rules set it to 0 will effectivelly reset it, as if it never set to zero.

As side-effect $cache setting action is usable in other rules as well.

Cookie name and value matching are case-sensitive. As i can see RFC6265#section-4.2 has no mention of case-insensitive matching (as it does for cookie attributes).

Signed-off-by: Aleksey Mikhaylov aym@tempesta-tech.com

Copy link
Contributor

@krizhanovsky krizhanovsky left a comment

Choose a reason for hiding this comment

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

LGTM, but this has nothing avout #1544 . Please fix the PR message before merging to not to close the issue by the merge.

P.S. Oh, I didn't notice that this is a Draft. Sorry.

@ttaym ttaym force-pushed the am-1544-caching-by-cookie-name branch 10 times, most recently from 6f30c7d to fbe2eb8 Compare February 17, 2022 09:46
Fixes #1544

Signed-off-by: Aleksey Mikhaylov <aym@tempesta-tech.com>
@ttaym ttaym force-pushed the am-1544-caching-by-cookie-name branch from fbe2eb8 to f68cf86 Compare February 17, 2022 11:02
@ttaym ttaym marked this pull request as ready for review February 17, 2022 11:02
Copy link
Contributor

@krizhanovsky krizhanovsky 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 after minor fixes and several cleanups

fw/http.c Outdated Show resolved Hide resolved
fw/http_match.c Show resolved Hide resolved
fw/http_match.c Show resolved Hide resolved
fw/http_match.c Show resolved Hide resolved
fw/http_match.c Outdated Show resolved Hide resolved
fw/http_match.c Show resolved Hide resolved
fw/http_match.c Outdated Show resolved Hide resolved
fw/http_match.c Show resolved Hide resolved
fw/http_tbl.c Outdated Show resolved Hide resolved
fw/http_match.c Outdated Show resolved Hide resolved
@ttaym
Copy link
Contributor Author

ttaym commented Feb 18, 2022

Updated PR. Please look at not resolved comments.

@ttaym ttaym merged commit abc9c21 into master Feb 18, 2022
@ttaym ttaym deleted the am-1544-caching-by-cookie-name branch February 18, 2022 15:26
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.

Caching by cookie
2 participants