--- a/src/server/daemon/httprequest.c Fri Oct 28 19:29:38 2016 +0200 +++ b/src/server/daemon/httprequest.c Sat Oct 29 20:02:26 2016 +0200 @@ -28,6 +28,7 @@ #include <stdio.h> #include <stdlib.h> +#include <limits.h> #include <arpa/inet.h> @@ -277,6 +278,20 @@ rq->rq.headers); } + // get host and port + char *hosthdr = pblock_findkeyval(pb_key_host, rq->rq.headers); + if(hosthdr) { + char *host = pool_strdup(pool, hosthdr); + char *portstr = strchr(host, ':'); + if(portstr) { + *portstr = '\0'; + } + rq->host = host; + } else { + rq->host = NULL; // TODO: value from listener + } + rq->port = request->connection->listener->port; + // 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);