Skip to content

feat: add etag to slim binaries endpoint #5750

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

Merged
merged 3 commits into from
Jan 17, 2023
Merged

feat: add etag to slim binaries endpoint #5750

merged 3 commits into from
Jan 17, 2023

Conversation

deansheather
Copy link
Member

  • Adds ETag header to the slim binary endpoint
  • Adds support for If-None-Match and If-Match to the slim binary endpoint (Go's http.FileServer does this for us when we set ETag first).
  • Adds tests for ETags and If-None-Match

Unblocks coder/vscode-coder#23

@deansheather deansheather requested a review from mafredri January 17, 2023 17:39
@deansheather deansheather requested a review from a team as a code owner January 17, 2023 17:39
@deansheather deansheather requested review from BrunoQuaresma and coadler and removed request for a team and BrunoQuaresma January 17, 2023 17:39
Copy link
Member

@mafredri mafredri left a comment

Choose a reason for hiding this comment

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

Nice!

}

// Avoid DOS by using a pool, and only doing work once per file.
v, err, _ := b.sf.Do(name, func() (interface{}, error) {
Copy link
Member

Choose a reason for hiding this comment

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

Did I understand the logic correctly that the purpose of this is to be able to compute hashes of served binaries that were not in coder.sha1, e.g. when it's missing?

Copy link
Member Author

Choose a reason for hiding this comment

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

Yep, basically. This also serves the case where we're serving directly from the site FS because the binaries weren't compressed.

Copy link
Member

Choose a reason for hiding this comment

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

Ok, perfect. Thanks for confirming!

@deansheather deansheather merged commit b19d644 into main Jan 17, 2023
@deansheather deansheather deleted the dean/slim-etag branch January 17, 2023 18:38
@github-actions github-actions bot locked and limited conversation to collaborators Jan 17, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants