|
|
008793 |
Index: modules/dav/fs/repos.c
|
|
|
008793 |
===================================================================
|
|
|
008793 |
--- a/modules/dav/fs/repos.c (revision 1533447)
|
|
|
008793 |
+++ b/modules/dav/fs/repos.c (revision 1533448)
|
|
|
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->uri);
|
|
|
008793 |
- if (len > 1 && r->uri[len - 1] == '/') {
|
|
|
008793 |
- s = apr_pstrmemdup(r->pool, r->uri, len-1);
|
|
|
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 |
resource->uri = s;
|
|
|
008793 |
}
|
|
|
008793 |
else {
|
|
|
008793 |
- resource->uri = r->uri;
|
|
|
008793 |
+ resource->uri = r->unparsed_uri;
|
|
|
008793 |
}
|
|
|
008793 |
|
|
|
008793 |
if (r->finfo.filetype != APR_NOFILE) {
|
|
|
008793 |
@@ -1482,6 +1482,18 @@
|
|
|
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 |
@@ -1537,6 +1549,7 @@
|
|
|
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 |
@@ -1579,7 +1592,7 @@
|
|
|
008793 |
|
|
|
008793 |
/* copy the file to the URI, too. NOTE: we will pad an extra byte
|
|
|
008793 |
for the trailing slash later. */
|
|
|
008793 |
- dav_buffer_place_mem(pool, &fsctx->uri_buf, dirent.name, len + 1, 1);
|
|
|
008793 |
+ escaped_len = dav_fs_append_uri(pool, &fsctx->uri_buf, dirent.name, 1);
|
|
|
008793 |
|
|
|
008793 |
/* if there is a secondary path, then do that, too */
|
|
|
008793 |
if (fsctx->path2.buf != NULL) {
|
|
|
008793 |
@@ -1612,7 +1625,7 @@
|
|
|
008793 |
fsctx->path2.cur_len += len;
|
|
|
008793 |
|
|
|
008793 |
/* adjust URI length to incorporate subdir and a slash */
|
|
|
008793 |
- fsctx->uri_buf.cur_len += len + 1;
|
|
|
008793 |
+ fsctx->uri_buf.cur_len += escaped_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 |
@@ -1678,8 +1691,8 @@
|
|
|
008793 |
*/
|
|
|
008793 |
dav_buffer_place_mem(pool, &fsctx->path1,
|
|
|
008793 |
fsctx->locknull_buf.buf + offset, len + 1, 0);
|
|
|
008793 |
- dav_buffer_place_mem(pool, &fsctx->uri_buf,
|
|
|
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 |
if (fsctx->path2.buf != NULL) {
|
|
|
008793 |
dav_buffer_place_mem(pool, &fsctx->path2,
|
|
|
008793 |
fsctx->locknull_buf.buf + offset,
|
|
|
008793 |
Index: modules/dav/main/mod_dav.c
|
|
|
008793 |
===================================================================
|
|
|
008793 |
--- a/modules/dav/main/mod_dav.c (revision 1533447)
|
|
|
008793 |
+++ b/modules/dav/main/mod_dav.c (revision 1533448)
|
|
|
008793 |
@@ -396,11 +396,9 @@
|
|
|
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(e_uri, '&') == NULL)
|
|
|
008793 |
- return e_uri;
|
|
|
008793 |
+ if (ap_strchr_c(uri, '&') == NULL)
|
|
|
008793 |
+ return uri;
|
|
|
008793 |
|
|
|
008793 |
/* there was a '&', so more work is needed... sigh. */
|
|
|
008793 |
|
|
|
008793 |
@@ -408,7 +406,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, e_uri, 0);
|
|
|
008793 |
+ return apr_xml_quote_string(p, uri, 0);
|
|
|
008793 |
}
|
|
|
008793 |
|
|
|
008793 |
|
|
|
008793 |
@@ -604,7 +602,8 @@
|
|
|
008793 |
return DONE;
|
|
|
008793 |
}
|
|
|
008793 |
|
|
|
008793 |
-/* handy function for return values of methods that (may) create things */
|
|
|
008793 |
+/* handy function for return values of methods that (may) create things.
|
|
|
008793 |
+ * locn if provided is assumed to be escaped. */
|
|
|
008793 |
static int dav_created(request_rec *r, const char *locn, const char *what,
|
|
|
008793 |
int replaced)
|
|
|
008793 |
{
|
|
|
008793 |
@@ -612,8 +611,6 @@
|
|
|
008793 |
|
|
|
008793 |
if (locn == NULL) {
|
|
|
008793 |
locn = r->unparsed_uri;
|
|
|
008793 |
- } else {
|
|
|
008793 |
- locn = ap_escape_uri(r->pool, locn);
|
|
|
008793 |
}
|
|
|
008793 |
|
|
|
008793 |
/* did the target resource already exist? */
|
|
|
008793 |
@@ -3004,7 +3001,7 @@
|
|
|
008793 |
}
|
|
|
008793 |
|
|
|
008793 |
/* return an appropriate response (HTTP_CREATED or HTTP_NO_CONTENT) */
|
|
|
008793 |
- return dav_created(r, lookup.rnew->uri, "Destination",
|
|
|
008793 |
+ return dav_created(r, lookup.rnew->unparsed_uri, "Destination",
|
|
|
008793 |
resnew_state == DAV_RESOURCE_EXISTS);
|
|
|
008793 |
}
|
|
|
008793 |
|
|
|
008793 |
@@ -4610,7 +4607,7 @@
|
|
|
008793 |
|
|
|
008793 |
/* return an appropriate response (HTTP_CREATED) */
|
|
|
008793 |
/* ### spec doesn't say what happens when destination was replaced */
|
|
|
008793 |
- return dav_created(r, lookup.rnew->uri, "Binding", 0);
|
|
|
008793 |
+ return dav_created(r, lookup.rnew->unparsed_uri, "Binding", 0);
|
|
|
008793 |
}
|
|
|
008793 |
|
|
|
008793 |
|
|
|
008793 |
Index: modules/dav/main/mod_dav.h
|
|
|
008793 |
===================================================================
|
|
|
008793 |
--- a/modules/dav/main/mod_dav.h (revision 1533447)
|
|
|
008793 |
+++ b/modules/dav/main/mod_dav.h (revision 1533448)
|
|
|
008793 |
@@ -386,7 +386,7 @@
|
|
|
008793 |
* REGULAR and WORKSPACE resources,
|
|
|
008793 |
* and is always 1 for WORKING */
|
|
|
008793 |
|
|
|
008793 |
- const char *uri; /* the URI for this resource */
|
|
|
008793 |
+ const char *uri; /* the escaped URI for this resource */
|
|
|
008793 |
|
|
|
008793 |
dav_resource_private *info; /* the provider's private info */
|
|
|
008793 |
|