From 57bf1d19fbfa12ce6e329f3c0cb9bbb6bc6fbf64 Mon Sep 17 00:00:00 2001 From: Jeff Trawick Date: Sat, 18 Oct 2003 14:15:58 +0000 Subject: [PATCH] If a request fails and the client will be redirected to another URL due to ErrorDocument, see if we need to drop the connection after sending the 302 response. This fixes a problem where Apache treated the body of the failed request as the next request on a keepalive connection. The subsequent 501 error sent to the browser prevented some browsers from fetching the error document. Reviewed by: roy, jim git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/branches/1.3.x@101486 13f79535-47bb-0310-9956-ffa450edef68 --- STATUS | 7 +------ src/CHANGES | 7 +++++++ src/main/http_request.c | 8 ++++++++ 3 files changed, 16 insertions(+), 6 deletions(-) diff --git a/STATUS b/STATUS index 413121844d0..e391210466b 100644 --- a/STATUS +++ b/STATUS @@ -1,5 +1,5 @@ APACHE 1.3 STATUS: -*-text-*- - Last modified at [$Date: 2003/10/18 12:55:12 $] + Last modified at [$Date: 2003/10/18 14:15:58 $] Release: @@ -58,11 +58,6 @@ RELEASE SHOWSTOPPERS: Message-Id: <3F8C56E3.8050501@attglobal.net> +1: jeff, jim - * ap_die() should see if it needs to drop the connection before - replacing r->status with 302 - Message-ID: <3F904295.6060701@attglobal.net> - +1: jeff, roy, jim - * fix wording of warning for ErrorDocument 401 full-URL Message-ID: <3F8BE7D2.6060209@attglobal.net> +1: jeff, jim diff --git a/src/CHANGES b/src/CHANGES index 84676f49682..fcae7ac590a 100644 --- a/src/CHANGES +++ b/src/CHANGES @@ -1,5 +1,12 @@ Changes with Apache 1.3.29 + *) If a request fails and the client will be redirected to another URL + due to ErrorDocument, see if we need to drop the connection after + sending the 302 response. This fixes a problem where Apache treated + the body of the failed request as the next request on a keepalive + connection. The subsequent 501 error sent to the browser prevented + some browsers from fetching the error document. [Jeff Trawick] + *) Fixed mod_usertrack to not get false positive matches on the user-tracking cookie's name. PR 16661. [Manni Wood ] diff --git a/src/main/http_request.c b/src/main/http_request.c index 4858c0d5fb2..d1d8803ee90 100644 --- a/src/main/http_request.c +++ b/src/main/http_request.c @@ -1117,7 +1117,15 @@ API_EXPORT(void) ap_die(int type, request_rec *r) * 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); } -- 2.47.2