diff options
author | stbuehler <stbuehler@152afb58-edef-0310-8abb-c4023f1b3aa9> | 2012-11-07 14:24:24 +0000 |
---|---|---|
committer | stbuehler <stbuehler@152afb58-edef-0310-8abb-c4023f1b3aa9> | 2012-11-07 14:24:24 +0000 |
commit | 13572839be54cf85366b141c3175f7aed14d7188 (patch) | |
tree | 27f6d0c9f360ba9bd4d3db6f033223753d821f62 | |
parent | de28131afdaf869a6363410c1f2e0cc30a82742b (diff) | |
download | lighttpd-13572839be54cf85366b141c3175f7aed14d7188.tar.gz |
fix :port handling in $HTTP["host"] checks (fixes #2135. thx liming)
git-svn-id: svn://svn.lighttpd.net/lighttpd/trunk@2854 152afb58-edef-0310-8abb-c4023f1b3aa9
-rw-r--r-- | NEWS | 1 | ||||
-rw-r--r-- | src/configfile-glue.c | 8 |
2 files changed, 3 insertions, 6 deletions
@@ -172,6 +172,7 @@ NEWS * Enable linux-aio-sendfile for testing in autotools too * [mod_auth] Fix signedness error in http_auth (fixes #2370, CVE-2011-4362) * buffer_caseless_compare: always convert letters to lowercase to get transitive results, fixing array lookups (fixes #2405) + * fix :port handling in $HTTP["host"] checks (fixes #2135. thx liming) - 1.5.0-r19.. - * -F option added for spawn-fcgi diff --git a/src/configfile-glue.c b/src/configfile-glue.c index a2ac07ab..8a31e333 100644 --- a/src/configfile-glue.c +++ b/src/configfile-glue.c @@ -286,17 +286,13 @@ static cond_result_t config_check_cond_nocache(server *srv, connection *con, dat ck_colon = strchr(dc->string->ptr, ':'); val_colon = strchr(l->ptr, ':'); - if (ck_colon == val_colon) { - /* nothing to do with it */ - break; - } - if (ck_colon) { + if (NULL != ck_colon && NULL == val_colon) { /* condition "host:port" but client send "host" */ buffer_copy_string_buffer(srv->cond_check_buf, l); buffer_append_string_len(srv->cond_check_buf, CONST_STR_LEN(":")); buffer_append_long(srv->cond_check_buf, sock_addr_get_port(&(srv_sock->addr))); l = srv->cond_check_buf; - } else if (!ck_colon) { + } else if (NULL != val_colon && NULL == ck_colon) { /* condition "host" but client send "host:port" */ buffer_copy_string_len(srv->cond_check_buf, l->ptr, val_colon - l->ptr); l = srv->cond_check_buf; |