diff options
author | Stefan Fritsch <sf@sfritsch.de> | 2015-08-02 00:19:16 +0200 |
---|---|---|
committer | Stefan Fritsch <sf@sfritsch.de> | 2015-08-02 00:19:16 +0200 |
commit | 48802c25dc82a8b13ac351c0c2137ef748256bbd (patch) | |
tree | dcaa03f7f34153303fe5afbc9c99dbb8c44b22b3 /modules/dav | |
parent | 080d5e16db802902200a9ce5b6c40f8f1fdc1f73 (diff) | |
download | apache2-48802c25dc82a8b13ac351c0c2137ef748256bbd.tar.gz |
Imported Upstream version 2.4.16
Diffstat (limited to 'modules/dav')
-rw-r--r-- | modules/dav/fs/repos.c | 2 | ||||
-rw-r--r-- | modules/dav/main/mod_dav.c | 13 | ||||
-rw-r--r-- | modules/dav/main/util.c | 6 | ||||
-rw-r--r-- | modules/dav/main/util_lock.c | 14 |
4 files changed, 26 insertions, 9 deletions
diff --git a/modules/dav/fs/repos.c b/modules/dav/fs/repos.c index 950646ee..6a5ff765 100644 --- a/modules/dav/fs/repos.c +++ b/modules/dav/fs/repos.c @@ -1105,7 +1105,7 @@ static dav_error * dav_fs_deliver(const dav_resource *resource, APR_BRIGADE_INSERT_TAIL(bb, bkt); if ((status = ap_pass_brigade(output, bb)) != APR_SUCCESS) { - return dav_new_error(pool, HTTP_FORBIDDEN, 0, status, + return dav_new_error(pool, AP_FILTER_ERROR, 0, status, "Could not write contents to filter."); } diff --git a/modules/dav/main/mod_dav.c b/modules/dav/main/mod_dav.c index 2af117d2..2319549a 100644 --- a/modules/dav/main/mod_dav.c +++ b/modules/dav/main/mod_dav.c @@ -582,6 +582,11 @@ static int dav_handle_err(request_rec *r, dav_error *err, /* log the errors */ dav_log_err(r, err, APLOG_ERR); + if (!ap_is_HTTP_VALID_RESPONSE(err->status)) { + /* we have responded already */ + return AP_FILTER_ERROR; + } + if (response == NULL) { dav_error *stackerr = err; @@ -1001,10 +1006,10 @@ static int dav_method_put(request_rec *r) "(URI: %s)", msg); } else { - /* XXX: should this actually be HTTP_BAD_REQUEST? */ - http_err = HTTP_INTERNAL_SERVER_ERROR; - msg = apr_psprintf(r->pool, "An error occurred while reading" - " the request body (URI: %s)", msg); + http_err = ap_map_http_request_error(rc, HTTP_BAD_REQUEST); + msg = apr_psprintf(r->pool, + "An error occurred while reading" + " the request body (URI: %s)", msg); } err = dav_new_error(r->pool, http_err, 0, rc, msg); break; diff --git a/modules/dav/main/util.c b/modules/dav/main/util.c index e6207fde..3d4b1ec3 100644 --- a/modules/dav/main/util.c +++ b/modules/dav/main/util.c @@ -1595,8 +1595,10 @@ DAV_DECLARE(dav_error *) dav_validate_request(request_rec *r, } } - /* (1) Validate the specified resource, at the specified depth */ - if (resource->exists && depth > 0) { + /* (1) Validate the specified resource, at the specified depth. + * Avoid the walk there is no if_header and we aren't planning + * to modify this resource. */ + if (resource->exists && depth > 0 && !(!if_header && flags & DAV_VALIDATE_NO_MODIFY)) { dav_walker_ctx ctx = { { 0 } }; dav_response *multi_status; diff --git a/modules/dav/main/util_lock.c b/modules/dav/main/util_lock.c index 6ff70efb..1b3a6479 100644 --- a/modules/dav/main/util_lock.c +++ b/modules/dav/main/util_lock.c @@ -133,8 +133,18 @@ DAV_DECLARE(const char *) dav_lock_get_activelock(request_rec *r, } else { time_t now = time(NULL); - apr_snprintf(tmp, sizeof(tmp), "Second-%lu", (long unsigned int)(lock->timeout - now)); - dav_buffer_append(p, pbuf, tmp); + + /* + ** Check if the timeout is not, for any reason, already elapsed. + ** (e.g., because of a large collection, or disk under heavy load...) + */ + if (now >= lock->timeout) { + dav_buffer_append(p, pbuf, "Second-0"); + } + else { + apr_snprintf(tmp, sizeof(tmp), "Second-%lu", (long unsigned int)(lock->timeout - now)); + dav_buffer_append(p, pbuf, tmp); + } } dav_buffer_append(p, pbuf, |