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