]> git.ipfire.org Git - thirdparty/apache/httpd.git/commitdiff
changing r->protocol to HTTP/2 for all directly handles requests, fixing handling...
authorStefan Eissing <icing@apache.org>
Mon, 14 Sep 2015 12:26:18 +0000 (12:26 +0000)
committerStefan Eissing <icing@apache.org>
Mon, 14 Sep 2015 12:26:18 +0000 (12:26 +0000)
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1702919 13f79535-47bb-0310-9956-ffa450edef68

modules/http2/h2_config.c
modules/http2/h2_ctx.c
modules/http2/h2_ctx.h
modules/http2/h2_switch.c
modules/http2/h2_task.c
modules/http2/h2_task_input.c

index 883f273a38fe6c14d48b395ed4c5faeafdd93dbb..a370bd620c3ec39b9e1d4951b975d7ca36d82cf6 100644 (file)
@@ -372,41 +372,11 @@ h2_config *h2_config_rget(request_rec *r)
 h2_config *h2_config_get(conn_rec *c)
 {
     h2_ctx *ctx = h2_ctx_get(c);
+    
     if (ctx->config) {
         return ctx->config;
     }
-    if (!ctx->server && ctx->hostname) {
-        /* We have a host agreed upon via TLS SNI, but no request yet.
-         * The sni host was accepted and therefore does match a server record
-         * (vhost) for it. But we need to know which one.
-         * Normally, it is enough to be set on the initial request on a
-         * connection, but we need it earlier. Simulate a request and call
-         * the vhost matching stuff.
-         */
-        apr_uri_t uri;
-        request_rec r;
-        memset(&uri, 0, sizeof(uri));
-        uri.scheme = (char*)"https";
-        uri.hostinfo = (char*)ctx->hostname;
-        uri.hostname = (char*)ctx->hostname;
-        uri.port_str = (char*)"";
-        uri.port = c->local_addr->port;
-        uri.path = (char*)"/";
-        
-        memset(&r, 0, sizeof(r));
-        r.uri = (char*)"/";
-        r.connection = c;
-        r.pool = c->pool;
-        r.hostname = ctx->hostname;
-        r.headers_in = apr_table_make(c->pool, 1);
-        r.parsed_uri = uri;
-        r.status = HTTP_OK;
-        r.server = r.connection->base_server;
-        ap_update_vhost_from_headers(&r);
-        ctx->server = r.server;
-    }
-    
-    if (ctx->server) {
+    else if (ctx->server) {
         ctx->config = h2_config_sget(ctx->server);
         return ctx->config;
     }
index 0e198456f230c597a336a5b75d13a4c61e18ba7a..f37a1474a1e7f1cd2af381a2bc346bdb79d75fe6 100644 (file)
@@ -68,6 +68,12 @@ h2_ctx *h2_ctx_protocol_set(h2_ctx *ctx, const char *proto)
     return ctx;
 }
 
+h2_ctx *h2_ctx_server_set(h2_ctx *ctx, server_rec *s)
+{
+    ctx->server = s;
+    return ctx;
+}
+
 int h2_ctx_is_task(h2_ctx *ctx)
 {
     return ctx && !!ctx->task_env;
index f9bc8278296769b996f002e4fab32722ac98ad76..86c59206eda4f6c14374e70473f221c437330df3 100644 (file)
@@ -46,6 +46,10 @@ h2_ctx *h2_ctx_create_for(const conn_rec *c, struct h2_task_env *env);
  */
 h2_ctx *h2_ctx_protocol_set(h2_ctx *ctx, const char *proto);
 
+/* Set the server_rec relevant for this context.
+ */
+h2_ctx *h2_ctx_server_set(h2_ctx *ctx, server_rec *s);
+
 /**
  * Get the h2 protocol negotiated for this connection, or NULL.
  */
index 4cdc4118b0a114546e663055f572cd98f418fd71..23c34490eaa27c4414ee30a9e3111c30df9f9f55 100644 (file)
@@ -141,6 +141,7 @@ static int h2_protocol_switch(conn_rec *c, request_rec *r, server_rec *s,
         ap_log_cerror(APLOG_MARK, APLOG_TRACE1, 0, c,
                       "switching protocol to '%s'", protocol);
         h2_ctx_protocol_set(ctx, protocol);
+        h2_ctx_server_set(ctx, s);
         
         if (r != NULL) {
             apr_status_t status;
index 26b8c6e40e84ac5e80a410a7a99d912c8789f74a..bbea7b20f8aa1ae48309e38cd9a04368b5d703ea 100644 (file)
@@ -220,7 +220,7 @@ apr_status_t h2_task_do(h2_task *task, h2_worker *worker)
     task->mplx = NULL;
     
     env.input_eos = task->input_eos;
-    env.serialize_headers = !!h2_config_geti(cfg, H2_CONF_SER_HEADERS);
+    env.serialize_headers = h2_config_geti(cfg, H2_CONF_SER_HEADERS);
     
     /* Create a subpool from the worker one to be used for all things
      * with life-time of this task_env execution.
@@ -389,8 +389,8 @@ static request_rec *h2_task_create_request(h2_task_env *env)
     }
 
     ap_parse_uri(r, env->path);
-    r->protocol = (char*)"HTTP/1.1";
-    r->proto_num = HTTP_VERSION(1, 1);
+    r->protocol = (char*)"HTTP/2";
+    r->proto_num = HTTP_VERSION(2, 0);
     
     /* update what we think the virtual host is based on the headers we've
      * now read. may update status.
index cc7d8503fd56475007b1d770e0b844f18d551d9c..487f7e606920c26fce185bbdf2b357f52f885c5d 100644 (file)
@@ -51,6 +51,9 @@ h2_task_input *h2_task_input_create(h2_task_env *env, apr_pool_t *pool,
         input->bb = NULL;
         
         if (env->serialize_headers) {
+            ap_log_cerror(APLOG_MARK, APLOG_TRACE1, 0, &env->c,
+                          "h2_task_input(%s): serialize request %s %s", 
+                          env->id, env->method, env->path);
             input->bb = apr_brigade_create(pool, bucket_alloc);
             apr_brigade_printf(input->bb, NULL, NULL, "%s %s HTTP/1.1\r\n", 
                                env->method, env->path);