Mercurial > hg > nginx-mail
diff src/http/ngx_http_core_module.c @ 154:bb61aa162c6b NGINX_0_3_24
nginx 0.3.24
*) Workaround: for bug in FreeBSD kqueue.
*) Bugfix: now a response generated by the "post_action" directive is
not transferred to a client.
*) Bugfix: the memory leaks were occurring if many log files were used.
*) Bugfix: the first "proxy_redirect" directive was working inside one
location.
*) Bugfix: on 64-bit platforms segmentation fault may occurred on start
if the many names were used in the "server_name" directives; bug
appeared in 0.3.18.
author | Igor Sysoev <http://sysoev.ru> |
---|---|
date | Wed, 01 Feb 2006 00:00:00 +0300 |
parents | 396dbbc06dd7 |
children | 2d15b82126ed |
line wrap: on
line diff
--- a/src/http/ngx_http_core_module.c +++ b/src/http/ngx_http_core_module.c @@ -1880,24 +1880,29 @@ ngx_http_core_merge_srv_conf(ngx_conf_t ls->conf.sndbuf = -1; } - if (conf->server_names.nelts == 0) { + if (conf->server_name.data == NULL) { + conf->server_name.data = ngx_palloc(cf->pool, NGX_MAXHOSTNAMELEN); + if (conf->server_name.data == NULL) { + return NGX_CONF_ERROR; + } + + if (gethostname((char *) conf->server_name.data, NGX_MAXHOSTNAMELEN) + == -1) + { + ngx_conf_log_error(NGX_LOG_EMERG, cf, ngx_errno, + "gethostname() failed"); + return NGX_CONF_ERROR; + } + + conf->server_name.len = ngx_strlen(conf->server_name.data); + sn = ngx_array_push(&conf->server_names); if (sn == NULL) { return NGX_CONF_ERROR; } - sn->name.data = ngx_palloc(cf->pool, NGX_MAXHOSTNAMELEN); - if (sn->name.data == NULL) { - return NGX_CONF_ERROR; - } - - if (gethostname((char *) sn->name.data, NGX_MAXHOSTNAMELEN) == -1) { - ngx_conf_log_error(NGX_LOG_EMERG, cf, ngx_errno, - "gethostname() failed"); - return NGX_CONF_ERROR; - } - - sn->name.len = ngx_strlen(sn->name.data); + sn->name.len = conf->server_name.len; + sn->name.data = conf->server_name.data; sn->core_srv_conf = conf; }