summaryrefslogtreecommitdiff
path: root/modules/dav/main/util.c
diff options
context:
space:
mode:
Diffstat (limited to 'modules/dav/main/util.c')
-rw-r--r--modules/dav/main/util.c36
1 files changed, 35 insertions, 1 deletions
diff --git a/modules/dav/main/util.c b/modules/dav/main/util.c
index aa085841..ab42af02 100644
--- a/modules/dav/main/util.c
+++ b/modules/dav/main/util.c
@@ -77,6 +77,30 @@ DAV_DECLARE(dav_error*) dav_push_error(apr_pool_t *p, int status,
return err;
}
+DAV_DECLARE(dav_error*) dav_join_error(dav_error *dest, dav_error *src)
+{
+ dav_error *curr = dest;
+
+ /* src error doesn't exist so nothing to join just return dest */
+ if (src == NULL) {
+ return dest;
+ }
+
+ /* dest error doesn't exist so nothing to join just return src */
+ if (curr == NULL) {
+ return src;
+ }
+
+ /* find last error in dest stack */
+ while (curr->prev != NULL) {
+ curr = curr->prev;
+ }
+
+ /* add the src error onto end of dest stack and return it */
+ curr->prev = src;
+ return dest;
+}
+
DAV_DECLARE(void) dav_check_bufsize(apr_pool_t * p, dav_buffer *pbuf,
apr_size_t extra_needed)
{
@@ -635,9 +659,19 @@ static dav_error * dav_process_if_header(request_rec *r, dav_if_header **p_ih)
/* clean up the URI a bit */
ap_getparents(parsed_uri.path);
+
+ /* the resources we will compare to have unencoded paths */
+ if (ap_unescape_url(parsed_uri.path) != OK) {
+ return dav_new_error(r->pool, HTTP_BAD_REQUEST,
+ DAV_ERR_IF_TAGGED, rv,
+ "Invalid percent encoded URI in "
+ "tagged If-header.");
+ }
+
uri_len = strlen(parsed_uri.path);
- if (uri_len > 1 && parsed_uri.path[uri_len - 1] == '/')
+ if (uri_len > 1 && parsed_uri.path[uri_len - 1] == '/') {
parsed_uri.path[--uri_len] = '\0';
+ }
uri = parsed_uri.path;
list_type = tagged;