Mercurial > hg > nginx-mail
diff src/http/modules/perl/ngx_http_perl_module.c @ 520: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 |
line wrap: on
line diff
--- a/src/http/modules/perl/ngx_http_perl_module.c +++ b/src/http/modules/perl/ngx_http_perl_module.c @@ -154,10 +154,14 @@ static ngx_http_ssi_command_t ngx_http_ #endif -static ngx_str_t ngx_null_name = ngx_null_string; +static ngx_str_t ngx_null_name = ngx_null_string; + +static HV *nginx_stash; +#if (NGX_HAVE_PERL_MULTIPLICITY) +static ngx_uint_t ngx_perl_term; +#endif -static HV *nginx_stash; static void ngx_http_perl_xs_init(pTHX) @@ -171,7 +175,6 @@ ngx_http_perl_xs_init(pTHX) static ngx_int_t ngx_http_perl_handler(ngx_http_request_t *r) { - /* TODO: Win32 */ if (r->zero_in_uri) { return NGX_HTTP_NOT_FOUND; } @@ -821,6 +824,12 @@ ngx_http_perl_cleanup_perl(void *data) (void) perl_destruct(perl); perl_free(perl); + + if (ngx_perl_term) { + ngx_log_debug0(NGX_LOG_DEBUG_HTTP, ngx_cycle->log, 0, "perl term"); + + PERL_SYS_TERM(); + } } #endif @@ -1041,15 +1050,13 @@ ngx_http_perl_init_worker(ngx_cycle_t *c pmcf = ngx_http_cycle_get_module_main_conf(cycle, ngx_http_perl_module); - { - - dTHXa(pmcf->perl); - PERL_SET_CONTEXT(pmcf->perl); + if (pmcf) { + dTHXa(pmcf->perl); + PERL_SET_CONTEXT(pmcf->perl); - /* set worker's $$ */ + /* set worker's $$ */ - sv_setiv(GvSV(gv_fetchpv("$", TRUE, SVt_PV)), (I32) ngx_pid); - + sv_setiv(GvSV(gv_fetchpv("$", TRUE, SVt_PV)), (I32) ngx_pid); } return NGX_OK; @@ -1059,16 +1066,24 @@ ngx_http_perl_init_worker(ngx_cycle_t *c static void ngx_http_perl_exit(ngx_cycle_t *cycle) { +#if (NGX_HAVE_PERL_MULTIPLICITY) + + ngx_perl_term = 1; + +#else ngx_http_perl_main_conf_t *pmcf; pmcf = ngx_http_cycle_get_module_main_conf(cycle, ngx_http_perl_module); - { + if (pmcf && nginx_stash) { + ngx_log_debug0(NGX_LOG_DEBUG_HTTP, cycle->log, 0, "perl term"); - dTHXa(pmcf->perl); - PERL_SET_CONTEXT(pmcf->perl); + (void) perl_destruct(pmcf->perl); - PERL_SYS_TERM(); + perl_free(pmcf->perl); + PERL_SYS_TERM(); } + +#endif }