Mercurial > hg > nginx
comparison 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 |
comparison
equal
deleted
inserted
replaced
368:15c84a40e87d | 369:9c2515d70489 |
---|---|
1156 void *parent, void *child) | 1156 void *parent, void *child) |
1157 { | 1157 { |
1158 ngx_http_core_srv_conf_t *prev = parent; | 1158 ngx_http_core_srv_conf_t *prev = parent; |
1159 ngx_http_core_srv_conf_t *conf = child; | 1159 ngx_http_core_srv_conf_t *conf = child; |
1160 | 1160 |
1161 ngx_http_listen_t *l; | 1161 ngx_http_listen_t *l; |
1162 ngx_http_server_name_t *n; | 1162 ngx_http_conf_ctx_t *ctx; |
1163 ngx_http_server_name_t *n; | |
1164 ngx_http_core_main_conf_t *cmcf; | |
1163 | 1165 |
1164 /* TODO: it does not merge, it inits only */ | 1166 /* TODO: it does not merge, it inits only */ |
1165 | 1167 |
1166 if (conf->listen.nelts == 0) { | 1168 if (conf->listen.nelts == 0) { |
1167 ngx_test_null(l, ngx_push_array(&conf->listen), NGX_CONF_ERROR); | 1169 ngx_test_null(l, ngx_push_array(&conf->listen), NGX_CONF_ERROR); |
1186 return NGX_CONF_ERROR; | 1188 return NGX_CONF_ERROR; |
1187 } | 1189 } |
1188 | 1190 |
1189 n->name.len = ngx_strlen(n->name.data); | 1191 n->name.len = ngx_strlen(n->name.data); |
1190 n->core_srv_conf = conf; | 1192 n->core_srv_conf = conf; |
1193 | |
1194 ctx = (ngx_http_conf_ctx_t *) | |
1195 cf->cycle->conf_ctx[ngx_http_module.index]; | |
1196 cmcf = ctx->main_conf[ngx_http_core_module.ctx_index]; | |
1197 | |
1198 if (cmcf->max_server_name_len < n->name.len) { | |
1199 cmcf->max_server_name_len = n->name.len; | |
1200 } | |
1191 } | 1201 } |
1192 | 1202 |
1193 ngx_conf_merge_size_value(conf->connection_pool_size, | 1203 ngx_conf_merge_size_value(conf->connection_pool_size, |
1194 prev->connection_pool_size, 16384); | 1204 prev->connection_pool_size, 16384); |
1195 ngx_conf_merge_msec_value(conf->post_accept_timeout, | 1205 ngx_conf_merge_msec_value(conf->post_accept_timeout, |
1423 | 1433 |
1424 static char *ngx_set_server_name(ngx_conf_t *cf, ngx_command_t *cmd, void *conf) | 1434 static char *ngx_set_server_name(ngx_conf_t *cf, ngx_command_t *cmd, void *conf) |
1425 { | 1435 { |
1426 ngx_http_core_srv_conf_t *scf = conf; | 1436 ngx_http_core_srv_conf_t *scf = conf; |
1427 | 1437 |
1428 ngx_uint_t i; | 1438 ngx_uint_t i; |
1429 ngx_str_t *value; | 1439 ngx_str_t *value; |
1430 ngx_http_server_name_t *sn; | 1440 ngx_http_conf_ctx_t *ctx; |
1441 ngx_http_server_name_t *sn; | |
1442 ngx_http_core_main_conf_t *cmcf; | |
1431 | 1443 |
1432 /* TODO: several names */ | 1444 /* TODO: several names */ |
1433 /* TODO: warn about duplicate 'server_name' directives */ | 1445 /* TODO: warn about duplicate 'server_name' directives */ |
1446 | |
1447 ctx = (ngx_http_conf_ctx_t *) cf->cycle->conf_ctx[ngx_http_module.index]; | |
1448 cmcf = ctx->main_conf[ngx_http_core_module.ctx_index]; | |
1434 | 1449 |
1435 value = cf->args->elts; | 1450 value = cf->args->elts; |
1436 | 1451 |
1437 for (i = 1; i < cf->args->nelts; i++) { | 1452 for (i = 1; i < cf->args->nelts; i++) { |
1438 if (value[i].len == 0) { | 1453 if (value[i].len == 0) { |
1446 ngx_test_null(sn, ngx_push_array(&scf->server_names), NGX_CONF_ERROR); | 1461 ngx_test_null(sn, ngx_push_array(&scf->server_names), NGX_CONF_ERROR); |
1447 | 1462 |
1448 sn->name.len = value[i].len; | 1463 sn->name.len = value[i].len; |
1449 sn->name.data = value[i].data; | 1464 sn->name.data = value[i].data; |
1450 sn->core_srv_conf = scf; | 1465 sn->core_srv_conf = scf; |
1466 | |
1467 if (cmcf->max_server_name_len < sn->name.len) { | |
1468 cmcf->max_server_name_len = sn->name.len; | |
1469 } | |
1451 } | 1470 } |
1452 | 1471 |
1453 return NGX_CONF_OK; | 1472 return NGX_CONF_OK; |
1454 } | 1473 } |
1455 | 1474 |