From f80e7f97dbe9759e9e4f200179ec6ca2623fbfec Mon Sep 17 00:00:00 2001 From: stbuehler Date: Wed, 7 Nov 2012 14:23:00 +0000 Subject: fix :port handling in $HTTP["host"] checks (fixes #2135. thx liming) git-svn-id: svn://svn.lighttpd.net/lighttpd/branches/lighttpd-1.4.x@2853 152afb58-edef-0310-8abb-c4023f1b3aa9 --- NEWS | 1 + src/configfile-glue.c | 8 ++------ 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/NEWS b/NEWS index 3ac10eb5..36faa364 100644 --- a/NEWS +++ b/NEWS @@ -9,6 +9,7 @@ NEWS * Handle ENAMETOOLONG, return 404 Not Found (fixes #2396, thx dererkazo) * configure.ac: remove old stuff, add some new to fix warnings in automake 1.12 (fixes #2419, thx blino) * add PATCH method (fixes #2424) + * fix :port handling in $HTTP["host"] checks (fixes #2135. thx liming) - 1.4.31 - 2012-05-31 * [ssl] fix segfault in counting renegotiations for openssl versions without TLSEXT/SNI (thx carpii for reporting) diff --git a/src/configfile-glue.c b/src/configfile-glue.c index 782eb815..3efa46a8 100644 --- a/src/configfile-glue.c +++ b/src/configfile-glue.c @@ -299,17 +299,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; -- cgit v1.2.1