From a0f456c3c650c7d5066a64b05a73011ddc12c23a Mon Sep 17 00:00:00 2001 From: Reyk Floeter Date: Thu, 5 Feb 2015 09:41:29 +0100 Subject: Fixing log locations --- httpd.h | 1 + parse.y | 5 ++++- server_http.c | 6 +++--- 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/httpd.h b/httpd.h index e1fc20e..fbf125a 100644 --- a/httpd.h +++ b/httpd.h @@ -381,6 +381,7 @@ TAILQ_HEAD(serverauth, auth); struct server_config { u_int32_t id; + u_int32_t parent_id; char name[HOST_NAME_MAX+1]; char location[NAME_MAX]; char index[NAME_MAX]; diff --git a/parse.y b/parse.y index d613efd..7be13b1 100644 --- a/parse.y +++ b/parse.y @@ -229,6 +229,7 @@ server : SERVER STRING { strlcpy(s->srv_conf.errorlog, HTTPD_ERROR_LOG, sizeof(s->srv_conf.errorlog)); s->srv_conf.id = ++last_server_id; + s->srv_conf.parent_id = s->srv_conf.id; s->srv_s = -1; s->srv_conf.timeout.tv_sec = SERVER_TIMEOUT; s->srv_conf.maxrequests = SERVER_MAXREQUESTS; @@ -479,8 +480,9 @@ serveroptsl : LISTEN ON STRING opttls port { YYERROR; } + s->srv_conf.id = ++last_server_id; /* A location entry uses the parent id */ - s->srv_conf.id = srv->srv_conf.id; + s->srv_conf.parent_id = srv->srv_conf.id; s->srv_conf.flags = SRVFLAG_LOCATION; s->srv_s = -1; memcpy(&s->srv_conf.ss, &srv->srv_conf.ss, @@ -1809,6 +1811,7 @@ server_inherit(struct server *src, const char *name, dst->srv_conf.tls_key = NULL; dst->srv_conf.id = ++last_server_id; + dst->srv_conf.parent_id = dst->srv_conf.id; dst->srv_s = -1; if (last_server_id == INT_MAX) { diff --git a/server_http.c b/server_http.c index 1a48b4a..0113a82 100644 --- a/server_http.c +++ b/server_http.c @@ -617,6 +617,8 @@ server_reset_http(struct client *clt) { struct server *srv = clt->clt_srv; + server_log(clt, NULL); + server_httpdesc_free(clt->clt_descreq); server_httpdesc_free(clt->clt_descresp); clt->clt_headerlen = 0; @@ -627,8 +629,6 @@ server_reset_http(struct client *clt) clt->clt_remote_user = NULL; clt->clt_bev->readcb = server_read_http; clt->clt_srv_conf = &srv->srv_conf; - - server_log(clt, NULL); } ssize_t @@ -998,7 +998,7 @@ server_getlocation(struct client *clt, const char *path) } #endif if ((location->flags & SRVFLAG_LOCATION) && - location->id == srv_conf->id && + location->parent_id == srv_conf->parent_id && fnmatch(location->location, path, FNM_CASEFOLD) == 0) { /* Replace host configuration */ clt->clt_srv_conf = srv_conf = location; -- cgit v1.2.3-54-g00ecf