Skip to content

Conversation

Spixmaster
Copy link

@Spixmaster Spixmaster commented Sep 23, 2025

Programmed feature #2242. First off, the static file server now sends HTTP response header "ETag". Following HTTP requests by the client which include HTTP request header "If-None-Match" are only served if the value for HTTP response header "ETag" is not included in the value of HTTP request header "If-None-Match", otherwise an HTTP response with status code 304 is served which includes the HTTP response header "ETag" again that would have been sent with a normal status code of 200.

Useful resources:

Programmed feature yhirose#2242.
First of, the static file server now sends HTTP response header "ETag".
Following HTTP requests by the client which include HTTP request header
"If-None-Match" are only served if the value for HTTP response header "ETag" is
not included in the value of HTTP request header "If-None-Match", otherwise an
HTTP response with status code 304 is served which includes the HTTP response
header "ETag" again that would have been sent with a normal status code of 200.

Useful resources:
- https://http.dev/caching
- https://developer.mozilla.org/en-US/docs/Web/HTTP/Reference/Headers/ETag
- https://developer.mozilla.org/en-US/docs/Web/HTTP/Reference/Headers/If-None-Match
- https://www.rfc-editor.org/rfc/rfc9110.html#name-304-not-modified
@Spixmaster
Copy link
Author

Spixmaster commented Sep 23, 2025

Please check for style and do adjustements. Please adjust the location of the test. I just put it at the end and the names should be adjusted too.

Does Server::process_request() also need sending of HTTP response header ETag?

@Spixmaster Spixmaster marked this pull request as draft September 23, 2025 16:02
@Spixmaster
Copy link
Author

Spixmaster commented Sep 23, 2025

Test "ServerTest.StaticFileRangeBigFile" causes a segmentation fault. Do you have an idea for the reason?

Added more comments.
Check for method to be GET or HEAD.
Explicitly clear the body.
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.

1 participant