Access servlet does not support Last-Modified or If-Modified-Since HTTP headers
Description
Attachments
- 03 Feb 2015, 09:00 AM
- 03 Feb 2015, 09:00 AM
- 12 Dec 2014, 04:54 PM
- 12 Dec 2014, 04:50 PM
depends on
is related to
Activity
Matthew Buckett February 5, 2015 at 5:58 AM
This can be handy for testing that cache invalidation is working by constantly uploading a file to resources:
while true; do echo '<!DOCTYPE html><html><head><title>test</title></head><body><h1>' $(date) '</h1></body></html>' | curl -k -u admin:admin -T - https://boot2docker/dav/ad32b569-1264-4a46-8965-ed3dc405115d/file.html; sleep 1; done
Matthew Buckett February 5, 2015 at 5:33 AM
One gotcha with testing this is that Chrome doesn't cache anything if there is a certificate error for the page (eg self signed).
One side note is that you are not supposed to return any additional headers with a 304 response:
http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.3.5
It seems in testing that Tomcat is removing all headers that are set (eg last modified, content-disposition), so this doesn't cause a problem, but it would be good to move the 304 shortcut earlier in the code so we don't have to rely on Tomcat doing this and it's clearer to the programmer that on 304 reponses you shouldn't see any errors.
Hudson CI Server February 4, 2015 at 8:15 PM
SUCCESS: Integrated in sakai-10-java-1.7 #172 (See http://builds.sakaiproject.org:8080/job/sakai-10-java-1.7/172/)
https://sakaiproject.atlassian.net/browse/KNL-1316#icft=KNL-1316 merge 316148 from trunk (enietzel@anisakai.com: rev 317087)
Matthew Jones February 3, 2015 at 9:00 AM
Verified that the headers as expected are set and the browser accepts the 304 Not Modified and doesn't redownload the file.
Matthew Jones December 19, 2014 at 7:44 AM
10.3 was officially tagged and the binaries released yesterday and announcement is forthcoming. https://sakaiproject.atlassian.net/browse/KNL-1314#icft=KNL-1314 is in 10.3, this was not a blocker for 10.3 as that other issue fixed the problem and kept current behavior, this is an improvement that we've never had before.
This would be targeted for 10.4, probably being merged into 10.x today or by early next week once it's verified.
The access/content servlet for Resources does not output the Last-Modified HTTP header, or take account of If-Modified-Since headers in GET requests.
This is significant because the lack of this support means that browsers or intermediate caches will always be sent a complete copy of the file, rather than returning an HTTP 304 (not modified) response if the file has already been cached.
This increases response times and thus delay perceived by users, and increases bandwidth use.
As the access serverlet is returning an HTTP protocol response of "HTTP/1.1", it is required to support If-Modified-Since, and this is therefore also a protocol violation.