s9y/Serendipity — pull request #49 by smoeding (2013-08-11 12:06:03+00:00)
Title: Add ETag header to style sheet for better caching.

This commit improves caching for the style sheet. Currently the style sheet uses an Expires header with a timestamp of one hour in the future. Therefore the style sheet will be downloaded again after one hour. This is probably redundant since the style sheet does not change that often.

The change introduces the ETag header for the style sheet using a hash value of the CSS code. After the expiration time the browser will try to get the style sheet again using a If-None-Match header. The code calculates the hash again and sends a HTTP 304 Not Modified header when it is still the same. This saves bandwidth by not sending the complete style sheet again.