httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jeff Trawick <traw...@attglobal.net>
Subject [1.3 PATCH] another ap_die() issue related to error documents
Date Fri, 17 Oct 2003 19:27:17 GMT
For "ErrorDocument nnn http://url", ap_die() will respond with 302 redirect, 
and r->status will be updated to indicate that.  But the original error could 
have been one that keeps us from being able to process subsequent requests on 
the connection.  Setting r->status to REDIRECT keeps us from dropping the 
connection later, since it hides the nature of the original problem.

Example:

client uses HTTP/1.1 to POST a 2MB file, to be handled by a module...
module says no way and returns 413...
admin has "ErrorDocument 413 http://file_too_big.html"...
Apache sends back 302 with Location=http://file_too_big.html, but since this is 
HTTP/1.1, Apache then tries to read the next request and blows up (invalid 
method in request)...

Depending on browser, you may get something odd.  Mozilla still is able to 
display the error document after fetching it with GET. IE in HTTP/1.1 mode 
displays a "Method Not Implemented" error message with "Invalid method in 
request" and the first part of the POST body as the method.

(I don't have standalone patch...  this is an addition to a patch posted earlier)

@@ -1117,7 +1120,15 @@
               * apache code, and continue with the usual REDIRECT handler.
               * But note that the client will ultimately see the wrong
               * status...
+             *
+             * Also, before updating r->status, we may need to ensure that
+             * the connection is dropped.  For example, there may be
+             * unread request body that would confuse us if we try
+             * to read another request.
               */
+            if (ap_status_drops_connection(r->status)) {
+                r->connection->keepalive = -1;
+            }
              r->status = REDIRECT;
              ap_table_setn(r->headers_out, "Location", custom_response);
          }


Mime
View raw message