[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

[PATCH] Enable downstream caching of versioned GET responses

From: Justin Erenkrantz <justin_at_erenkrantz.com>
Date: Thu, 14 Jun 2012 14:06:21 +0200

Hey, lookie, a bunch of ###'s. =)

I'm not quite sure whether we would want to set Cache-Control to just
"public" and not specify a max-age. Or, perhaps we need to add some
configuration directives to allow the admin to tweak the value.

I checked the wireshark traffic on a checkout and it looks like all
the right headers are set - with this patch, we now have
Cache-Control, ETag, and Last-Modified all set. When mod_deflate is
run, it'll set the appropriate vary headers so that should all just
work too. -- justin

Index: subversion/mod_dav_svn/repos.c
===================================================================
--- subversion/mod_dav_svn/repos.c (revision 1350197)
+++ subversion/mod_dav_svn/repos.c (working copy)
@@ -3043,14 +3043,12 @@ set_headers(request_rec *r, const dav_resource *re
   apr_table_setn(r->headers_out, "ETag",
                  dav_svn__getetag(resource, resource->pool));

-#if 0
   /* As version resources don't change, encourage caching. */
- /* ### FIXME: This conditional is wrong -- type is often REGULAR,
- ### and the resource doesn't seem to be baselined. */
- if (resource->type == DAV_RESOURCE_TYPE_VERSION)
+ if ((resource->type == DAV_RESOURCE_TYPE_REGULAR
+ && resource->versioned && !resource->collection)
+ || resource->type == DAV_RESOURCE_TYPE_VERSION)
     /* Cache resource for one week (specified in seconds). */
     apr_table_setn(r->headers_out, "Cache-Control", "max-age=604800");
-#endif

   /* we accept byte-ranges */
   apr_table_setn(r->headers_out, "Accept-Ranges", "bytes");
Received on 2012-06-14 14:06:58 CEST

This is an archived mail posted to the Subversion Dev mailing list.

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.