]> git.ipfire.org Git - thirdparty/apache/httpd.git/commitdiff
Merge r729586, r732504 from trunk:
authorJim Jagielski <jim@apache.org>
Mon, 12 Jan 2009 13:59:56 +0000 (13:59 +0000)
committerJim Jagielski <jim@apache.org>
Mon, 12 Jan 2009 13:59:56 +0000 (13:59 +0000)
CGI: return 504 (Gateway timeout) rather than 500 when a script
times out before returning status line/headers.
PR 42190

Improve canned 504 error message in the light of r729586 and covener's comment.

Submitted by: niq
Reviewed/backported by: jim

git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/branches/2.2.x@733757 13f79535-47bb-0310-9956-ffa450edef68

CHANGES
STATUS
modules/http/http_protocol.c
server/util_script.c

diff --git a/CHANGES b/CHANGES
index 5d9f559041d3bb201b439a7cd60dee01036284a4..199f3e72b8f419e01e555a43b3c778711719d11c 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -1,6 +1,10 @@
                                                          -*- coding: utf-8 -*-
 Changes with Apache 2.2.12
 
+  *) CGI: return 504 (Gateway timeout) rather than 500 when a script
+     times out before returning status line/headers.
+     PR 42190 [Nick Kew]
+
   *) prefork: Log an error instead of segfaulting when child startup fails
      due to pollset creation failures.  PR 46467.  [Jeff Trawick]
 
diff --git a/STATUS b/STATUS
index 6b4ba0e10e04e9a85500fab2caa32e263cf0595e..302bf1b9d38b170e14ac093d0783e193c94ffeba 100644 (file)
--- a/STATUS
+++ b/STATUS
@@ -114,13 +114,6 @@ PATCHES ACCEPTED TO BACKPORT FROM TRUNK:
         trunk works
     +1 covener, niq, rpluem
 
-  * util_script (CGI): return 504 (Gateway timeout) rather than 500
-    when a script times out before returning status line/headers.
-    PR 42190
-    http://svn.apache.org/viewvc?view=rev&revision=729586
-    http://svn.apache.org/viewvc?view=rev&revision=732504
-    +1: niq, rpluem, jim
-
 
 PATCHES PROPOSED TO BACKPORT FROM TRUNK:
   [ New proposals should be added at the end of the list ]
index 10e6514b6176ce792d388fd9b947a6c7f0746410..046e98bc579dffb890a6fe8e6e4890b80ab1c827 100644 (file)
@@ -1044,8 +1044,8 @@ static const char *get_canned_error_string(int status,
                "request due to maintenance downtime or capacity\n"
                "problems. Please try again later.</p>\n");
     case HTTP_GATEWAY_TIME_OUT:
-        return("<p>The proxy server did not receive a timely response\n"
-               "from the upstream server.</p>\n");
+        return("<p>The gateway did not receive a timely response\n"
+               "from the upstream server or application.</p>\n");
     case HTTP_NOT_EXTENDED:
         return("<p>A mandatory extension policy in the request is not\n"
                "accepted by the server for this resource.</p>\n");
index 09c8dd414d7b37f50ecdc6483e6e0857dc62f4d2..6d6f3f4a6302e43d39bebaa1ac24390f79f01f24 100644 (file)
@@ -430,12 +430,19 @@ AP_DECLARE(int) ap_scan_script_header_err_core(request_rec *r, char *buffer,
 
     while (1) {
 
-        if ((*getsfunc) (w, MAX_STRING_LEN - 1, getsfunc_data) == 0) {
+        int rv = (*getsfunc) (w, MAX_STRING_LEN - 1, getsfunc_data);
+        if (rv == 0) {
             ap_log_rerror(APLOG_MARK, APLOG_ERR|APLOG_TOCLIENT, 0, r,
                           "Premature end of script headers: %s",
                           apr_filepath_name_get(r->filename));
             return HTTP_INTERNAL_SERVER_ERROR;
         }
+        else if (rv == -1) {
+            ap_log_rerror(APLOG_MARK, APLOG_ERR|APLOG_TOCLIENT, 0, r,
+                          "Script timed out before returning headers: %s",
+                          apr_filepath_name_get(r->filename));
+            return HTTP_GATEWAY_TIME_OUT;
+        }
 
         /* Delete terminal (CR?)LF */
 
@@ -629,7 +636,7 @@ static int getsfunc_BRIGADE(char *buf, int len, void *arg)
         rv = apr_bucket_read(e, &bucket_data, &bucket_data_len,
                              APR_BLOCK_READ);
         if (rv != APR_SUCCESS || (bucket_data_len == 0)) {
-            return 0;
+            return APR_STATUS_IS_TIMEUP(rv) ? -1 : 0;
         }
         src = bucket_data;
         src_end = bucket_data + bucket_data_len;