Permalink
Browse files

Fix hostname parsing when no port is provided

  • Loading branch information...
1 parent ed0930d commit aa4462cb78071c48471ec707e9aa341b1c52389b @tmm1 tmm1 committed with Jul 10, 2011
Showing with 7 additions and 4 deletions.
  1. +7 −4 src/http/modules/ngx_http_ssl_module.c
@@ -656,20 +656,23 @@ ngx_http_ssl_session_cache(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
/* We have a host */
len = 0;
for (j = total_len; j < value[i].len; j++) {
- total_len++;
if (value[i].data[j] == ':') {
value[i].data[j] = '\0';
break;
}
+ total_len++;
len++;
}
sscf->ext_session_cache.memcache_host.len = len;
- sscf->ext_session_cache.memcache_host.data = value[i].data + total_len - len - 1;
+ sscf->ext_session_cache.memcache_host.data = value[i].data + total_len - len;
ngx_log_error_core(NGX_LOG_DEBUG, cf->log, 0,
- "memcache_host parsed as %V",
- &sscf->ext_session_cache.memcache_host);
+ "memcache_host parsed as %V (%d)",
+ &sscf->ext_session_cache.memcache_host, len);
+
+ /* Skip over ':' */
+ total_len++;
}
if (value[i].len > total_len) {

0 comments on commit aa4462c

Please sign in to comment.