]> granicus.if.org Git - apache/commitdiff
mod_http2: allowing requests without :authority header
authorStefan Eissing <icing@apache.org>
Mon, 14 Mar 2016 10:48:54 +0000 (10:48 +0000)
committerStefan Eissing <icing@apache.org>
Mon, 14 Mar 2016 10:48:54 +0000 (10:48 +0000)
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1734910 13f79535-47bb-0310-9956-ffa450edef68

CHANGES
modules/http2/h2_request.c
modules/http2/h2_util.c

diff --git a/CHANGES b/CHANGES
index b3e2f2b403d05fb20ae0df44b8dc7c9b6719d971..16cd6ab2cf4862227418bf61f2e10db3f2d5aba1 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -1,6 +1,9 @@
                                                          -*- coding: utf-8 -*-
 Changes with Apache 2.5.0
 
+  *) mod_http2: fixes incorrect denial of requests without :authority header.
+     [Stefan Eissing]
+     
   *) mod_include: Add variable DOCUMENT_ARGS, with the arguments to the
      request for the SSI document.  [Jeff Trawick]
 
index 2e358cdb14bf2f5466963f13a2b0652b9a5938df..923b62554f9d155f5bf13ab71639663403e3f4f4 100644 (file)
@@ -238,11 +238,20 @@ apr_status_t h2_request_end_headers(h2_request *req, apr_pool_t *pool,
         return APR_EINVAL;
     }
 
-    /* Always set the "Host" header from :authority, see rfc7540, ch. 8.1.2.3 */
+    /* rfc7540, ch. 8.1.2.3:
+     * - if we have :authority, it overrides any Host header 
+     * - :authority MUST be ommited when converting h1->h2, so we
+     *   might get a stream without, but then Host needs to be there */
     if (!req->authority) {
-        return APR_BADARG;
+        const char *host = apr_table_get(req->headers, "Host");
+        if (!host) {
+            return APR_BADARG;
+        }
+        req->authority = host;
+    }
+    else {
+        apr_table_setn(req->headers, "Host", req->authority);
     }
-    apr_table_setn(req->headers, "Host", req->authority);
 
     s = apr_table_get(req->headers, "Content-Length");
     if (s) {
index 71a3ff90a698859fd204b0eb74e3cdf80f5673a4..904349658c32fa8e9bb20ea910a3d52f02465d0c 100644 (file)
@@ -1070,7 +1070,6 @@ typedef struct {
 #define H2_LIT_ARGS(a)      (a),H2_ALEN(a)
 
 static literal IgnoredRequestHeaders[] = {
-    H2_DEF_LITERAL("host"),
     H2_DEF_LITERAL("expect"),
     H2_DEF_LITERAL("upgrade"),
     H2_DEF_LITERAL("connection"),