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

Added support for writing Etag headers and handling If-None-Match request headers #4262

Closed
wants to merge 3 commits into from

Conversation

joshgarnett
Copy link
Contributor

@joshgarnett joshgarnett commented Apr 26, 2024

  • Entity tags (Etag) are used to identify specific versions of a resource. CDNs and Clients will use this in future requests to the server, using the If-None-Match header, to specify what data they already have and reduce the amount of data transferred if they already have the latest version.
  • The Etag is only written for GET requests with messages greater than 100 bytes and is set to the md5 hash of the message.
  • If a client sends the If-None-Match request header, the server will compare that value to the calculated etag. If they match, it will return http.StatusNotModified (304) and not write the message in the response.
  • Added additional tests to ensure the correct headers are being returned and that If-None-Match works.

…uest headers

* Entity tags (Etag) are used to identify specific versions of a resource.  CDNs and Clients will use this in future requests to the server, using the If-None-Match header, to specify what data they already have and reduce the amount of data transferred if they already have the latest version.
* The Etag is only written for messages greater than 100 bytes.  It is set to the md5 hash of the message.
* If a client sends the If-None-Match request header, the server will compare that value to the calculated etag.  If they match, it will return http.StatusNotModified (304) and not write the message in the response.
* Added additional tests to ensure the correct headers are being returned and that If-None-Match works.
@joshgarnett
Copy link
Contributor Author

https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/ETag has more details on how this should be implemented

@johanbrandhorst
Copy link
Collaborator

I appreciate the work put into this, but please open an issue first to discuss how to move forward with a feature request before opening a PR, to save us both time.

… on the TailerMD, which is a map. The order a map is returned is non-deterministic.
@joshgarnett
Copy link
Contributor Author

Good call out @johanbrandhorst, I almost created one first, but ended up being able to throw the code together fairly quickly. Do you want me to still open one?

@johanbrandhorst
Copy link
Collaborator

Yes please

@joshgarnett
Copy link
Contributor Author

Fixes #4263

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.

None yet

2 participants