You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by iv...@apache.org on 2016/01/15 13:57:20 UTC

svn commit: r1724790 - /subversion/trunk/subversion/mod_dav_svn/repos.c

Author: ivan
Date: Fri Jan 15 12:57:20 2016
New Revision: 1724790

URL: http://svn.apache.org/viewvc?rev=1724790&view=rev
Log:
mod_dav_svn: Do not set Last-Modified response header for GET responses.

This saves a bit of unnecessary work on the server-side, since:
- This header is not used by Subversion clients
- We allow caching GET responses for up-to 1 week without re-validation
- Browsers and proxies support ETag and use it for re-validation instead of
  the Last-Modified header

See the discussion in thread "Last-Modified HTTP header in GET responses" [1]

[1] https://www.mail-archive.com/dev@subversion.apache.org/msg34354.html

* subversion/mod_dav_svn/repos.c
  (get_last_modified): Remove.
  (set_headers): Do set Last-Modifed response header.

Modified:
    subversion/trunk/subversion/mod_dav_svn/repos.c

Modified: subversion/trunk/subversion/mod_dav_svn/repos.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/mod_dav_svn/repos.c?rev=1724790&r1=1724789&r2=1724790&view=diff
==============================================================================
--- subversion/trunk/subversion/mod_dav_svn/repos.c (original)
+++ subversion/trunk/subversion/mod_dav_svn/repos.c Fri Jan 15 12:57:20 2016
@@ -3038,50 +3038,6 @@ seek_stream(dav_stream *stream, apr_off_
        && resource->baselined))
 
 
-/* Return the last modification time of RESOURCE, or -1 if the DAV
-   resource type is not handled, or if an error occurs.  Temporary
-   allocations are made from RESOURCE->POOL. */
-static apr_time_t
-get_last_modified(const dav_resource *resource)
-{
-  apr_time_t last_modified;
-  svn_error_t *serr;
-  svn_revnum_t created_rev;
-  svn_string_t *date_time;
-
-  if (RESOURCE_LACKS_ETAG_POTENTIAL(resource))
-    return -1;
-
-  if ((serr = svn_fs_node_created_rev(&created_rev, resource->info->root.root,
-                                      resource->info->repos_path,
-                                      resource->pool)))
-    {
-      svn_error_clear(serr);
-      return -1;
-    }
-
-  if ((serr = svn_fs_revision_prop2(&date_time, resource->info->repos->fs,
-                                    created_rev, SVN_PROP_REVISION_DATE,
-                                    TRUE, resource->pool, resource->pool)))
-    {
-      svn_error_clear(serr);
-      return -1;
-    }
-
-  if (date_time == NULL || date_time->data == NULL)
-    return -1;
-
-  if ((serr = svn_time_from_cstring(&last_modified, date_time->data,
-                                    resource->pool)))
-    {
-      svn_error_clear(serr);
-      return -1;
-    }
-
-  return last_modified;
-}
-
-
 const char *
 dav_svn__getetag(const dav_resource *resource, apr_pool_t *pool)
 {
@@ -3151,7 +3107,6 @@ set_headers(request_rec *r, const dav_re
   svn_error_t *serr;
   svn_filesize_t length;
   const char *mimetype = NULL;
-  apr_time_t last_modified;
 
   /* As version resources don't change, encourage caching. */
   if (is_cacheable(r, resource))
@@ -3163,15 +3118,6 @@ set_headers(request_rec *r, const dav_re
   if (!resource->exists)
     return NULL;
 
-  last_modified = get_last_modified(resource);
-  if (last_modified != -1)
-    {
-      /* Note the modification time for the requested resource, and
-         include the Last-Modified header in the response. */
-      ap_update_mtime(r, last_modified);
-      ap_set_last_modified(r);
-    }
-
   /* generate our etag and place it into the output */
   apr_table_setn(r->headers_out, "ETag",
                  dav_svn__getetag(resource, resource->pool));