]> git.ipfire.org Git - thirdparty/apache/httpd.git/commitdiff
* Correctly return a 400 (Bad request) in case of a HTTP/0.9 request like
authorRuediger Pluem <rpluem@apache.org>
Tue, 25 Oct 2011 15:56:08 +0000 (15:56 +0000)
committerRuediger Pluem <rpluem@apache.org>
Tue, 25 Oct 2011 15:56:08 +0000 (15:56 +0000)
  GET @example.org/foo

git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1188745 13f79535-47bb-0310-9956-ffa450edef68

server/protocol.c

index 28aeafcdde2894f3ec49133d3bd452c18cc3f2dc..2d2bc05ca092c11b1f8c523503cc2c81a495cc46 100644 (file)
@@ -672,6 +672,7 @@ static int read_request_line(request_rec *r, apr_bucket_brigade *bb)
         r->hostname = NULL;
         r->status = HTTP_BAD_REQUEST;
         r->uri = apr_pstrdup(r->pool, uri);
+        return 0;
     }
 
     if (ll[0]) {
@@ -986,15 +987,15 @@ request_rec *ap_read_request(conn_rec *conn)
     if (!read_request_line(r, tmp_bb)) {
         if (r->status == HTTP_REQUEST_URI_TOO_LARGE
             || r->status == HTTP_BAD_REQUEST) {
-            if (r->status == HTTP_BAD_REQUEST) {
-                ap_log_rerror(APLOG_MARK, APLOG_INFO, 0, r,
-                              "request failed: invalid characters in URI");
-            }
-            else {
+            if (r->status == HTTP_REQUEST_URI_TOO_LARGE) {
                 ap_log_rerror(APLOG_MARK, APLOG_INFO, 0, r,
                               "request failed: URI too long (longer than %d)",
                               r->server->limit_req_line);
             }
+            else if (r->method == NULL) {
+                ap_log_rerror(APLOG_MARK, APLOG_INFO, 0, r,
+                              "request failed: invalid characters in URI");
+            }
             ap_send_error_response(r, 0);
             ap_update_child_status(conn->sbh, SERVER_BUSY_LOG, r);
             ap_run_log_transaction(r);