summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRuediger Pluem <rpluem@apache.org>2023-01-04 14:37:23 +0000
committerRuediger Pluem <rpluem@apache.org>2023-01-04 14:37:23 +0000
commitd83beb522e6748dc32d4ae6afc9002466aabd62a (patch)
tree305bac770712baab7fd06ce55b037ec183c0bb9a
parentc3a4f9c3ed1e201fd421fd9d6f148c852112881c (diff)
downloadhttpd-d83beb522e6748dc32d4ae6afc9002466aabd62a.tar.gz
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
-rw-r--r--STATUS7
-rw-r--r--changes-entries/pr35981.txt3
-rw-r--r--modules/dav/main/mod_dav.c17
3 files changed, 14 insertions, 13 deletions
diff --git a/STATUS b/STATUS
index 7a772c47f4..39f3fa0a18 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 0000000000..9b0fe98088
--- /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 <basant.kukreja sun.com>, Alejandro Alvarez
+ <alejandro.alvarez.ayllon cern.ch>]
diff --git a/modules/dav/main/mod_dav.c b/modules/dav/main/mod_dav.c
index 76d9a51858..7795e1ea80 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) {