nginx-0.3.36-RELEASE import

    *) Feature: the ngx_http_addition_filter_module.

    *) Feature: the "proxy_pass" and "fastcgi_pass" directives may be used
       inside the "if" block.

    *) Feature: the "proxy_ignore_client_abort" and
       "fastcgi_ignore_client_abort" directives.

    *) Feature: the "$request_completion" variable.

    *) Feature: the ngx_http_perl_module supports the $r->request_method
       and $r->remote_addr.

    *) Feature: the ngx_http_ssi_module supports the "elif" command.

    *) Bugfix: the "\/" string in the expression of the "if" command of the
       ngx_http_ssi_module was treated incorrectly.

    *) Bugfix: in the regular expressions in the "if" command of the
       ngx_http_ssi_module.

    *) Bugfix: if the relative path was specified in the
       "client_body_temp_path", "proxy_temp_path", "fastcgi_temp_path", and
       "perl_modules" directives, then the directory was used relatively to
       a current path but not to a server prefix.
diff --git a/src/http/modules/perl/nginx.xs b/src/http/modules/perl/nginx.xs
index 4d57bb6..d0453ea 100644
--- a/src/http/modules/perl/nginx.xs
+++ b/src/http/modules/perl/nginx.xs
@@ -178,6 +178,35 @@
 
 
 char *
+request_method(r)
+    nginx  r
+
+    CODE:
+
+    RETVAL = ngx_palloc(r->pool, r->method_name.len + 1);
+    if (RETVAL == NULL) {
+        XSRETURN_UNDEF;
+    }
+
+    ngx_cpystrn((u_char *) RETVAL, r->method_name.data, r->method_name.len + 1);
+
+    OUTPUT:
+    RETVAL
+
+
+char *
+remote_addr(r)
+    nginx  r
+
+    CODE:
+
+    RETVAL = (char *) r->connection->addr_text.data;
+
+    OUTPUT:
+    RETVAL
+
+
+char *
 header_in(r, key)
     nginx             r
     SV               *key
diff --git a/src/http/modules/perl/ngx_http_perl_module.c b/src/http/modules/perl/ngx_http_perl_module.c
index 0bcad5c..e453dc3 100644
--- a/src/http/modules/perl/ngx_http_perl_module.c
+++ b/src/http/modules/perl/ngx_http_perl_module.c
@@ -39,6 +39,7 @@
     ngx_http_ssi_ctx_t *ssi_ctx, ngx_str_t **params);
 #endif
 
+static void ngx_http_perl_handle_request(ngx_http_request_t *r);
 static ngx_int_t
     ngx_http_perl_get_interpreter(ngx_http_perl_main_conf_t *pmcf,
     PerlInterpreter **perl, ngx_log_t *log);
@@ -174,23 +175,39 @@
 static ngx_int_t
 ngx_http_perl_handler(ngx_http_request_t *r)
 {
-    ngx_int_t                   rc;
-    ngx_str_t                   uri, args;
-    ngx_http_perl_ctx_t        *ctx;
-    ngx_http_perl_loc_conf_t   *plcf;
-    ngx_http_perl_main_conf_t  *pmcf;
+    ngx_int_t  rc;
 
     /* TODO: Win32 */
     if (r->zero_in_uri) {
         return NGX_HTTP_NOT_FOUND;
     }
 
+    rc = ngx_http_read_client_request_body(r, ngx_http_perl_handle_request);
+
+    if (rc >= NGX_HTTP_SPECIAL_RESPONSE) {
+        return rc;
+    }
+
+    return NGX_DONE;
+}
+
+
+static void
+ngx_http_perl_handle_request(ngx_http_request_t *r)
+{
+    ngx_int_t                   rc;
+    ngx_str_t                   uri, args;
+    ngx_http_perl_ctx_t        *ctx;
+    ngx_http_perl_loc_conf_t   *plcf;
+    ngx_http_perl_main_conf_t  *pmcf;
+
     ngx_log_debug0(NGX_LOG_DEBUG_HTTP, r->connection->log, 0, "perl handler");
 
     /* mod_perl's content handler assumes that content type was already set */
 
     if (ngx_http_set_content_type(r) != NGX_OK) {
-        return NGX_HTTP_INTERNAL_SERVER_ERROR;
+        ngx_http_finalize_request(r, NGX_HTTP_INTERNAL_SERVER_ERROR);
+        return;
     }
 
     ctx = ngx_http_get_module_ctx(r, ngx_http_perl_module);
@@ -198,7 +215,8 @@
     if (ctx == NULL) {
         ctx = ngx_pcalloc(r->pool, sizeof(ngx_http_perl_ctx_t));
         if (ctx == NULL) {
-            return NGX_ERROR;
+            ngx_http_finalize_request(r, NGX_HTTP_INTERNAL_SERVER_ERROR);
+	    return;
         }
 
         ngx_http_set_ctx(r, ctx, ngx_http_perl_module);
@@ -209,7 +227,8 @@
     rc = ngx_http_perl_get_interpreter(pmcf, &ctx->perl, r->connection->log);
 
     if (rc != NGX_OK) {
-        return rc;
+        ngx_http_finalize_request(r, rc);
+        return;
     }
 
     {
@@ -235,20 +254,24 @@
     if (ctx->redirect_uri.len) {
         uri = ctx->redirect_uri;
         args = ctx->redirect_args;
+
+    } else {
+        uri.len = 0;
     }
 
     ctx->filename = NULL;
     ctx->redirect_uri.len = 0;
 
     if (uri.len) {
-        return ngx_http_internal_redirect(r, &uri, &args);
+        ngx_http_internal_redirect(r, &uri, &args);
+        return;
     }
 
     if (rc == NGX_OK || rc == NGX_HTTP_OK) {
-        return ngx_http_send_special(r, NGX_HTTP_LAST);
+        ngx_http_send_special(r, NGX_HTTP_LAST);
     }
 
-    return rc;
+    ngx_http_finalize_request(r, rc);
 }
 
 
@@ -448,6 +471,10 @@
     }
 #endif
 
+    if (ngx_conf_full_name(cf->cycle, &pmcf->modules) != NGX_OK) {
+        return NGX_CONF_ERROR;
+    }
+
     PERL_SYS_INIT(&ngx_argc, &ngx_argv);
 
     pmcf->perl = ngx_http_perl_create_interpreter(pmcf, cf->log);