From ac07e050c6a7214678ef92e12e8481bdb82a9a13 Mon Sep 17 00:00:00 2001 From: "William A. Rowe Jr" Date: Fri, 26 Aug 2016 20:41:55 +0000 Subject: [PATCH] Correct URL failure reporting. Drop the second reporting of HEAD over HTTP/0.9 requests, we short-circuit this early now in read_request_line() when presented anything other than the sole "GET" method permitted by spec. git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1757921 13f79535-47bb-0310-9956-ffa450edef68 --- server/protocol.c | 26 ++++---------------------- 1 file changed, 4 insertions(+), 22 deletions(-) diff --git a/server/protocol.c b/server/protocol.c index 0126ff40c0..97220be72c 100644 --- a/server/protocol.c +++ b/server/protocol.c @@ -828,7 +828,7 @@ rrl_done: else if (deferred_error == rrl_baduri) ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r, APLOGNO(03454) "HTTP Request Line; URI incorrectly encoded: '%.*s'", - field_name_len(r->method), r->method); + field_name_len(r->uri), r->uri); else if (deferred_error == rrl_badwhitespace) ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r, APLOGNO(03447) "HTTP Request Line; Invalid whitespace"); @@ -865,8 +865,9 @@ rrl_done: } if (r->status != HTTP_OK) { - ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r, APLOGNO(03450) - "HTTP Request Line; URI parsing failed"); + ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r, APLOGNO(03454) + "HTTP Request Line; Unable to parse URI: '%.*s'", + field_name_len(r->uri), r->uri); goto rrl_failed; } @@ -1378,25 +1379,6 @@ request_rec *ap_read_request(conn_rec *conn) apr_table_unset(r->headers_in, "Content-Length"); } } - else { - if (r->header_only) { - /* - * 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 - * comes through... - */ - ap_log_rerror(APLOG_MARK, APLOG_INFO, 0, r, APLOGNO(00568) - "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); - ap_update_child_status(conn->sbh, SERVER_BUSY_LOG, r); - ap_run_log_transaction(r); - apr_brigade_destroy(tmp_bb); - goto traceout; - } - } apr_brigade_destroy(tmp_bb); -- 2.40.0