Return-Path: Delivered-To: apmail-new-httpd-archive@apache.org Received: (qmail 96979 invoked by uid 500); 27 Mar 2001 17:11:35 -0000 Mailing-List: contact new-httpd-help@apache.org; run by ezmlm Precedence: bulk Reply-To: new-httpd@apache.org list-help: list-unsubscribe: list-post: Delivered-To: mailing list new-httpd@apache.org Received: (qmail 96963 invoked from network); 27 Mar 2001 17:11:34 -0000 Message-ID: <3AC0C9F3.1AF33D97@Golux.Com> Date: Tue, 27 Mar 2001 12:12:19 -0500 From: Rodent of Unusual Size Organization: The Apache Software Foundation X-Mailer: Mozilla 4.76 [en] (WinNT; U) X-Accept-Language: en MIME-Version: 1.0 To: new-httpd@apache.org Subject: [PATCH] Allow ErrorDocument even on HTTP syntax errors (was: Re: Bug (?) in 1.3) References: <3ABA2061.B2069B4E@Golux.Com> <3ABF2B2D.34844ECF@Golux.Com> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Spam-Rating: h31.sny.collab.net 1.6.2 0/1000/N Here is a patch that will fix this, without breaking anything else as far as I can tell. ErrorDocument 400 will be honoured regardless of the cause of the HTTP_BAD_REQUEST condition. For 1.3.next consideration. Index: src/main/http_protocol.c =================================================================== RCS file: /home/cvs/apache-1.3/src/main/http_protocol.c,v retrieving revision 1.300 diff -u -r1.300 http_protocol.c --- src/main/http_protocol.c 2001/03/09 10:10:26 1.300 +++ src/main/http_protocol.c 2001/03/27 17:07:57 @@ -1119,12 +1119,14 @@ ap_keepalive_timeout("read request line", r); if (!read_request_line(r)) { + int rstatus; + rstatus = r->status; ap_kill_timeout(r); - if (r->status == HTTP_REQUEST_URI_TOO_LARGE) { - + if (rstatus == HTTP_REQUEST_URI_TOO_LARGE) { ap_log_rerror(APLOG_MARK, APLOG_NOERRNO|APLOG_ERR, r, "request failed: URI too long"); - ap_send_error_response(r, 0); + r->status = HTTP_OK; + ap_die(rstatus, r); ap_log_transaction(r); return r; } @@ -1135,9 +1137,12 @@ get_mime_headers(r); ap_kill_timeout(r); if (r->status != HTTP_REQUEST_TIME_OUT) { + int rstatus; ap_log_rerror(APLOG_MARK, APLOG_NOERRNO|APLOG_ERR, r, "request failed: error reading the headers"); - ap_send_error_response(r, 0); + rstatus = r->status; + r->status = HTTP_OK; + ap_die(rstatus, r); ap_log_transaction(r); return r; } @@ -1146,6 +1151,7 @@ ap_kill_timeout(r); if (r->header_only) { + int rstatus; /* * Client asked for headers only with HTTP/0.9, which doesn't send * headers! Have to dink things just to make sure the error message @@ -1155,8 +1161,9 @@ "client sent invalid HTTP/0.9 request: HEAD %s", r->uri); r->header_only = 0; - r->status = HTTP_BAD_REQUEST; - ap_send_error_response(r, 0); + rstatus = r->status; + r->status = HTTP_OK; + ap_die(rstatus, r); ap_log_transaction(r); return r; } @@ -1190,7 +1197,10 @@ "(see RFC2616 section 14.23): %s", r->uri); } if (r->status != HTTP_OK) { - ap_send_error_response(r, 0); + int rstatus; + rstatus = r->status; + r->status = HTTP_OK; + ap_die(rstatus, r); ap_log_transaction(r); return r; } @@ -1213,12 +1223,13 @@ r->expecting_100 = 1; } else { - r->status = HTTP_EXPECTATION_FAILED; + int rstatus; + rstatus = HTTP_EXPECTATION_FAILED; ap_log_rerror(APLOG_MARK, APLOG_NOERRNO|APLOG_INFO, r, "client sent an unrecognized expectation value of " "Expect: %s", expect); - ap_send_error_response(r, 0); - (void) ap_discard_request_body(r); + r->status = HTTP_OK; + ap_die(rstatus, r); ap_log_transaction(r); return r; } -- #ken P-)} Ken Coar Apache Software Foundation "Apache Server for Dummies" "Apache Server Unleashed" ApacheCon 2001! Four tracks with over 70+ sessions. Free admission to exhibits and special events - keynote presentations by John 'maddog' Hall and David Brin. Special thanks to our Platinum Sponsors IBM and Covalent, Gold Sponsor Thawte, and Silver Sponsor Compaq. Attend the only Apache event designed and fully supported by the members of the ASF. See more information and register at !