threads / discuss / 38380

GitWeb caching of snapshots

Subject: GitWeb caching of snapshots

## tl;dr

One message between Jan 16, 2015 and Jan 16, 2015.

replies: 0people: 1as markdown or json

Janus Troelsen· Jan 16, 2015, 00:13 UTC · lore
Hi,

I noticed that GitWeb caches based on the "Last-Modified" header. Won't this break if somebody force pushes a branch with the new newest commit being older than the previous? The modification date will be older, which makes little sense to HTTP clients, and it would probably break since they use the "If-Modified-Since" header.

Wouldn't it make more sense to use the commit ID as an ETag? This would avoid this bug. Two different archive types would get the same ETag even if the HTTP content body is not equal, but I think this is not in violation of the HTTP standard, since caching is based on URL's AND ETags.

Here's a link to git_snapshot which is the relevant function: http://git.kernel.org/cgit/git/git.git/tree/gitweb/gitweb.perl#n7314

Looking forward to your feedback.

Regards, Janus

← back to recent threads