src/server/daemon/httprequest.c

changeset 138
06619bbd14ef
parent 136
9b48a1427aef
child 141
ff311b63c3af
--- a/src/server/daemon/httprequest.c	Tue Dec 27 19:50:20 2016 +0100
+++ b/src/server/daemon/httprequest.c	Wed Dec 28 12:23:51 2016 +0100
@@ -117,7 +117,7 @@
     } else {
         io = sysstream_new(pool, request->connection->fd);
     }
-     sn->sn.csd = httpstream_new(pool, io);
+    sn->sn.csd = httpstream_new(pool, io);
     
     
     sn->sn.client = pblock_create_pool(sn->sn.pool, 8);
@@ -299,6 +299,18 @@
     }
     rq->port = request->connection->listener->port;
     
+    if(rq->host) {
+        VirtualServer *vs = ucx_map_cstr_get(sn->config->host_vs, rq->host);
+        if(vs) {
+            rq->vs = vs;
+        } else {
+            log_ereport(
+                    LOG_VERBOSE,
+                    "Unkown host '%s': using default virtual server", 
+                    rq->host);
+        }
+    }
+    
     // parse connection header
     rq->rq.rq_attr.keep_alive = (rq->rq.protv_num >= PROTOCOL_VERSION_HTTP11);
     char *conn_str = pblock_findkeyval(pb_key_connection, rq->rq.headers);

mercurial