Mercurial > hg > nginx-vendor-current
comparison src/http/modules/perl/ngx_http_perl_module.c @ 366:babd3d9efb62 NGINX_0_6_27
nginx 0.6.27
*) Change: now by default the rtsig method is not built on
Linux 2.6.18+.
*) Change: now a request method is not changed while redirection to a
named location via an "error_page" directive.
*) Feature: the "resolver" and "resolver_timeout" directives in SMTP
proxy.
*) Feature: the "post_action" directive supports named locations.
*) Bugfix: a segmentation fault occurred in worker process, if a
request was redirected from proxy, FastCGI, or memcached location to
static named locations.
*) Bugfix: browsers did not repeat SSL handshake if there is no valid
client certificate in first handshake.
Thanks to Alexander V. Inyukhin.
*) Bugfix: if response code 495-497 was redirected via an "error_page"
directive without code change, then nginx tried to allocate too many
memory.
*) Bugfix: memory leak in long-lived non buffered connections.
*) Bugfix: memory leak in resolver.
*) Bugfix: a segmentation fault occurred in worker process, if a
request was redirected from proxy, FastCGI, or memcached location to
static named locations.
*) Bugfix: in the $proxy_host and $proxy_port variables caching.
Thanks to Sergey Bochenkov.
*) Bugfix: a "proxy_pass" directive with variables used incorrectly the
same port as in another "proxy_pass" directive with the same host
name and without variables.
Thanks to Sergey Bochenkov.
*) Bugfix: an alert "sendmsg() failed (9: Bad file descriptor)" on some
64-bit platforms while reconfiguration.
*) Bugfix: a segmentation fault occurred in worker process, if empty
stub block was used second time in SSI.
*) Bugfix: in copying URI part contained escaped symbols into arguments.
author | Igor Sysoev <http://sysoev.ru> |
---|---|
date | Wed, 12 Mar 2008 00:00:00 +0300 |
parents | b743d290eb3b |
children | 9a242235a80a |
comparison
equal
deleted
inserted
replaced
365:9b0140fa1132 | 366:babd3d9efb62 |
---|---|
39 #if (NGX_HTTP_SSI) | 39 #if (NGX_HTTP_SSI) |
40 static ngx_int_t ngx_http_perl_ssi(ngx_http_request_t *r, | 40 static ngx_int_t ngx_http_perl_ssi(ngx_http_request_t *r, |
41 ngx_http_ssi_ctx_t *ssi_ctx, ngx_str_t **params); | 41 ngx_http_ssi_ctx_t *ssi_ctx, ngx_str_t **params); |
42 #endif | 42 #endif |
43 | 43 |
44 static void ngx_http_perl_sleep_handler(ngx_http_request_t *r); | |
45 static char *ngx_http_perl_init_interpreter(ngx_conf_t *cf, | 44 static char *ngx_http_perl_init_interpreter(ngx_conf_t *cf, |
46 ngx_http_perl_main_conf_t *pmcf); | 45 ngx_http_perl_main_conf_t *pmcf); |
47 static PerlInterpreter *ngx_http_perl_create_interpreter(ngx_conf_t *cf, | 46 static PerlInterpreter *ngx_http_perl_create_interpreter(ngx_conf_t *cf, |
48 ngx_http_perl_main_conf_t *pmcf); | 47 ngx_http_perl_main_conf_t *pmcf); |
49 static ngx_int_t ngx_http_perl_run_requires(pTHX_ ngx_array_t *requires, | 48 static ngx_int_t ngx_http_perl_run_requires(pTHX_ ngx_array_t *requires, |
50 ngx_log_t *log); | 49 ngx_log_t *log); |
51 static ngx_int_t ngx_http_perl_call_handler(pTHX_ ngx_http_request_t *r, | 50 static ngx_int_t ngx_http_perl_call_handler(pTHX_ ngx_http_request_t *r, |
52 HV *nginx, SV *sub, ngx_str_t **args, ngx_str_t *handler, ngx_str_t *rv); | 51 HV *nginx, SV *sub, SV **args, ngx_str_t *handler, ngx_str_t *rv); |
53 static void ngx_http_perl_eval_anon_sub(pTHX_ ngx_str_t *handler, SV **sv); | 52 static void ngx_http_perl_eval_anon_sub(pTHX_ ngx_str_t *handler, SV **sv); |
54 | 53 |
55 static ngx_int_t ngx_http_perl_preconfiguration(ngx_conf_t *cf); | 54 static ngx_int_t ngx_http_perl_preconfiguration(ngx_conf_t *cf); |
56 static void *ngx_http_perl_create_main_conf(ngx_conf_t *cf); | 55 static void *ngx_http_perl_create_main_conf(ngx_conf_t *cf); |
57 static char *ngx_http_perl_init_main_conf(ngx_conf_t *cf, void *conf); | 56 static char *ngx_http_perl_init_main_conf(ngx_conf_t *cf, void *conf); |
250 } | 249 } |
251 | 250 |
252 ctx->filename.data = NULL; | 251 ctx->filename.data = NULL; |
253 ctx->redirect_uri.len = 0; | 252 ctx->redirect_uri.len = 0; |
254 | 253 |
255 if (ctx->sleep) { | |
256 ngx_add_timer(r->connection->write, (ngx_msec_t) ctx->sleep); | |
257 r->write_event_handler = ngx_http_perl_sleep_handler; | |
258 ctx->sleep = 0; | |
259 } | |
260 | |
261 if (ctx->done || ctx->next) { | 254 if (ctx->done || ctx->next) { |
262 return; | 255 return; |
263 } | 256 } |
264 | 257 |
265 if (uri.len) { | 258 if (uri.len) { |
274 | 267 |
275 ngx_http_finalize_request(r, rc); | 268 ngx_http_finalize_request(r, rc); |
276 } | 269 } |
277 | 270 |
278 | 271 |
279 static void | 272 void |
280 ngx_http_perl_sleep_handler(ngx_http_request_t *r) | 273 ngx_http_perl_sleep_handler(ngx_http_request_t *r) |
281 { | 274 { |
282 ngx_event_t *wev; | 275 ngx_event_t *wev; |
283 | 276 |
284 ngx_log_debug0(NGX_LOG_DEBUG_HTTP, r->connection->log, 0, | 277 ngx_log_debug0(NGX_LOG_DEBUG_HTTP, r->connection->log, 0, |
362 | 355 |
363 static ngx_int_t | 356 static ngx_int_t |
364 ngx_http_perl_ssi(ngx_http_request_t *r, ngx_http_ssi_ctx_t *ssi_ctx, | 357 ngx_http_perl_ssi(ngx_http_request_t *r, ngx_http_ssi_ctx_t *ssi_ctx, |
365 ngx_str_t **params) | 358 ngx_str_t **params) |
366 { | 359 { |
367 SV *sv; | 360 SV *sv, **asv; |
368 ngx_int_t rc; | 361 ngx_int_t rc; |
369 ngx_str_t *handler; | 362 ngx_str_t *handler, **args; |
363 ngx_uint_t i; | |
370 ngx_http_perl_ctx_t *ctx; | 364 ngx_http_perl_ctx_t *ctx; |
371 ngx_http_perl_main_conf_t *pmcf; | 365 ngx_http_perl_main_conf_t *pmcf; |
372 | 366 |
373 ngx_log_debug0(NGX_LOG_DEBUG_HTTP, r->connection->log, 0, | 367 ngx_log_debug0(NGX_LOG_DEBUG_HTTP, r->connection->log, 0, |
374 "perl ssi handler"); | 368 "perl ssi handler"); |
414 | 408 |
415 #endif | 409 #endif |
416 | 410 |
417 sv = newSVpvn((char *) handler->data, handler->len); | 411 sv = newSVpvn((char *) handler->data, handler->len); |
418 | 412 |
419 rc = ngx_http_perl_call_handler(aTHX_ r, pmcf->nginx, sv, | 413 args = ¶ms[NGX_HTTP_PERL_SSI_ARG]; |
420 ¶ms[NGX_HTTP_PERL_SSI_ARG], | 414 |
421 handler, NULL); | 415 if (args) { |
416 | |
417 for (i = 0; args[i]; i++) { /* void */ } | |
418 | |
419 asv = ngx_pcalloc(r->pool, (i + 1) * sizeof(SV *)); | |
420 | |
421 if (asv == NULL) { | |
422 SvREFCNT_dec(sv); | |
423 return NGX_ERROR; | |
424 } | |
425 | |
426 asv[0] = (SV *) i; | |
427 | |
428 for (i = 0; args[i]; i++) { | |
429 asv[i + 1] = newSVpvn((char *) args[i]->data, args[i]->len); | |
430 } | |
431 | |
432 } else { | |
433 asv = NULL; | |
434 } | |
435 | |
436 rc = ngx_http_perl_call_handler(aTHX_ r, pmcf->nginx, sv, asv, handler, | |
437 NULL); | |
422 | 438 |
423 SvREFCNT_dec(sv); | 439 SvREFCNT_dec(sv); |
424 | 440 |
425 } | 441 } |
426 | 442 |
627 } | 643 } |
628 | 644 |
629 | 645 |
630 static ngx_int_t | 646 static ngx_int_t |
631 ngx_http_perl_call_handler(pTHX_ ngx_http_request_t *r, HV *nginx, SV *sub, | 647 ngx_http_perl_call_handler(pTHX_ ngx_http_request_t *r, HV *nginx, SV *sub, |
632 ngx_str_t **args, ngx_str_t *handler, ngx_str_t *rv) | 648 SV **args, ngx_str_t *handler, ngx_str_t *rv) |
633 { | 649 { |
634 SV *sv; | 650 SV *sv; |
635 int n, status; | 651 int n, status; |
636 char *line; | 652 char *line; |
637 STRLEN len, n_a; | 653 STRLEN len, n_a; |
650 | 666 |
651 sv = sv_2mortal(sv_bless(newRV_noinc(newSViv(PTR2IV(r))), nginx)); | 667 sv = sv_2mortal(sv_bless(newRV_noinc(newSViv(PTR2IV(r))), nginx)); |
652 XPUSHs(sv); | 668 XPUSHs(sv); |
653 | 669 |
654 if (args) { | 670 if (args) { |
655 for (i = 0; args[i]; i++) { /* void */ } | 671 EXTEND(sp, (int) args[0]); |
656 | 672 |
657 EXTEND(sp, (int) i); | 673 for (i = 1; i <= (ngx_uint_t) args[0]; i++) { |
658 | 674 PUSHs(sv_2mortal(args[i])); |
659 for (i = 0; args[i]; i++) { | |
660 PUSHs(sv_2mortal(newSVpvn((char *) args[i]->data, args[i]->len))); | |
661 } | 675 } |
662 } | 676 } |
663 | 677 |
664 PUTBACK; | 678 PUTBACK; |
665 | 679 |