Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This also adds support for ETag caching for the settings pages, specifically for the following pages ETag caching is now enabled:
I also fixed some issues with the previous caching not being RFC 7232 compliant.
In Section 4.1 of RFC 7232 it is defined that a 304 (Not Modified) status code indicates that a conditional GET or HEAD request has been received and would have resulted in a 200 (OK) response. This is why I added a check if the status code was 200.
Another thing that the previous implementation did not do was that the server generating a 304 response MUST generate any of the following header fields that would have been sent in a 200 (OK) response to the same request: Cache-Control, Content-Location, Date, ETag, Expires, and Vary. This is why I'm now calling the
setStaticContentCacheHeadersfunction in thehandleIfNoneMatchCacheHeaderfunction.To eliminate duplicate code, I created the function
handleStaticContent. I added a comment that explains what this function does. Basically, now instead of having blocks like this:We now have this:
Which is much shorter. 😄
If you are wondering what the
eTagSuffixis used for in thehandleStaticContentfunction, it is currently not used, but I added it to have more control over caching. In the future this could be used if we want to use ETag caching forfxdataoreffects.I also fixed a small bug in
cdata.jsthat causedfavicon_lengthto have the wrong value.