Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
minify: make conditional requests work. No HTTP/304 was ever generate…
…d and file were reminified uselessly. By specification [0], the if-modified-since HTTP header sent by browsers does not include milliseconds. Before this patch, let's say a file was generate at time: t_real-file = 2020-03-22T02:15:53.548Z (note the fractional seconds) When issuing a conditional request, the browser would truncate the fractional part, and only request an if-modified-since with this contents: t_if-modified-since = 2020-03-22T02:15:53.000Z The minify() function would return HTTP/304 only if t_if-modified-since >= t_real-file, but this would never be true unless, by chance, a file was generated at XX.000Z. This resulted in that file being minified/compressed again and resent to the client for no reason. After this patch, the server correctly responds with HTTP/304 without doing any computation, and the browser uses the cached file. [0] https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/If-Modified-Since
- Loading branch information