From 5063f4f8d14340a204cb2e1d93787cf3b6fb7e96 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?agentzh=20=28=E7=AB=A0=E4=BA=A6=E6=98=A5=29?= Date: Fri, 21 Oct 2011 17:53:28 +0800 Subject: [PATCH] oops! forgot to check in patches/nginx-1.0.8-allow_request_body_updating.patch. --- ...nx-1.0.8-allow_request_body_updating.patch | 86 +++++++++++++++++++ 1 file changed, 86 insertions(+) create mode 100644 patches/nginx-1.0.8-allow_request_body_updating.patch diff --git a/patches/nginx-1.0.8-allow_request_body_updating.patch b/patches/nginx-1.0.8-allow_request_body_updating.patch new file mode 100644 index 0000000..a0fe9e0 --- /dev/null +++ b/patches/nginx-1.0.8-allow_request_body_updating.patch @@ -0,0 +1,86 @@ +diff -ru nginx-1.0.8/src/http/ngx_http_request_body.c nginx-1.0.8-patched/src/http/ngx_http_request_body.c +--- nginx-1.0.8/src/http/ngx_http_request_body.c 2011-09-30 22:36:19.000000000 +0800 ++++ nginx-1.0.8-patched/src/http/ngx_http_request_body.c 2011-10-21 17:32:45.018613625 +0800 +@@ -440,7 +440,7 @@ + ssize_t size; + ngx_event_t *rev; + +- if (r != r->main || r->discard_body) { ++ if (r != r->main || r->discard_body || r->content_length_n) { + return NGX_OK; + } + +@@ -456,20 +456,22 @@ + ngx_del_timer(rev); + } + +- if (r->headers_in.content_length_n <= 0 || r->request_body) { ++ r->content_length_n = r->headers_in.content_length_n; ++ ++ if (r->content_length_n <= 0 || r->request_body) { + return NGX_OK; + } + + size = r->header_in->last - r->header_in->pos; + + if (size) { +- if (r->headers_in.content_length_n > size) { ++ if (r->content_length_n > size) { + r->header_in->pos += size; +- r->headers_in.content_length_n -= size; ++ r->content_length_n -= size; + + } else { +- r->header_in->pos += (size_t) r->headers_in.content_length_n; +- r->headers_in.content_length_n = 0; ++ r->header_in->pos += (size_t) r->content_length_n; ++ r->content_length_n = 0; + return NGX_OK; + } + } +@@ -568,7 +570,7 @@ + "http read discarded body"); + + for ( ;; ) { +- if (r->headers_in.content_length_n == 0) { ++ if (r->content_length_n == 0) { + r->read_event_handler = ngx_http_block_reading; + return NGX_OK; + } +@@ -577,9 +579,9 @@ + return NGX_AGAIN; + } + +- size = (r->headers_in.content_length_n > NGX_HTTP_DISCARD_BUFFER_SIZE) ? ++ size = (r->content_length_n > NGX_HTTP_DISCARD_BUFFER_SIZE) ? + NGX_HTTP_DISCARD_BUFFER_SIZE: +- (size_t) r->headers_in.content_length_n; ++ (size_t) r->content_length_n; + + n = r->connection->recv(r->connection, buffer, size); + +@@ -596,7 +598,7 @@ + return NGX_OK; + } + +- r->headers_in.content_length_n -= n; ++ r->content_length_n -= n; + } + } + +Only in nginx-1.0.8-patched/src/http: ngx_http_request_body.c~ +diff -ru nginx-1.0.8/src/http/ngx_http_request.h nginx-1.0.8-patched/src/http/ngx_http_request.h +--- nginx-1.0.8/src/http/ngx_http_request.h 2011-08-29 18:39:23.000000000 +0800 ++++ nginx-1.0.8-patched/src/http/ngx_http_request.h 2011-10-21 17:26:13.203807584 +0800 +@@ -366,6 +366,9 @@ + ngx_pool_t *pool; + ngx_buf_t *header_in; + ++ off_t content_length_n; ++ /* for discarding request body */ ++ + ngx_http_headers_in_t headers_in; + ngx_http_headers_out_t headers_out; + +Only in nginx-1.0.8-patched/src/http: ngx_http_request.h~ +Only in nginx-1.0.8-patched/src/http: tags