comparison src/core/ngx_cycle.c @ 376:edf1cb6c328e NGINX_0_7_0

nginx 0.7.0 *) Change: now the 0x00-0x1F, '"' and '\' characters are escaped as \xXX in an access_log. Thanks to Maxim Dounin. *) Change: now nginx allows several "Host" request header line. *) Feature: the "modified" flag in the "expires" directive. *) Feature: the $uid_got and $uid_set variables may be used at any request processing stage. *) Feature: the $hostname variable. Thanks to Andrei Nigmatulin. *) Feature: DESTDIR support. Thanks to Todd A. Fisher and Andras Voroskoi. *) Bugfix: a segmentation fault might occur in worker process on Linux, if keepalive was enabled.
author Igor Sysoev <http://sysoev.ru>
date Mon, 19 May 2008 00:00:00 +0400
parents b743d290eb3b
children 984bb0b1399b
comparison
equal deleted inserted replaced
375:52f3c9c7eff0 376:edf1cb6c328e
55 ngx_list_part_t *part, *opart; 55 ngx_list_part_t *part, *opart;
56 ngx_open_file_t *file; 56 ngx_open_file_t *file;
57 ngx_listening_t *ls, *nls; 57 ngx_listening_t *ls, *nls;
58 ngx_core_conf_t *ccf, *old_ccf; 58 ngx_core_conf_t *ccf, *old_ccf;
59 ngx_core_module_t *module; 59 ngx_core_module_t *module;
60 char hostname[NGX_MAXHOSTNAMELEN];
60 61
61 log = old_cycle->log; 62 log = old_cycle->log;
62 63
63 pool = ngx_create_pool(NGX_CYCLE_POOL_SIZE, log); 64 pool = ngx_create_pool(NGX_CYCLE_POOL_SIZE, log);
64 if (pool == NULL) { 65 if (pool == NULL) {
166 cycle->conf_ctx = ngx_pcalloc(pool, ngx_max_module * sizeof(void *)); 167 cycle->conf_ctx = ngx_pcalloc(pool, ngx_max_module * sizeof(void *));
167 if (cycle->conf_ctx == NULL) { 168 if (cycle->conf_ctx == NULL) {
168 ngx_destroy_pool(pool); 169 ngx_destroy_pool(pool);
169 return NULL; 170 return NULL;
170 } 171 }
172
173
174 if (gethostname(hostname, NGX_MAXHOSTNAMELEN) == -1) {
175 ngx_log_error(NGX_LOG_EMERG, log, ngx_errno, "gethostname() failed");
176 ngx_destroy_pool(pool);
177 return NULL;
178 }
179
180 /* on Linux gethostname() silently truncates name that does not fit */
181
182 hostname[NGX_MAXHOSTNAMELEN - 1] = '\0';
183 cycle->hostname.len = ngx_strlen(hostname);
184
185 cycle->hostname.data = ngx_palloc(pool, cycle->hostname.len);
186 if (cycle->hostname.data == NULL) {
187 ngx_destroy_pool(pool);
188 return NULL;
189 }
190
191 ngx_memcpy(cycle->hostname.data, hostname, cycle->hostname.len);
171 192
172 193
173 for (i = 0; ngx_modules[i]; i++) { 194 for (i = 0; ngx_modules[i]; i++) {
174 if (ngx_modules[i]->type != NGX_CORE_MODULE) { 195 if (ngx_modules[i]->type != NGX_CORE_MODULE) {
175 continue; 196 continue;