You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by sv...@apache.org on 2013/08/17 06:00:44 UTC

svn commit: r1514941 - in /subversion/branches/1.7.x: ./ STATUS subversion/mod_dav_svn/mod_dav_svn.c

Author: svn-role
Date: Sat Aug 17 04:00:44 2013
New Revision: 1514941

URL: http://svn.apache.org/r1514941
Log:
Merge the r1512432 group from trunk:

 * r1512432, r1512471, r1512472, r1513463, r1513472
   mod_dav_svn: No longer map requests to the filesystem.
   Justification:
     Prevents httpd from logging garbage filenames with %f and stops Directory
     blocks from matching against requests served by mod_dav_svn.
   Votes:
     +1: breser, philip, ivan

Modified:
    subversion/branches/1.7.x/   (props changed)
    subversion/branches/1.7.x/STATUS
    subversion/branches/1.7.x/subversion/mod_dav_svn/mod_dav_svn.c

Propchange: subversion/branches/1.7.x/
------------------------------------------------------------------------------
  Merged /subversion/trunk:r1512432,1512471-1512472,1513463,1513472

Modified: subversion/branches/1.7.x/STATUS
URL: http://svn.apache.org/viewvc/subversion/branches/1.7.x/STATUS?rev=1514941&r1=1514940&r2=1514941&view=diff
==============================================================================
--- subversion/branches/1.7.x/STATUS (original)
+++ subversion/branches/1.7.x/STATUS Sat Aug 17 04:00:44 2013
@@ -157,14 +157,6 @@ Veto-blocked changes:
 Approved changes:
 =================
 
- * r1512432, r1512471, r1512472, r1513463, r1513472
-   mod_dav_svn: No longer map requests to the filesystem.
-   Justification:
-     Prevents httpd from logging garbage filenames with %f and stops Directory
-     blocks from matching against requests served by mod_dav_svn.
-   Votes:
-     +1: breser, philip, ivan
-
  * r1438602, r1438683, r1441810
    Fix issue #4306, "multiple editor drive file merges record wrong mergeinfo
    during conflicts"

Modified: subversion/branches/1.7.x/subversion/mod_dav_svn/mod_dav_svn.c
URL: http://svn.apache.org/viewvc/subversion/branches/1.7.x/subversion/mod_dav_svn/mod_dav_svn.c?rev=1514941&r1=1514940&r2=1514941&view=diff
==============================================================================
--- subversion/branches/1.7.x/subversion/mod_dav_svn/mod_dav_svn.c (original)
+++ subversion/branches/1.7.x/subversion/mod_dav_svn/mod_dav_svn.c Sat Aug 17 04:00:44 2013
@@ -924,7 +924,41 @@ static int dav_svn__handler(request_rec 
   return DECLINED;
 }
 
+#define NO_MAP_TO_STORAGE_NOTE "dav_svn-no-map-to-storage"
 
+/* Prevent filename on the request from being set since we aren't serving a
+ * file off the disk.  This means that <Directory> blocks will not match and
+ * that * %f in logging formats will show as "-". */
+static int dav_svn__translate_name(request_rec *r)
+{
+  dir_conf_t *conf = ap_get_module_config(r->per_dir_config, &dav_svn_module);
+
+  /* module is not configured, bail out early */
+  if (!conf->fs_path && !conf->fs_parent_path)
+    return DECLINED;
+
+  /* Be paranoid and set it to NULL just in case some other module set it
+   * before we got called. */ 
+  r->filename = NULL;
+
+  /* Leave a note to ourselves so that we know not to decline in the 
+   * map_to_storage hook. */
+  apr_table_setn(r->notes, NO_MAP_TO_STORAGE_NOTE, (const char*)1); 
+  return OK;
+}
+
+/* Prevent core_map_to_storage from running if we prevented the r->filename
+ * from being set since core_map_to_storage doesn't like r->filename being
+ * NULL. */
+static int dav_svn__map_to_storage(request_rec *r)
+{
+  /* Check a note we left in translate_name since map_to_storage doesn't
+   * have access to our configuration. */
+  if (apr_table_get(r->notes, NO_MAP_TO_STORAGE_NOTE))
+    return OK;
+
+  return DECLINED;
+}
 
 
 
@@ -1071,6 +1105,12 @@ register_hooks(apr_pool_t *pconf)
   ap_register_input_filter("IncomingRewrite", dav_svn__location_in_filter,
                            NULL, AP_FTYPE_CONTENT_SET);
   ap_hook_fixups(dav_svn__proxy_request_fixup, NULL, NULL, APR_HOOK_MIDDLE);
+  /* translate_name hook is LAST so that it doesn't interfere with modules
+   * like mod_alias that are MIDDLE. */
+  ap_hook_translate_name(dav_svn__translate_name, NULL, NULL, APR_HOOK_LAST);
+  /* map_to_storage hook is LAST to avoid interferring with mod_http's
+   * handling of OPTIONS and TRACE. */
+  ap_hook_map_to_storage(dav_svn__map_to_storage, NULL, NULL, APR_HOOK_LAST);
 }