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
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 ]
--- /dev/null
+ *) 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>]
/* 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) {