From 6e034c90788b18e8567eb35a121e2755fd9547b0 Mon Sep 17 00:00:00 2001 From: Ryan Bloom Date: Tue, 6 Feb 2001 22:49:46 +0000 Subject: [PATCH] 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 --- CHANGES | 11 +++++++++++ modules/http/http_protocol.c | 20 +++++++++++++++----- 2 files changed, 26 insertions(+), 5 deletions(-) diff --git a/CHANGES b/CHANGES index 723a002aca..7ceef106ff 100644 --- a/CHANGES +++ b/CHANGES @@ -1,5 +1,16 @@ 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] diff --git a/modules/http/http_protocol.c b/modules/http/http_protocol.c index 9cfdb56fae..668be6bced 100644 --- a/modules/http/http_protocol.c +++ b/modules/http/http_protocol.c @@ -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 "\n", title, "\n\n

", 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, "

Additionally, a ", + ap_rvputs(rlast, "

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("


\n", r), r); - ap_rputs("\n", r); + ap_rputs(ap_psignature("
\n", r), rlast); + ap_rputs("\n", rlast); } ap_finalize_request_protocol(r); } -- 2.40.0