comparison src/http/modules/perl/ngx_http_perl_module.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 10cc350ed8a1
children babd3d9efb62
comparison
equal deleted inserted replaced
355:3ac45897a61c 356:b743d290eb3b
228 rc = ngx_http_perl_call_handler(aTHX_ r, pmcf->nginx, sub, NULL, handler, 228 rc = ngx_http_perl_call_handler(aTHX_ r, pmcf->nginx, sub, NULL, handler,
229 NULL); 229 NULL);
230 230
231 } 231 }
232 232
233 if (rc == NGX_DONE) {
234 return;
235 }
236
233 if (rc > 600) { 237 if (rc > 600) {
234 rc = NGX_OK; 238 rc = NGX_OK;
235 } 239 }
236 240
237 ngx_log_debug1(NGX_LOG_DEBUG_HTTP, r->connection->log, 0, 241 ngx_log_debug1(NGX_LOG_DEBUG_HTTP, r->connection->log, 0,
625 629
626 static ngx_int_t 630 static ngx_int_t
627 ngx_http_perl_call_handler(pTHX_ ngx_http_request_t *r, HV *nginx, SV *sub, 631 ngx_http_perl_call_handler(pTHX_ ngx_http_request_t *r, HV *nginx, SV *sub,
628 ngx_str_t **args, ngx_str_t *handler, ngx_str_t *rv) 632 ngx_str_t **args, ngx_str_t *handler, ngx_str_t *rv)
629 { 633 {
630 SV *sv; 634 SV *sv;
631 int n, status; 635 int n, status;
632 char *line; 636 char *line;
633 STRLEN len, n_a; 637 STRLEN len, n_a;
634 ngx_str_t err; 638 ngx_str_t err;
635 ngx_uint_t i; 639 ngx_uint_t i;
640 ngx_connection_t *c;
636 641
637 dSP; 642 dSP;
638 643
639 status = 0; 644 status = 0;
640 645
656 } 661 }
657 } 662 }
658 663
659 PUTBACK; 664 PUTBACK;
660 665
666 c = r->connection;
667
661 n = call_sv(sub, G_EVAL); 668 n = call_sv(sub, G_EVAL);
662 669
663 SPAGAIN; 670 SPAGAIN;
671
672 if (c->destroyed) {
673 PUTBACK;
674
675 FREETMPS;
676 LEAVE;
677
678 return NGX_DONE;
679 }
664 680
665 if (n) { 681 if (n) {
666 if (rv == NULL) { 682 if (rv == NULL) {
667 status = POPi; 683 status = POPi;
668 684
669 ngx_log_debug1(NGX_LOG_DEBUG_HTTP, r->connection->log, 0, 685 ngx_log_debug1(NGX_LOG_DEBUG_HTTP, c->log, 0,
670 "call_sv: %d", status); 686 "call_sv: %d", status);
671 687
672 } else { 688 } else {
673 line = SvPVx(POPs, n_a); 689 line = SvPVx(POPs, n_a);
674 rv->len = n_a; 690 rv->len = n_a;
695 for (len--; err.data[len] == LF || err.data[len] == CR; len--) { 711 for (len--; err.data[len] == LF || err.data[len] == CR; len--) {
696 /* void */ 712 /* void */
697 } 713 }
698 err.len = len + 1; 714 err.len = len + 1;
699 715
700 ngx_log_error(NGX_LOG_ERR, r->connection->log, 0, 716 ngx_log_error(NGX_LOG_ERR, c->log, 0,
701 "call_sv(\"%V\") failed: \"%V\"", 717 "call_sv(\"%V\") failed: \"%V\"", handler, &err);
702 handler, &err);
703 718
704 if (rv) { 719 if (rv) {
705 return NGX_ERROR; 720 return NGX_ERROR;
706 } 721 }
707 722
708 return NGX_HTTP_INTERNAL_SERVER_ERROR; 723 return NGX_HTTP_INTERNAL_SERVER_ERROR;
709 } 724 }
710 725
711 if (n != 1) { 726 if (n != 1) {
712 ngx_log_error(NGX_LOG_ALERT, r->connection->log, 0, 727 ngx_log_error(NGX_LOG_ALERT, c->log, 0,
713 "call_sv(\"%V\") returned %d results", handler, n); 728 "call_sv(\"%V\") returned %d results", handler, n);
714 status = NGX_OK; 729 status = NGX_OK;
715 } 730 }
716 731
717 if (rv) { 732 if (rv) {