comparison src/http/ngx_http_core_module.c @ 2096:a2199268010a stable-0.6

r2012 merge: $hostname variable
author Igor Sysoev <igor@sysoev.ru>
date Mon, 07 Jul 2008 11:20:46 +0000
parents 65cff41e9a4e
children f321b59ae0e9 8298d1be0b44
comparison
equal deleted inserted replaced
2095:ab63bc586ada 2096:a2199268010a
2604 ls->conf.rcvbuf = -1; 2604 ls->conf.rcvbuf = -1;
2605 ls->conf.sndbuf = -1; 2605 ls->conf.sndbuf = -1;
2606 } 2606 }
2607 2607
2608 if (conf->server_name.data == NULL) { 2608 if (conf->server_name.data == NULL) {
2609 conf->server_name.data = ngx_palloc(cf->pool, NGX_MAXHOSTNAMELEN); 2609 conf->server_name = cf->cycle->hostname;
2610 if (conf->server_name.data == NULL) {
2611 return NGX_CONF_ERROR;
2612 }
2613
2614 if (gethostname((char *) conf->server_name.data, NGX_MAXHOSTNAMELEN)
2615 == -1)
2616 {
2617 ngx_conf_log_error(NGX_LOG_EMERG, cf, ngx_errno,
2618 "gethostname() failed");
2619 return NGX_CONF_ERROR;
2620 }
2621
2622 conf->server_name.len = ngx_strlen(conf->server_name.data);
2623 2610
2624 sn = ngx_array_push(&conf->server_names); 2611 sn = ngx_array_push(&conf->server_names);
2625 if (sn == NULL) { 2612 if (sn == NULL) {
2626 return NGX_CONF_ERROR; 2613 return NGX_CONF_ERROR;
2627 } 2614 }