Skip to content

Conversation

@matthewbauer
Copy link
Member

GitHub now omits the etag, but 304 implies it matches the one we
provided. Just use that one to avoid having an etag-less resource.

Fixes #4469

GitHub now omits the etag, but 304 implies it matches the one we
provided. Just use that one to avoid having an etag-less resource.

Fixes NixOS#4469
@matthewbauer matthewbauer mentioned this pull request Jan 22, 2021
@lilyball
Copy link
Member

Interesting. We should also complain to GitHub because RFC 7232 §4.1 states that a 304 Not Modified MUST include an ETag that would have been included in a 200 OK.

@lilyball
Copy link
Member

I also think we should tweak this to simply not assert if the etag doesn't match, because the server could plausibly return a different ETag than what we provided as long as the server still considers it content-equivalent.

@matthewbauer
Copy link
Member Author

Interesting. We should also complain to GitHub because RFC 7232 §4.1 states that a 304 Not Modified MUST include an ETag that would have been included in a 200 OK.

That's interesting - I assumed it was an optional response header.

I also think we should tweak this to simply not assert if the etag doesn't match, because the server could plausibly return a different ETag than what we provided as long as the server still considers it content-equivalent.

Yeah that makes sense - asserting based on an external service is not good anyway. I think you may end up with multiple entries in the cache for each etag, but that's not necessarily bad.

dhess pushed a commit to hackworthltd/hacknix that referenced this pull request Jan 23, 2021
dhess pushed a commit to hackworthltd/hacknix that referenced this pull request Jan 23, 2021
@domenkozar domenkozar requested a review from edolstra January 23, 2021 18:54
@edolstra edolstra merged commit c5b42c5 into NixOS:master Jan 25, 2021
@zimbatm
Copy link
Member

zimbatm commented Jan 25, 2021

does this need to be back-ported as well?

@matthewbauer
Copy link
Member Author

matthewbauer commented Jan 25, 2021

does this need to be back-ported as well?

Yes - it's not fatal like with master, but it does end up passing the wrong values to If-None-Match meaning downloadCached doesn't work properly with github.

@matthewbauer
Copy link
Member Author

Backport at #4475

@kirelagin
Copy link
Member

@lilyball I agree, my understanding of the spec is that this makes GitLab non-compliant. Has anyone reported it to them?

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.

etag assertions

5 participants