-
Notifications
You must be signed in to change notification settings - Fork 13.3k
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
ETag support for WebServer #7709
ETag support for WebServer #7709
Conversation
…whocodes/Arduino into ETag-ESP8266WebServer-support
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.
Thanks for the PR! Very interesting, I see how it could be of use.
Minor little things noted below. Also, can you please put a note in the docs or an example on how to enable this for an end-user? Doesn't need to be a massive writeup, but a line or three in the docs would be of immense use later on.
Nice, it allows to reduce network activity ! Is this a feature that is only useful while developing web sites, or is it also useful in production ?
or with an option (arduino menu and / or global define) ?
or on sketch request (as proposed by your PR) ?
Does it slow down web requets on big files since it is calculated on every request ? |
Thanks for the appreciation
IMHO it depends on the situation:
But the two cache control methods could be used together for maximum caching (in the next implementation?)
This is a good question...
I opted for the
Actually as implemented right now the hash in only computed once when you call An option for a transparent implementation could be to compute the ETag every time a static page is requested, it would:
In this case/implementation a |
ServeStatic logic refactoring
With this last commit now there is Transparent ETag support with backward compatibility by splitting and specialising Inside On the The choice if to use the (I will add examples and documentation in a few days) |
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.
Sorry for the delay. Looks good to me now, thanks!
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.
Thanks!
Approving without doc nor example because the added feature is configuration-less and transparent for the user.
I have added some improvements in #8227 @d-a-v || @earlephilhower: This can one be closed. |
This pull request for ETag cache support on static files
This is done by deriving
ESP8266WebServerETag
fromESP8266WebServer
The hash for Etag is done with the native
MD5Builder
This features is very useful when developing web sites on esp8266, only file actually changed during development are downloaded again
Also the existing
max-age=
can be too broad and is easy to mismanage