Commit cff3c2b0 authored by Ryan Bloom's avatar Ryan Bloom
Browse files

We have a poor abstraction in the protocol. This is a temporary

hack to fix the bug, but it will need to be fixed for real.  If
we find an error while sending out a custom error response, we back
up to the first non-OK request and send the data.  Then, when we send
the EOS from finalize_request_protocol, we go to the last request,
to ensure that we aren't sending an EOS to a request that has already
received one.  Because the data is sent on a different request than
the EOS, the error text never gets sent down the filter stack.  This
fixes the problem by finding the last request, and sending the data
with that request.
PR:	7165


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@88000 13f79535-47bb-0310-9956-ffa450edef68
parent 8530684e
Loading
Loading
Loading
Loading
+11 −0
Original line number Diff line number Diff line
Changes with Apache 2.0b1

  *) We have a poor abstraction in the protocol.  This is a temporary
     hack to fix the bug, but it will need to be fixed for real.  If
     we find an error while sending out a custom error response, we back
     up to the first non-OK request and send the data.  Then, when we send
     the EOS from finalize_request_protocol, we go to the last request,
     to ensure that we aren't sending an EOS to a request that has already
     received one.  Because the data is sent on a different request than
     the EOS, the error text never gets sent down the filter stack.  This
     fixes the problem by finding the last request, and sending the data
     with that request.  [Ryan Bloom]

  *) Make the server status page show the correct restart time, and
     thus the proper uptime. [Ryan Bloom]

+15 −5
Original line number Diff line number Diff line
@@ -3589,6 +3589,16 @@ AP_DECLARE(void) ap_send_error_response(request_rec *r, int recursive_error)
        const char *title = status_lines[idx];
        const char *h1;

        /* XXX This is a major hack that should be fixed cleanly.  The
         * problem is that we have the information we need in a previous
         * request, but the text of the page must be sent down the last
         * request_rec's filter stack.  rbb
         */
        request_rec *rlast = r;
        while (rlast->next) {
            rlast = rlast->next;
        }

        /* Accept a status_line set by a module, but only if it begins
         * with the 3 digit status code
         */
@@ -3605,22 +3615,22 @@ AP_DECLARE(void) ap_send_error_response(request_rec *r, int recursive_error)
        /* folks decided they didn't want the error code in the H1 text */
        h1 = &title[4];

        ap_rvputs(r,
        ap_rvputs(rlast,
                  DOCTYPE_HTML_2_0
                  "<HTML><HEAD>\n<TITLE>", title,
                  "</TITLE>\n</HEAD><BODY>\n<H1>", h1, "</H1>\n",
                  NULL);
        
        ap_rputs(get_canned_error_string(status, r, location),r); 
        ap_rputs(get_canned_error_string(status, r, location),rlast); 

        if (recursive_error) {
            ap_rvputs(r, "<P>Additionally, a ",
            ap_rvputs(rlast, "<P>Additionally, a ",
                      status_lines[ap_index_of_response(recursive_error)],
                      "\nerror was encountered while trying to use an "
                      "ErrorDocument to handle the request.\n", NULL);
        }
        ap_rputs(ap_psignature("<HR>\n", r), r);
        ap_rputs("</BODY></HTML>\n", r);
        ap_rputs(ap_psignature("<HR>\n", r), rlast);
        ap_rputs("</BODY></HTML>\n", rlast);
    }
    ap_finalize_request_protocol(r);
}