From: Ruediger Pluem Date: Wed, 4 Jan 2023 14:37:23 +0000 (+0000) Subject: Merge r1477687 from trunk: X-Git-Tag: 2.4.55-rc1-candidate~29 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=d83beb522e6748dc32d4ae6afc9002466aabd62a;p=thirdparty%2Fapache%2Fhttpd.git Merge r1477687 from trunk: mod_dav: mod_dav overrides dav_fs response on PUT failure. PR 35981. PR: 35981 Reviewed by: rpluem, covener, jorton, gbechis git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/branches/2.4.x@1906393 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/STATUS b/STATUS index 7a772c47f41..39f3fa0a18c 100644 --- a/STATUS +++ b/STATUS @@ -201,13 +201,6 @@ PATCHES ACCEPTED TO BACKPORT FROM TRUNK: 2.4.x patch: svn merge -c 1906051 ^/httpd/httpd/trunk . +1: icing, covener, gbechis - *) mod_dav: mod_dav overrides dav_fs response on PUT failure. PR 35981 - Trunk version of patch: - https://svn.apache.org/r1477687 - Backport version for 2.4.x of patch: - Trunk version of patch works (only CHANGES conflicts) - svn merge -c 1477687 ^/httpd/httpd/trunk . - +1: rpluem, covener, jorton, gbechis PATCHES PROPOSED TO BACKPORT FROM TRUNK: [ New proposals should be added at the end of the list ] diff --git a/changes-entries/pr35981.txt b/changes-entries/pr35981.txt new file mode 100644 index 00000000000..9b0fe98088d --- /dev/null +++ b/changes-entries/pr35981.txt @@ -0,0 +1,3 @@ + *) mod_dav: mod_dav overrides dav_fs response on PUT failure. PR 35981 + [Basant Kumar Kukreja , Alejandro Alvarez + ] diff --git a/modules/dav/main/mod_dav.c b/modules/dav/main/mod_dav.c index 76d9a518585..7795e1ea803 100644 --- a/modules/dav/main/mod_dav.c +++ b/modules/dav/main/mod_dav.c @@ -1020,12 +1020,17 @@ static int dav_method_put(request_rec *r) /* Create the new file in the repository */ if ((err = (*resource->hooks->open_stream)(resource, mode, &stream)) != NULL) { - /* ### assuming FORBIDDEN is probably not quite right... */ - err = dav_push_error(r->pool, HTTP_FORBIDDEN, 0, - apr_psprintf(r->pool, - "Unable to PUT new contents for %s.", - ap_escape_html(r->pool, r->uri)), - err); + int status = err->status ? err->status : HTTP_FORBIDDEN; + if (status > 299) { + err = dav_push_error(r->pool, status, 0, + apr_psprintf(r->pool, + "Unable to PUT new contents for %s.", + ap_escape_html(r->pool, r->uri)), + err); + } + else { + err = NULL; + } } if (err == NULL && has_range) {