]> git.ipfire.org Git - thirdparty/apache/httpd.git/commitdiff
Merge r1477687 from trunk:
authorRuediger Pluem <rpluem@apache.org>
Wed, 4 Jan 2023 14:37:23 +0000 (14:37 +0000)
committerRuediger Pluem <rpluem@apache.org>
Wed, 4 Jan 2023 14:37:23 +0000 (14:37 +0000)
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

STATUS
changes-entries/pr35981.txt [new file with mode: 0644]
modules/dav/main/mod_dav.c

diff --git a/STATUS b/STATUS
index 7a772c47f414402e972baa082383ef097f343089..39f3fa0a18c68e67ca3654decb0f6bc7203729b9 100644 (file)
--- 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 (file)
index 0000000..9b0fe98
--- /dev/null
@@ -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>]
index 76d9a51858522f7828465c50f667aa32ea97c40c..7795e1ea80340d9146bf0262da39ecd480e71055 100644 (file)
@@ -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) {