Mercurial > hg > nginx
diff src/http/ngx_http_core_module.c @ 369:9c2515d70489
nginx-0.0.7-2004-06-25-18:42:03 import
author | Igor Sysoev <igor@sysoev.ru> |
---|---|
date | Fri, 25 Jun 2004 14:42:03 +0000 |
parents | 2e3cbc1bbe3c |
children | 02a511569afb |
line wrap: on
line diff
--- a/src/http/ngx_http_core_module.c +++ b/src/http/ngx_http_core_module.c @@ -1158,8 +1158,10 @@ static char *ngx_http_core_merge_srv_con ngx_http_core_srv_conf_t *prev = parent; ngx_http_core_srv_conf_t *conf = child; - ngx_http_listen_t *l; - ngx_http_server_name_t *n; + ngx_http_listen_t *l; + ngx_http_conf_ctx_t *ctx; + ngx_http_server_name_t *n; + ngx_http_core_main_conf_t *cmcf; /* TODO: it does not merge, it inits only */ @@ -1188,6 +1190,14 @@ static char *ngx_http_core_merge_srv_con n->name.len = ngx_strlen(n->name.data); n->core_srv_conf = conf; + + ctx = (ngx_http_conf_ctx_t *) + cf->cycle->conf_ctx[ngx_http_module.index]; + cmcf = ctx->main_conf[ngx_http_core_module.ctx_index]; + + if (cmcf->max_server_name_len < n->name.len) { + cmcf->max_server_name_len = n->name.len; + } } ngx_conf_merge_size_value(conf->connection_pool_size, @@ -1425,13 +1435,18 @@ static char *ngx_set_server_name(ngx_con { ngx_http_core_srv_conf_t *scf = conf; - ngx_uint_t i; - ngx_str_t *value; - ngx_http_server_name_t *sn; + ngx_uint_t i; + ngx_str_t *value; + ngx_http_conf_ctx_t *ctx; + ngx_http_server_name_t *sn; + ngx_http_core_main_conf_t *cmcf; /* TODO: several names */ /* TODO: warn about duplicate 'server_name' directives */ + ctx = (ngx_http_conf_ctx_t *) cf->cycle->conf_ctx[ngx_http_module.index]; + cmcf = ctx->main_conf[ngx_http_core_module.ctx_index]; + value = cf->args->elts; for (i = 1; i < cf->args->nelts; i++) { @@ -1448,6 +1463,10 @@ static char *ngx_set_server_name(ngx_con sn->name.len = value[i].len; sn->name.data = value[i].data; sn->core_srv_conf = scf; + + if (cmcf->max_server_name_len < sn->name.len) { + cmcf->max_server_name_len = sn->name.len; + } } return NGX_CONF_OK;