summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorstbuehler <stbuehler@152afb58-edef-0310-8abb-c4023f1b3aa9>2012-11-07 14:23:00 +0000
committerstbuehler <stbuehler@152afb58-edef-0310-8abb-c4023f1b3aa9>2012-11-07 14:23:00 +0000
commitf80e7f97dbe9759e9e4f200179ec6ca2623fbfec (patch)
treeafc8d4862f065da64f03262169ce3702d8bb0f60
parent5871dac33b74908bfd8835dab0832e3fe89c1e99 (diff)
downloadlighttpd-f80e7f97dbe9759e9e4f200179ec6ca2623fbfec.tar.gz
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
-rw-r--r--NEWS1
-rw-r--r--src/configfile-glue.c8
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;