comparison src/http/ngx_http_core_module.c @ 2011:b56d4b1ebac7

$hostname variable
author Igor Sysoev <igor@sysoev.ru>
date Fri, 16 May 2008 14:39:06 +0000
parents b9de93d804ea
children f321b59ae0e9 8298d1be0b44
comparison
equal deleted inserted replaced
2010:bd6cc5370fc1 2011:b56d4b1ebac7
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 }