Skip to content

Commit

Permalink
Fix hostname parsing when no port is provided
Browse files Browse the repository at this point in the history
  • Loading branch information
tmm1 authored and mpalmer committed Jul 22, 2011
1 parent ed0930d commit aa4462c
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions src/http/modules/ngx_http_ssl_module.c
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -656,20 +656,23 @@ ngx_http_ssl_session_cache(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
/* We have a host */ /* We have a host */
len = 0; len = 0;
for (j = total_len; j < value[i].len; j++) { for (j = total_len; j < value[i].len; j++) {
total_len++;
if (value[i].data[j] == ':') { if (value[i].data[j] == ':') {
value[i].data[j] = '\0'; value[i].data[j] = '\0';
break; break;
} }
total_len++;
len++; len++;
} }


sscf->ext_session_cache.memcache_host.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, ngx_log_error_core(NGX_LOG_DEBUG, cf->log, 0,
"memcache_host parsed as %V", "memcache_host parsed as %V (%d)",
&sscf->ext_session_cache.memcache_host); &sscf->ext_session_cache.memcache_host, len);

/* Skip over ':' */
total_len++;
} }


if (value[i].len > total_len) { if (value[i].len > total_len) {
Expand Down

0 comments on commit aa4462c

Please sign in to comment.