comparison src/core/ngx_cycle.c @ 356:b743d290eb3b NGINX_0_6_22

nginx 0.6.22 *) Change: now all ngx_http_perl_module methods return values copied to perl's allocated memory. *) Bugfix: if nginx was built with ngx_http_perl_module, the perl before 5.8.6 was used, and perl supported threads, then during reconfiguration the master process aborted; bug appeared in 0.5.9. Thanks to Boris Zhmurov. *) Bugfix: the ngx_http_perl_module methods may get invalid values of the regex captures. *) Bugfix: a segmentation fault occurred in worker process, if the $r->has_request_body() method was called for a request whose small request body was already received. *) Bugfix: large_client_header_buffers did not freed before going to keep-alive state. Thanks to Olexander Shtepa. *) Bugfix: the last address was missed in the $upstream_addr variable; bug appeared in 0.6.18. *) Bugfix: the "fastcgi_catch_stderr" directive did return error code; now it returns 502 code, that can be rerouted to a next server using the "fastcgi_next_upstream invalid_header" directive. *) Bugfix: a segmentation fault occurred in master process if the "fastcgi_catch_stderr" directive was used; bug appeared in 0.6.10. Thanks to Manlio Perillo.
author Igor Sysoev <http://sysoev.ru>
date Wed, 19 Dec 2007 00:00:00 +0300
parents 2ceaee987f37
children edf1cb6c328e
comparison
equal deleted inserted replaced
355:3ac45897a61c 356:b743d290eb3b
40 40
41 41
42 ngx_cycle_t * 42 ngx_cycle_t *
43 ngx_init_cycle(ngx_cycle_t *old_cycle) 43 ngx_init_cycle(ngx_cycle_t *old_cycle)
44 { 44 {
45 void *rv; 45 void *rv;
46 u_char *lock_file; 46 char **senv, **env;
47 ngx_uint_t i, n; 47 u_char *lock_file;
48 ngx_log_t *log; 48 ngx_uint_t i, n;
49 ngx_conf_t conf; 49 ngx_log_t *log;
50 ngx_pool_t *pool; 50 ngx_conf_t conf;
51 ngx_cycle_t *cycle, **old; 51 ngx_pool_t *pool;
52 ngx_shm_zone_t *shm_zone, *oshm_zone; 52 ngx_cycle_t *cycle, **old;
53 ngx_slab_pool_t *shpool; 53 ngx_shm_zone_t *shm_zone, *oshm_zone;
54 ngx_list_part_t *part, *opart; 54 ngx_slab_pool_t *shpool;
55 ngx_open_file_t *file; 55 ngx_list_part_t *part, *opart;
56 ngx_listening_t *ls, *nls; 56 ngx_open_file_t *file;
57 ngx_core_conf_t *ccf, *old_ccf; 57 ngx_listening_t *ls, *nls;
58 ngx_core_module_t *module; 58 ngx_core_conf_t *ccf, *old_ccf;
59 ngx_core_module_t *module;
59 60
60 log = old_cycle->log; 61 log = old_cycle->log;
61 62
62 pool = ngx_create_pool(NGX_CYCLE_POOL_SIZE, log); 63 pool = ngx_create_pool(NGX_CYCLE_POOL_SIZE, log);
63 if (pool == NULL) { 64 if (pool == NULL) {
183 return NULL; 184 return NULL;
184 } 185 }
185 cycle->conf_ctx[ngx_modules[i]->index] = rv; 186 cycle->conf_ctx[ngx_modules[i]->index] = rv;
186 } 187 }
187 } 188 }
189
190
191 senv = environ;
188 192
189 193
190 ngx_memzero(&conf, sizeof(ngx_conf_t)); 194 ngx_memzero(&conf, sizeof(ngx_conf_t));
191 /* STUB: init array ? */ 195 /* STUB: init array ? */
192 conf.args = ngx_array_create(pool, 10, sizeof(ngx_str_t)); 196 conf.args = ngx_array_create(pool, 10, sizeof(ngx_str_t));
692 696
693 ngx_destroy_pool(conf.temp_pool); 697 ngx_destroy_pool(conf.temp_pool);
694 698
695 if (ngx_process == NGX_PROCESS_MASTER || ngx_is_init_cycle(old_cycle)) { 699 if (ngx_process == NGX_PROCESS_MASTER || ngx_is_init_cycle(old_cycle)) {
696 700
701 /*
702 * perl_destruct() frees environ if it is not the same as it was at
703 * perl_construct() time. So we have saved an previous cycle
704 * environment before ngx_conf_parse() where it will be changed.
705 */
706
707 env = environ;
708 environ = senv;
709
697 ngx_destroy_pool(old_cycle->pool); 710 ngx_destroy_pool(old_cycle->pool);
698 cycle->old_cycle = NULL; 711 cycle->old_cycle = NULL;
712
713 environ = env;
699 714
700 return cycle; 715 return cycle;
701 } 716 }
702 717
703 718
936 { 951 {
937 ngx_fd_t fd; 952 ngx_fd_t fd;
938 ngx_uint_t i; 953 ngx_uint_t i;
939 ngx_list_part_t *part; 954 ngx_list_part_t *part;
940 ngx_open_file_t *file; 955 ngx_open_file_t *file;
941 #if !(NGX_WIN32)
942 ngx_file_info_t fi;
943 #endif
944 956
945 part = &cycle->open_files.part; 957 part = &cycle->open_files.part;
946 file = part->elts; 958 file = part->elts;
947 959
948 for (i = 0; /* void */ ; i++) { 960 for (i = 0; /* void */ ; i++) {
994 1006
995 continue; 1007 continue;
996 } 1008 }
997 #else 1009 #else
998 if (user != (ngx_uid_t) NGX_CONF_UNSET_UINT) { 1010 if (user != (ngx_uid_t) NGX_CONF_UNSET_UINT) {
1011 ngx_file_info_t fi;
999 1012
1000 if (ngx_file_info((const char *) file[i].name.data, &fi) == -1) { 1013 if (ngx_file_info((const char *) file[i].name.data, &fi) == -1) {
1001 ngx_log_error(NGX_LOG_EMERG, cycle->log, ngx_errno, 1014 ngx_log_error(NGX_LOG_EMERG, cycle->log, ngx_errno,
1002 ngx_file_info_n " \"%s\" failed", 1015 ngx_file_info_n " \"%s\" failed",
1003 file[i].name.data); 1016 file[i].name.data);