]> granicus.if.org Git - apache/commitdiff
We have a poor abstraction in the protocol. This is a temporary
authorRyan Bloom <rbb@apache.org>
Tue, 6 Feb 2001 22:49:46 +0000 (22:49 +0000)
committerRyan Bloom <rbb@apache.org>
Tue, 6 Feb 2001 22:49:46 +0000 (22:49 +0000)
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
modules/http/http_protocol.c

diff --git a/CHANGES b/CHANGES
index 723a002acaba7430479951e95cda7d51c255c36a..7ceef106ff1a0a028be184eb6ee37af4ea24edc3 100644 (file)
--- 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]
 
index 9cfdb56fae9ff77ffe94d563f516d56842569f62..668be6bced7537de6ce67d16e650a7ffd56bf575 100644 (file)
@@ -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);
 }