comparison src/http/modules/perl/ngx_http_perl_module.c @ 489:549994537f15 NGINX_0_7_52

nginx 0.7.52 *) Feature: the first native Windows binary release. *) Bugfix: in processing HEAD method while caching. *) Bugfix: in processing the "If-Modified-Since", "If-Range", etc. client request header lines while caching. *) Bugfix: now the "Set-Cookie" and "P3P" header lines are hidden in cacheable responses. *) Bugfix: if nginx was built with the ngx_http_perl_module and with a perl which supports threads, then during a master process exit the message "panic: MUTEX_LOCK" might be issued. *) Bugfix: nginx could not be built --without-http-cache; the bug had appeared in 0.7.48. *) Bugfix: nginx could not be built on platforms different from i386, amd64, sparc, and ppc; the bug had appeared in 0.7.42.
author Igor Sysoev <http://sysoev.ru>
date Mon, 20 Apr 2009 00:00:00 +0400
parents dac47e9ef0d5
children f39b9e29530d
comparison
equal deleted inserted replaced
488:eb4fdebda673 489:549994537f15
152 }; 152 };
153 153
154 #endif 154 #endif
155 155
156 156
157 static ngx_str_t ngx_null_name = ngx_null_string; 157 static ngx_str_t ngx_null_name = ngx_null_string;
158 158
159 159 static HV *nginx_stash;
160 static HV *nginx_stash; 160
161 #if (NGX_HAVE_PERL_MULTIPLICITY)
162 static ngx_uint_t ngx_perl_term;
163 #endif
164
161 165
162 static void 166 static void
163 ngx_http_perl_xs_init(pTHX) 167 ngx_http_perl_xs_init(pTHX)
164 { 168 {
165 newXS("DynaLoader::boot_DynaLoader", boot_DynaLoader, __FILE__); 169 newXS("DynaLoader::boot_DynaLoader", boot_DynaLoader, __FILE__);
169 173
170 174
171 static ngx_int_t 175 static ngx_int_t
172 ngx_http_perl_handler(ngx_http_request_t *r) 176 ngx_http_perl_handler(ngx_http_request_t *r)
173 { 177 {
174 /* TODO: Win32 */
175 if (r->zero_in_uri) { 178 if (r->zero_in_uri) {
176 return NGX_HTTP_NOT_FOUND; 179 return NGX_HTTP_NOT_FOUND;
177 } 180 }
178 181
179 ngx_http_perl_handle_request(r); 182 ngx_http_perl_handle_request(r);
819 PERL_SET_CONTEXT(perl); 822 PERL_SET_CONTEXT(perl);
820 823
821 (void) perl_destruct(perl); 824 (void) perl_destruct(perl);
822 825
823 perl_free(perl); 826 perl_free(perl);
827
828 if (ngx_perl_term) {
829 ngx_log_debug0(NGX_LOG_DEBUG_HTTP, ngx_cycle->log, 0, "perl term");
830
831 PERL_SYS_TERM();
832 }
824 } 833 }
825 834
826 #endif 835 #endif
827 836
828 837
1039 { 1048 {
1040 ngx_http_perl_main_conf_t *pmcf; 1049 ngx_http_perl_main_conf_t *pmcf;
1041 1050
1042 pmcf = ngx_http_cycle_get_module_main_conf(cycle, ngx_http_perl_module); 1051 pmcf = ngx_http_cycle_get_module_main_conf(cycle, ngx_http_perl_module);
1043 1052
1044 { 1053 if (pmcf) {
1045 1054 dTHXa(pmcf->perl);
1046 dTHXa(pmcf->perl); 1055 PERL_SET_CONTEXT(pmcf->perl);
1047 PERL_SET_CONTEXT(pmcf->perl); 1056
1048 1057 /* set worker's $$ */
1049 /* set worker's $$ */ 1058
1050 1059 sv_setiv(GvSV(gv_fetchpv("$", TRUE, SVt_PV)), (I32) ngx_pid);
1051 sv_setiv(GvSV(gv_fetchpv("$", TRUE, SVt_PV)), (I32) ngx_pid);
1052
1053 } 1060 }
1054 1061
1055 return NGX_OK; 1062 return NGX_OK;
1056 } 1063 }
1057 1064
1058 1065
1059 static void 1066 static void
1060 ngx_http_perl_exit(ngx_cycle_t *cycle) 1067 ngx_http_perl_exit(ngx_cycle_t *cycle)
1061 { 1068 {
1069 #if (NGX_HAVE_PERL_MULTIPLICITY)
1070
1071 ngx_perl_term = 1;
1072
1073 #else
1062 ngx_http_perl_main_conf_t *pmcf; 1074 ngx_http_perl_main_conf_t *pmcf;
1063 1075
1064 pmcf = ngx_http_cycle_get_module_main_conf(cycle, ngx_http_perl_module); 1076 pmcf = ngx_http_cycle_get_module_main_conf(cycle, ngx_http_perl_module);
1065 1077
1066 { 1078 if (pmcf && nginx_stash) {
1067 1079 ngx_log_debug0(NGX_LOG_DEBUG_HTTP, cycle->log, 0, "perl term");
1068 dTHXa(pmcf->perl); 1080
1069 PERL_SET_CONTEXT(pmcf->perl); 1081 (void) perl_destruct(pmcf->perl);
1070 1082
1071 PERL_SYS_TERM(); 1083 perl_free(pmcf->perl);
1072 1084
1073 } 1085 PERL_SYS_TERM();
1074 } 1086 }
1087
1088 #endif
1089 }