-
Notifications
You must be signed in to change notification settings - Fork 841
Respect Vary rules when ignore_accept_encoding_mismatch is set to 2 (default value)
#12618
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
base: master
Are you sure you want to change the base?
Respect Vary rules when ignore_accept_encoding_mismatch is set to 2 (default value)
#12618
Conversation
8af88cd to
bc09fbe
Compare
bc09fbe to
57c9a01
Compare
57c9a01 to
44e69c5
Compare
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.
Looks like the file needs a newline added (at the end). I did not notice whether that was the case before you applied my suggestion. Did the restored AuTests pass prior to applying my suggestion?
yes, they all passed before the suugestion was applied |
44e69c5 to
ae91ee2
Compare
Looks like the tests no longer pass after the suggestion was applied. |
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 would like to have explanations for why the test cases are correct and why the implementation should be this way. It looks to me like found_match will not ever be set to true, and therefore a quality of -1.0 will always be returned from the new part of the code. It's good that it passes the tests, but this implementation doesn't make sense, does it? I believe you can replace all of the new code with return -1.0 and the tests will still pass.
(And assuming the tests are correct, I would rather have return -1.0 than an algorithm that does all the work to find a minimum and then doesn't do anything with it.)
5c02cb7 to
61620d9
Compare
2 (default value)
61620d9 to
90d2eb3
Compare
|
@JosiahWI I think the actual issue ended up being a bug in how we were deciding when to disable the vary mis-match for accept-encoding |
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 am suspicious of all the tests in this AuTest (including ones you have not touched) that reply with the empty-encoding alternate in response to requests for a deflate encoded resource. I think that is nonconforming to the RFCs and needs to be fixed. I would appreciate if @maskit or someone could double check my work on that.
Other than that general concern, I have some comments pertaining directly to the changes in this PR. Please take a look.
tests/gold_tests/headers/replays/normalized_ae_varied_transactions.replay.yaml
Outdated
Show resolved
Hide resolved
tests/gold_tests/headers/replays/normalized_ae_varied_transactions.replay.yaml
Show resolved
Hide resolved
tests/gold_tests/headers/replays/normalized_ae_varied_transactions.replay.yaml
Outdated
Show resolved
Hide resolved
tests/gold_tests/headers/replays/normalized_ae_varied_transactions.replay.yaml
Show resolved
Hide resolved
tests/gold_tests/headers/replays/normalized_ae_varied_transactions.replay.yaml
Outdated
Show resolved
Hide resolved
f3cbf6c to
9b7035d
Compare
|
The Rocky CI ran into this again (I've seen it before): |
I believe those tests are correct because of https://www.rfc-editor.org/rfc/rfc9110.html#section-12.5.3-10.2 which states
we are not sending either "identity;q=0" or "*;q=0" - so ATS can send back the identity response it has |
Whoops, I was looking at the obsoleted RFCs, thanks you for the correction! I think it is still non-conforming for a proxy to reply out-of-cache in this scenario, however: https://www.rfc-editor.org/rfc/rfc9111#section-4.1-1. We could argue about wording, but I think it will be more profitable to talk about the overall meaning of the RFCs. First let me go over my understanding of the background, just so I know we're on the same page about the setup. Suppose that ATS receives a request to The real issue I see with the current behavior is that ATS, having received a response (404 Not Found in the case of the AuTest) from the origin for This has been fixed in the case 1 deflate test in this PR. I am not sure why the similar tests for cases 2, 3, and 4 still pass. |
|
@JosiahWI I believe cases 2,3, and 4 are also correct because we are normalising the request's accept-encoding header, and deflate is not one that we keep during that process. perhaps we need to update the autests to assert that no server-response is to be expected at all because it is a cache hit? |
|
This comment from #7458 seems to suggest that the normalize_ae option is not intended to affect the selection of an alternate from cache: #7458 (comment). I wonder if there are any other rules for normalization that do affect alternate selection from cache... |
|
@JakeChampion You are right, I had missed that ATS cleared the Assuming that Ideally, I think it would be good to serve directly from cache and skip the request to origin (unless the response is stale), as you suggested. (In other words, the |
9b7035d to
2ad27db
Compare
| # Hardcode port to avoid port binding issues | ||
| ts.Variables.port = 8765 | ||
| ts.Disk.records_config.update({ | ||
| 'proxy.config.http.server_ports': f'{ts.Variables.port}', | ||
| }) |
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'm curious why this was necessary.
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.
for some reason this autest for me would exit before the server started up - it looked to be due to a port conflict, which i solved with this hard-coding, this wasn't meant to be pushed up though, it was meant to be local only for me, apologies
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.
Bummer. These local AuTest issues can greatly impede ease of development but are not always easy to debug.
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 don't know if we needed quite that many assertions to be convinced, but it's certainly very convincing. :)
This looks good (assuming the assertions pass; even if they don't, we can back that out and get in the fix here if you want). Maybe @bneradt could double check the port thing since he is more familiar with AuTests, but I'm comfortable putting this in master.
2ad27db to
b57ca8b
Compare
|
Apologies @JosiahWI - I did a rebase to tidy up the commits and it looks to have lost your approval |
Changes the condition to only ignore Accept-Encoding variance when explicitly set to 1, preserving proper Vary header semantics for the default value of 2. Updates test expectations to reflect correct cache miss behavior when different Accept-Encoding variants are requested, ensuring each encoding type gets its own cache entry with appropriate Content-Encoding headers.
b57ca8b to
b2d7dac
Compare
|
I'll wait for CI to pass (it looked like there were problems that may have been related to port selection in some AuTests. 🤔) and approve again. We do squash on merge which will tidy up the commit history. |
Looks like it all passed on ci now, yay. I think one of the next things I will look into is the flakey port selection in the autests because I do see that very often when running them locally as well. |
|
Looks like you guys figured it out. There is cryptic code that was added when the setting value 2 was introduced (70815db). I bet the line fixed on this PR was supposed to be checked in a similar way on the commit, but it's too cryptic IMO. I like the explicit comparison better 👍 trafficserver/src/iocore/cache/HttpTransactCache.cc Lines 313 to 332 in 577cbed
|
I believe the previous implementation was a bug because it was treating any non-zero
proxy.config.http.cache.ignore_accept_encoding_mismatchvalue as an indication to "ignore the mismatch", but the the documented default value of 2 is meant to honorVary: Accept-Encodingpreviously, the default value
2which should still respectVary: Accept-Encodingwhen the origin supplies it, ended up collapsing distinct encoding variants into a single cache alternate, meaning requests withAccept-Encoding: brcould get a response cached forgzip, which the tests confirmedchanging the check to only be for when the value is set to
1looks to be the behaviour we do want, and the original test assertions now passFixes #7458