]> granicus.if.org Git - apache/commitdiff
Don't send a 500 if there is a timeout
authorStefan Fritsch <sf@apache.org>
Tue, 8 Nov 2011 20:36:03 +0000 (20:36 +0000)
committerStefan Fritsch <sf@apache.org>
Tue, 8 Nov 2011 20:36:03 +0000 (20:36 +0000)
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1199444 13f79535-47bb-0310-9956-ffa450edef68

modules/dav/main/mod_dav.c

index bc170bd9992d694f2a22d78860bc8c46acdcc1be..3de070195e8a401d4227e7c624b8d57a35cea1d8 100644 (file)
@@ -987,11 +987,20 @@ static int dav_method_put(request_rec *r)
                                 APR_BLOCK_READ, DAV_READ_BLOCKSIZE);
 
             if (rc != APR_SUCCESS) {
-                err = dav_new_error(r->pool, HTTP_INTERNAL_SERVER_ERROR, 0, rc,
-                                    apr_psprintf(r->pool,
-                                                 "Could not get next bucket "
-                                                 "brigade (URI: %s)",
-                                                 ap_escape_html(r->pool, r->uri)));
+                int http_err;
+                char *msg = ap_escape_html(r->pool, r->uri);
+                if (APR_STATUS_IS_TIMEUP(rc)) {
+                    http_err = HTTP_REQUEST_TIME_OUT;
+                    msg = apr_psprintf(r->pool, "Timeout reading the body "
+                                       "(URI: %s)", msg);
+                }
+                else {
+                    /* XXX: should this actually be HTTP_BAD_REQUEST? */
+                    http_err = HTTP_INTERNAL_SERVER_ERROR;
+                    msg = apr_psprintf(r->pool, "Could not get next bucket "
+                                       "brigade (URI: %s)", msg);
+                }
+                err = dav_new_error(r->pool, http_err, 0, rc, msg);
                 break;
             }