Commit 3c4dd149 authored by Jim Jagielski's avatar Jim Jagielski
Browse files

Merge r729586, r732504 from trunk:

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
parent 44d9d009
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
                                                         -*- 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]

+0 −7
Original line number Diff line number Diff line
@@ -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 ]
+2 −2
Original line number Diff line number Diff line
@@ -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");
+9 −2
Original line number Diff line number Diff line
@@ -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;