diff src/http/modules/perl/ngx_http_perl_module.c @ 182:13710a1813ad NGINX_0_3_38

nginx 0.3.38 *) Feature: the ngx_http_dav_module. *) Change: the ngx_http_perl_module optimizations. Thanks to Sergey Skvortsov. *) Feature: the ngx_http_perl_module supports the $r->request_body_file method. *) Feature: the "client_body_in_file_only" directive. *) Workaround: now on disk overflow nginx tries to write access logs once a second only. Thanks to Anton Yuzhaninov and Maxim Dounin. *) Bugfix: now the "limit_rate" directive more precisely limits rate if rate is more than 100 Kbyte/s. Thanks to ForJest. *) Bugfix: now the IMAP/POP3 proxy escapes the "\r" and "\n" symbols in login and password to pass authorization server. Thanks to Maxim Dounin.
author Igor Sysoev <http://sysoev.ru>
date Fri, 14 Apr 2006 00:00:00 +0400
parents 87699398f955
children 71ff1e2b484a
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
@@ -165,10 +165,14 @@ static ngx_http_ssi_command_t  ngx_http_
 #endif
 
 
+static HV  *nginx_stash;
+
 static void
 ngx_http_perl_xs_init(pTHX)
 {
     newXS("DynaLoader::boot_DynaLoader", boot_DynaLoader, __FILE__);
+
+    nginx_stash = gv_stashpv("nginx", TRUE);
 }
 
 
@@ -182,6 +186,9 @@ ngx_http_perl_handler(ngx_http_request_t
         return NGX_HTTP_NOT_FOUND;
     }
 
+    r->request_body_in_single_buf = 1;
+    r->request_body_in_persistent_file = 1;
+
     rc = ngx_http_read_client_request_body(r, ngx_http_perl_handle_request);
 
     if (rc >= NGX_HTTP_SPECIAL_RESPONSE) {
@@ -259,7 +266,7 @@ ngx_http_perl_handle_request(ngx_http_re
         uri.len = 0;
     }
 
-    ctx->filename = NULL;
+    ctx->filename.data = NULL;
     ctx->redirect_uri.len = 0;
 
     if (uri.len) {
@@ -332,7 +339,7 @@ ngx_http_perl_variable(ngx_http_request_
         v->not_found = 1;
     }
 
-    ctx->filename = NULL;
+    ctx->filename.data = NULL;
     ctx->redirect_uri.len = 0;
 
     return rc;
@@ -409,7 +416,7 @@ ngx_http_perl_ssi(ngx_http_request_t *r,
 
     ngx_http_perl_free_interpreter(pmcf, ctx->perl);
 
-    ctx->filename = NULL;
+    ctx->filename.data = NULL;
     ctx->redirect_uri.len = 0;
     ctx->ssi = NULL;
 
@@ -631,8 +638,7 @@ ngx_http_perl_call_handler(pTHX_ ngx_htt
 
     PUSHMARK(sp);
 
-    sv = sv_newmortal();
-    sv_setref_pv(sv, "nginx", r);
+    sv = sv_2mortal(sv_bless(newRV_noinc(newSViv(PTR2IV(r))), nginx_stash));
     XPUSHs(sv);
 
     if (args) {