nginx-0.0.7-2004-06-25-18:42:03 import
diff --git a/src/http/ngx_http_core_module.c b/src/http/ngx_http_core_module.c
index 5e43d5d..2761afb 100644
--- a/src/http/ngx_http_core_module.c
+++ b/src/http/ngx_http_core_module.c
@@ -1158,8 +1158,10 @@
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 @@
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 @@
{
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 @@
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;