diff src/http/modules/perl/nginx.xs @ 180:4cd3e70c4d60 NGINX_0_3_37

nginx 0.3.37 *) Feature: the "limit_except" directive. *) Feature: the "if" directive supports the "!~", "!~*", "-f", and "!-f" operators. *) Feature: the ngx_http_perl_module supports the $r->request_body method. *) Bugfix: in the ngx_http_addition_filter_module.
author Igor Sysoev <http://sysoev.ru>
date Fri, 07 Apr 2006 00:00:00 +0400
parents 87699398f955
children 13710a1813ad
line wrap: on
line diff
--- a/src/http/modules/perl/nginx.xs
+++ b/src/http/modules/perl/nginx.xs
@@ -261,6 +261,41 @@ header_in(r, key)
     RETVAL
 
 
+SV *
+request_body(r)
+    nginx         r
+
+    PREINIT:
+
+    STRLEN        len;
+    ngx_chain_t  *cl;
+
+    CODE:
+
+    len = 0;
+
+    for (cl = r->request_body->bufs; cl; cl = cl->next) {
+        if (cl->buf->in_file) {
+            XSRETURN_UNDEF;
+        }
+
+        len += cl->buf->last - cl->buf->pos;
+    }
+
+    if (len == 0) {
+        XSRETURN_UNDEF;
+    }
+
+    RETVAL = newSV(len);
+
+    for (cl = r->request_body->bufs; cl; cl = cl->next) {
+        sv_catpvn(RETVAL, cl->buf->pos, cl->buf->last - cl->buf->pos);
+    }
+
+    OUTPUT:
+    RETVAL
+
+
 int
 header_out(r, key, value)
     nginx             r