mirror of https://github.com/openresty/openresty
You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
129 lines
4.3 KiB
Diff
129 lines
4.3 KiB
Diff
diff '--exclude=*~' -ur nginx-1.2.1/src/http/ngx_http_core_module.c nginx-1.2.1-patched/src/http/ngx_http_core_module.c
|
|
--- nginx-1.2.1/src/http/ngx_http_core_module.c 2012-06-04 04:58:12.000000000 -0700
|
|
+++ nginx-1.2.1-patched/src/http/ngx_http_core_module.c 2012-07-21 12:09:17.468576485 -0700
|
|
@@ -2420,6 +2420,8 @@
|
|
|
|
sr->request_body = r->request_body;
|
|
|
|
+ sr->content_length_n = -1;
|
|
+
|
|
sr->method = NGX_HTTP_GET;
|
|
sr->http_version = r->http_version;
|
|
|
|
diff '--exclude=*~' -ur nginx-1.2.1/src/http/ngx_http_request_body.c nginx-1.2.1-patched/src/http/ngx_http_request_body.c
|
|
--- nginx-1.2.1/src/http/ngx_http_request_body.c 2012-04-12 12:35:41.000000000 -0700
|
|
+++ nginx-1.2.1-patched/src/http/ngx_http_request_body.c 2012-07-21 12:08:30.655376967 -0700
|
|
@@ -39,7 +39,7 @@
|
|
|
|
r->main->count++;
|
|
|
|
- if (r->request_body || r->discard_body) {
|
|
+ if (r->request_body || r->discard_body || r->content_length_n == 0) {
|
|
post_handler(r);
|
|
return NGX_OK;
|
|
}
|
|
@@ -441,7 +441,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 == 0) {
|
|
return NGX_OK;
|
|
}
|
|
|
|
@@ -457,20 +457,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;
|
|
}
|
|
}
|
|
@@ -569,7 +571,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;
|
|
}
|
|
@@ -578,9 +580,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);
|
|
|
|
@@ -597,7 +599,7 @@
|
|
return NGX_OK;
|
|
}
|
|
|
|
- r->headers_in.content_length_n -= n;
|
|
+ r->content_length_n -= n;
|
|
}
|
|
}
|
|
|
|
Only in nginx-1.2.1-patched/src/http: ngx_http_request_body.c.orig
|
|
diff '--exclude=*~' -ur nginx-1.2.1/src/http/ngx_http_request.c nginx-1.2.1-patched/src/http/ngx_http_request.c
|
|
--- nginx-1.2.1/src/http/ngx_http_request.c 2012-06-05 06:52:37.000000000 -0700
|
|
+++ nginx-1.2.1-patched/src/http/ngx_http_request.c 2012-07-21 12:08:30.656376973 -0700
|
|
@@ -287,6 +287,8 @@
|
|
|
|
r->pipeline = hc->pipeline;
|
|
|
|
+ r->content_length_n = -1;
|
|
+
|
|
if (hc->nbusy) {
|
|
r->header_in = hc->busy[0];
|
|
}
|
|
@@ -298,6 +300,8 @@
|
|
return;
|
|
}
|
|
|
|
+ r->content_length_n = -1;
|
|
+
|
|
hc->request = r;
|
|
}
|
|
|
|
Only in nginx-1.2.1-patched/src/http: ngx_http_request.c.orig
|
|
diff '--exclude=*~' -ur nginx-1.2.1/src/http/ngx_http_request.h nginx-1.2.1-patched/src/http/ngx_http_request.h
|
|
--- nginx-1.2.1/src/http/ngx_http_request.h 2012-02-28 06:54:23.000000000 -0800
|
|
+++ nginx-1.2.1-patched/src/http/ngx_http_request.h 2012-07-21 12:08:30.657376978 -0700
|
|
@@ -368,6 +368,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.2.1-patched/src/http: ngx_http_request.h.orig
|