As `wget -N' adds 1 second to the If-Modified-Since stamp derived from
existing local files (maybe due to different time stamp resolutions on
various file systems), I noticed that the If-Modified-Since stamp
checks seem to give "reversed" results.
The following test commands display the HTTP response headers for the
current Fossil Source Tarball. Requests are sent with
If-Modified-Since stamps matching the time stamp of the unversioned
file ("Fri, 4 May 2018 13:06:49 GMT", at the time of this writing), as
well as 1 second earlier, and 1 second later.
(0) Matching If-Modified-Since stamp (equal to the file mtime),
returns "304 Not Modified", as expected:
wget --spider -d --header "If-Modified-Since: Fri, 4 May 2018 13:06:49
GMT" "http://www.fossil-scm.org/index.html/uv/fossil-src-2.6.tar.gz"
(1) Expired If-Modified-Since stamp (older than the file mtime),
erroneously returns "304 Not Modified", but should return "200 OK":
wget --spider -d --header "If-Modified-Since: Fri, 4 May 2018 13:06:48
GMT" "http://www.fossil-scm.org/index.html/uv/fossil-src-2.6.tar.gz"
(2) Valid If-Modified-Since stamp (more recent than the file mtime),
returns "200 OK", but should return "304 Not Modified":
wget --spider -d --header "If-Modified-Since: Fri, 4 May 2018 13:06:50
GMT" "http://www.fossil-scm.org/index.html/uv/fossil-src-2.6.tar.gz"
This "reversed" caching behavior seems to origin from the following test:
http://www.fossil-scm.org/index.html/artifact?name=0afe42f3bd&ln=152
The second comparison should probably be changed from:
if( x<=0 || x>mtime ) return;
to:
if( x<=0 || x<mtime ) return;
/* Note: x = If-Modified-Since stamp, mtime = served resource mtime,
return = cache miss, continue with web page rendering */
With this change, If-Modified-Since stamps more recent than or equal
to mtime get cache hits, and If-Modified-Since stamps older than mtime
get cache misses.
--Florian
_______________________________________________
fossil-users mailing list
[email protected]
http://lists.fossil-scm.org:8080/cgi-bin/mailman/listinfo/fossil-users