From 3ccd8db880083085e529d7f6f4e0c290cd61e515 Mon Sep 17 00:00:00 2001 From: Jim Jagielski Date: Thu, 4 Oct 2012 12:59:50 +0000 Subject: [PATCH] Merge r1392347 from trunk: core: ErrorDocument now works for requests without a Host header. PR: 48357 Submitted by: trawick Reviewed/backported by: jim git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/branches/2.4.x@1394035 13f79535-47bb-0310-9956-ffa450edef68 --- CHANGES | 3 +++ STATUS | 6 ------ server/protocol.c | 14 ++++---------- 3 files changed, 7 insertions(+), 16 deletions(-) diff --git a/CHANGES b/CHANGES index 2fc37ff322..b7ccb26555 100644 --- a/CHANGES +++ b/CHANGES @@ -2,6 +2,9 @@ Changes with Apache 2.4.4 + *) core: ErrorDocument now works for requests without a Host header. + PR 48357. [Jeff Trawick] + *) prefork: Avoid logging harmless errors during graceful stop. [Joe Orton, Jeff Trawick] diff --git a/STATUS b/STATUS index 92264abbee..d703283820 100644 --- a/STATUS +++ b/STATUS @@ -89,12 +89,6 @@ RELEASE SHOWSTOPPERS: PATCHES ACCEPTED TO BACKPORT FROM TRUNK: [ start all new proposals below, under PATCHES PROPOSED. ] - * core: ErrorDocument now works for requests without a Host header. - (PR 48357) - trunk patch: http://svn.apache.org/viewvc?view=revision&revision=1392347 - 2.4.x patch: trunk patch works (minus CHANGES) - +1: trawick, minfrin, jim - PATCHES PROPOSED TO BACKPORT FROM TRUNK: [ New proposals should be added at the end of the list ] diff --git a/server/protocol.c b/server/protocol.c index 30b3cd5eef..b0da156eec 100644 --- a/server/protocol.c +++ b/server/protocol.c @@ -918,7 +918,7 @@ request_rec *ap_read_request(conn_rec *conn) request_rec *r; apr_pool_t *p; const char *expect; - int access_status; + int access_status = HTTP_OK; apr_bucket_brigade *tmp_bb; apr_socket_t *csd; apr_interval_time_t cur_timeout; @@ -1086,7 +1086,7 @@ request_rec *ap_read_request(conn_rec *conn) * HTTP/1.1 mentions twice (S9, S14.23) that a request MUST contain * a Host: header, and the server MUST respond with 400 if it doesn't. */ - r->status = HTTP_BAD_REQUEST; + access_status = HTTP_BAD_REQUEST; ap_log_rerror(APLOG_MARK, APLOG_INFO, 0, r, APLOGNO(00569) "client sent HTTP/1.1 request without hostname " "(see RFC2616 section 14.23): %s", r->uri); @@ -1102,14 +1102,8 @@ request_rec *ap_read_request(conn_rec *conn) ap_add_input_filter_handle(ap_http_input_filter_handle, NULL, r, r->connection); - if (r->status != HTTP_OK) { - ap_send_error_response(r, 0); - ap_update_child_status(conn->sbh, SERVER_BUSY_LOG, r); - ap_run_log_transaction(r); - goto traceout; - } - - if ((access_status = ap_run_post_read_request(r))) { + if (access_status != HTTP_OK + || (access_status = ap_run_post_read_request(r))) { ap_die(access_status, r); ap_update_child_status(conn->sbh, SERVER_BUSY_LOG, r); ap_run_log_transaction(r); -- 2.50.1