Welcome! Log In Create A New Profile

Advanced

[nginx] svn commit: r4922 - trunk/src/http

Anonymous User
November 20, 2012 07:56PM
Author: mdounin
Date: 2012-11-21 00:55:06 +0000 (Wed, 21 Nov 2012)
New Revision: 4922
URL: http://trac.nginx.org/nginx/changeset/4922/nginx

Log:
Request body: $request_body variable generalization.

The $request_body variable was assuming there can't be more than two
buffers. While this is currently true due to request body reading
implementation details, this is not a good thing to depend on and may
change in the future.


Modified:
trunk/src/http/ngx_http_variables.c

Modified: trunk/src/http/ngx_http_variables.c
===================================================================
--- trunk/src/http/ngx_http_variables.c 2012-11-21 00:54:01 UTC (rev 4921)
+++ trunk/src/http/ngx_http_variables.c 2012-11-21 00:55:06 UTC (rev 4922)
@@ -1767,7 +1767,7 @@
{
u_char *p;
size_t len;
- ngx_buf_t *buf, *next;
+ ngx_buf_t *buf;
ngx_chain_t *cl;

if (r->request_body == NULL
@@ -1792,18 +1792,26 @@
return NGX_OK;
}

- next = cl->next->buf;
- len = (buf->last - buf->pos) + (next->last - next->pos);
+ 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 NGX_ERROR;
}

v->data = p;
+ cl = r->request_body->bufs;

- p = ngx_cpymem(p, buf->pos, buf->last - buf->pos);
- ngx_memcpy(p, next->pos, next->last - next->pos);
+ for ( /* void */ ; cl; cl = cl->next) {
+ buf = cl->buf;
+ p = ngx_cpymem(p, buf->pos, buf->last - buf->pos);
+ }

v->len = len;
v->valid = 1;

_______________________________________________
nginx-devel mailing list
nginx-devel@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx-devel
Subject Author Views Posted

[nginx] svn commit: r4922 - trunk/src/http

Anonymous User 608 November 20, 2012 07:56PM



Sorry, you do not have permission to post/reply in this forum.

Online Users

Guests: 284
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready