Blame SOURCES/httpd-2.4.6-r1610013.patch

008793
Index: modules/dav/main/mod_dav.c
008793
===================================================================
008793
--- a/modules/dav/main/mod_dav.c	(revision 1610012)
008793
+++ b/modules/dav/main/mod_dav.c	(revision 1610013)
008793
@@ -396,9 +396,11 @@
008793
  */
008793
 static const char *dav_xml_escape_uri(apr_pool_t *p, const char *uri)
008793
 {
008793
+    const char *e_uri = ap_escape_uri(p, uri);
008793
+
008793
     /* check the easy case... */
008793
-    if (ap_strchr_c(uri, '&') == NULL)
008793
-        return uri;
008793
+    if (ap_strchr_c(e_uri, '&') == NULL)
008793
+        return e_uri;
008793
 
008793
     /* there was a '&', so more work is needed... sigh. */
008793
 
008793
@@ -406,7 +408,7 @@
008793
      * Note: this is a teeny bit of overkill since we know there are no
008793
      * '<' or '>' characters, but who cares.
008793
      */
008793
-    return apr_xml_quote_string(p, uri, 0);
008793
+    return apr_xml_quote_string(p, e_uri, 0);
008793
 }
008793
 
008793
 
008793
Index: modules/dav/main/mod_dav.h
008793
===================================================================
008793
--- a/modules/dav/main/mod_dav.h	(revision 1610012)
008793
+++ b/modules/dav/main/mod_dav.h	(revision 1610013)
008793
@@ -386,7 +386,9 @@
008793
                          * REGULAR and WORKSPACE resources,
008793
                          * and is always 1 for WORKING */
008793
 
008793
-    const char *uri;    /* the escaped URI for this resource */
008793
+    const char *uri;    /* the URI for this resource;
008793
+                         * currently has an ABI flaw where sometimes it is
008793
+                         * assumed to be encoded and sometimes not */
008793
 
008793
     dav_resource_private *info;         /* the provider's private info */
008793
 
008793
Index: modules/dav/main/props.c
008793
===================================================================
008793
--- a/modules/dav/main/props.c	(revision 1610012)
008793
+++ b/modules/dav/main/props.c	(revision 1610013)
008793
@@ -321,10 +321,14 @@
008793
 /* do a sub-request to fetch properties for the target resource's URI. */
008793
 static void dav_do_prop_subreq(dav_propdb *propdb)
008793
 {
008793
+    /* need to escape the uri that's in the resource struct because during
008793
+     * the property walker it's not encoded. */
008793
+    const char *e_uri = ap_escape_uri(propdb->resource->pool,
008793
+                                      propdb->resource->uri);
008793
+
008793
     /* perform a "GET" on the resource's URI (note that the resource
008793
        may not correspond to the current request!). */
008793
-    propdb->subreq = ap_sub_req_lookup_uri(propdb->resource->uri, propdb->r,
008793
-                                           NULL);
008793
+    propdb->subreq = ap_sub_req_lookup_uri(e_uri, propdb->r, NULL);
008793
 }
008793
 
008793
 static dav_error * dav_insert_coreprop(dav_propdb *propdb,
008793
Index: modules/dav/fs/repos.c
008793
===================================================================
008793
--- a/modules/dav/fs/repos.c	(revision 1610012)
008793
+++ b/modules/dav/fs/repos.c	(revision 1610013)
008793
@@ -717,13 +717,13 @@
008793
     resource->pool = r->pool;
008793
 
008793
     /* make sure the URI does not have a trailing "/" */
008793
-    len = strlen(r->unparsed_uri);
008793
-    if (len > 1 && r->unparsed_uri[len - 1] == '/') {
008793
-        s = apr_pstrmemdup(r->pool, r->unparsed_uri, len-1);
008793
+    len = strlen(r->uri);
008793
+    if (len > 1 && r->uri[len - 1] == '/') {
008793
+        s = apr_pstrmemdup(r->pool, r->uri, len-1);
008793
         resource->uri = s;
008793
     }
008793
     else {
008793
-        resource->uri = r->unparsed_uri;
008793
+        resource->uri = r->uri;
008793
     }
008793
 
008793
     if (r->finfo.filetype != APR_NOFILE) {
008793
@@ -1482,18 +1482,6 @@
008793
     return dav_fs_deleteset(info->pool, resource);
008793
 }
008793
 
008793
-/* Take an unescaped path component and escape it and append it onto a
008793
- * dav_buffer for a URI */
008793
-static apr_size_t dav_fs_append_uri(apr_pool_t *p, dav_buffer *pbuf,
008793
-                                    const char *path, apr_size_t pad)
008793
-{
008793
-    const char *epath = ap_escape_uri(p, path);
008793
-    apr_size_t epath_len = strlen(epath);
008793
-
008793
-    dav_buffer_place_mem(p, pbuf, epath, epath_len + 1, pad);
008793
-    return epath_len;
008793
-}
008793
-
008793
 /* ### move this to dav_util? */
008793
 /* Walk recursively down through directories, *
008793
  * including lock-null resources as we go.    */
008793
@@ -1549,7 +1537,6 @@
008793
     }
008793
     while ((apr_dir_read(&dirent, APR_FINFO_DIRENT, dirp)) == APR_SUCCESS) {
008793
         apr_size_t len;
008793
-        apr_size_t escaped_len;
008793
 
008793
         len = strlen(dirent.name);
008793
 
008793
@@ -1592,7 +1579,7 @@
008793
 
008793
         /* copy the file to the URI, too. NOTE: we will pad an extra byte
008793
            for the trailing slash later. */
008793
-        escaped_len = dav_fs_append_uri(pool, &fsctx->uri_buf, dirent.name, 1);
008793
+        dav_buffer_place_mem(pool, &fsctx->uri_buf, dirent.name, len + 1, 1);
008793
 
008793
         /* if there is a secondary path, then do that, too */
008793
         if (fsctx->path2.buf != NULL) {
008793
@@ -1625,7 +1612,7 @@
008793
             fsctx->path2.cur_len += len;
008793
 
008793
             /* adjust URI length to incorporate subdir and a slash */
008793
-            fsctx->uri_buf.cur_len += escaped_len + 1;
008793
+            fsctx->uri_buf.cur_len += len + 1;
008793
             fsctx->uri_buf.buf[fsctx->uri_buf.cur_len - 1] = '/';
008793
             fsctx->uri_buf.buf[fsctx->uri_buf.cur_len] = '\0';
008793
 
008793
@@ -1691,8 +1678,8 @@
008793
             */
008793
             dav_buffer_place_mem(pool, &fsctx->path1,
008793
                                  fsctx->locknull_buf.buf + offset, len + 1, 0);
008793
-            dav_fs_append_uri(pool, &fsctx->uri_buf,
008793
-                              fsctx->locknull_buf.buf + offset, 0);
008793
+            dav_buffer_place_mem(pool, &fsctx->uri_buf,
008793
+                                 fsctx->locknull_buf.buf + offset, len + 1, 0);
008793
             if (fsctx->path2.buf != NULL) {
008793
                 dav_buffer_place_mem(pool, &fsctx->path2,
008793
                                      fsctx->locknull_buf.buf + offset,