Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nginx/nginx.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIgor Sysoev <igor@sysoev.ru>2006-02-01 21:22:15 +0300
committerIgor Sysoev <igor@sysoev.ru>2006-02-01 21:22:15 +0300
commit9e58019dc287493e02543d614c975cc14295a71e (patch)
tree328bccfba6e86794eafc546a7cb7ec8aff007b7f /src/http/ngx_http_core_module.c
parente8038c0d1a044f2046d5f7adeb1586d17a5bd81a (diff)
nginx-0.3.24-RELEASE importrelease-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; the bug had appeared in 0.3.18.
Diffstat (limited to 'src/http/ngx_http_core_module.c')
-rw-r--r--src/http/ngx_http_core_module.c23
1 files changed, 14 insertions, 9 deletions
diff --git a/src/http/ngx_http_core_module.c b/src/http/ngx_http_core_module.c
index a73448b99..2784921f2 100644
--- 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 *cf, void *parent, void *child)
ls->conf.sndbuf = -1;
}
- if (conf->server_names.nelts == 0) {
- sn = ngx_array_push(&conf->server_names);
- if (sn == NULL) {
+ 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;
}
- sn->name.data = ngx_palloc(cf->pool, NGX_MAXHOSTNAMELEN);
- if (sn->name.data == NULL) {
+ 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;
}
- if (gethostname((char *) sn->name.data, NGX_MAXHOSTNAMELEN) == -1) {
- ngx_conf_log_error(NGX_LOG_EMERG, cf, ngx_errno,
- "gethostname() failed");
+ 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.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;
}