summaryrefslogtreecommitdiffstats
path: root/usr.sbin/nginx/src/http/modules/perl
diff options
context:
space:
mode:
Diffstat (limited to 'usr.sbin/nginx/src/http/modules/perl')
-rw-r--r--usr.sbin/nginx/src/http/modules/perl/Makefile.PL6
-rw-r--r--usr.sbin/nginx/src/http/modules/perl/nginx.pm2
-rw-r--r--usr.sbin/nginx/src/http/modules/perl/nginx.xs39
3 files changed, 41 insertions, 6 deletions
diff --git a/usr.sbin/nginx/src/http/modules/perl/Makefile.PL b/usr.sbin/nginx/src/http/modules/perl/Makefile.PL
index 78a1e516bf7..03348b555fc 100644
--- a/usr.sbin/nginx/src/http/modules/perl/Makefile.PL
+++ b/usr.sbin/nginx/src/http/modules/perl/Makefile.PL
@@ -21,8 +21,10 @@ WriteMakefile(
} (split /\s+/, $ENV{NGX_INCS})),
depend => {
- 'nginx.c' =>
- "../../../../../src/http/modules/perl/ngx_http_perl_module.h"
+ 'nginx.c' => join(" ", map {
+ m#^/# ? $_ : "../../../../../$_"
+ } (split(/\s+/, $ENV{NGX_DEPS}),
+ "src/http/modules/perl/ngx_http_perl_module.h"))
},
PM => {
diff --git a/usr.sbin/nginx/src/http/modules/perl/nginx.pm b/usr.sbin/nginx/src/http/modules/perl/nginx.pm
index 32684feac89..e3f73611025 100644
--- a/usr.sbin/nginx/src/http/modules/perl/nginx.pm
+++ b/usr.sbin/nginx/src/http/modules/perl/nginx.pm
@@ -50,7 +50,7 @@ our @EXPORT = qw(
HTTP_INSUFFICIENT_STORAGE
);
-our $VERSION = '1.2.9';
+our $VERSION = '%%VERSION%%';
require XSLoader;
XSLoader::load('nginx', $VERSION);
diff --git a/usr.sbin/nginx/src/http/modules/perl/nginx.xs b/usr.sbin/nginx/src/http/modules/perl/nginx.xs
index ed974391163..bbfef079c23 100644
--- a/usr.sbin/nginx/src/http/modules/perl/nginx.xs
+++ b/usr.sbin/nginx/src/http/modules/perl/nginx.xs
@@ -357,7 +357,7 @@ has_request_body(r, next)
ngx_http_perl_set_request(r);
- if (r->headers_in.content_length_n <= 0) {
+ if (r->headers_in.content_length_n <= 0 && !r->headers_in.chunked) {
XSRETURN_UNDEF;
}
@@ -386,7 +386,10 @@ request_body(r)
dXSTARG;
ngx_http_request_t *r;
+ u_char *p, *data;
size_t len;
+ ngx_buf_t *buf;
+ ngx_chain_t *cl;
ngx_http_perl_set_request(r);
@@ -397,13 +400,43 @@ request_body(r)
XSRETURN_UNDEF;
}
- len = r->request_body->bufs->buf->last - r->request_body->bufs->buf->pos;
+ cl = r->request_body->bufs;
+ buf = cl->buf;
+
+ if (cl->next == NULL) {
+ len = buf->last - buf->pos;
+ data = buf->pos;
+ goto done;
+ }
+
+ len = buf->last - buf->pos;
+ cl = cl->next;
+
+ for ( /* void */ ; cl; cl = cl->next) {
+ buf = cl->buf;
+ len += buf->last - buf->pos;
+ }
+
+ p = ngx_pnalloc(r->pool, len);
+ if (p == NULL) {
+ return XSRETURN_UNDEF;
+ }
+
+ data = p;
+ cl = r->request_body->bufs;
+
+ for ( /* void */ ; cl; cl = cl->next) {
+ buf = cl->buf;
+ p = ngx_cpymem(p, buf->pos, buf->last - buf->pos);
+ }
+
+ done:
if (len == 0) {
XSRETURN_UNDEF;
}
- ngx_http_perl_set_targ(r->request_body->bufs->buf->pos, len);
+ ngx_http_perl_set_targ(data, len);
ST(0) = TARG;