aboutsummaryrefslogtreecommitdiff
path: root/src/http/ngx_http_request_body.c
diff options
context:
space:
mode:
authorIgor Sysoev <igor@sysoev.ru>2006-07-07 16:33:19 +0000
committerIgor Sysoev <igor@sysoev.ru>2006-07-07 16:33:19 +0000
commit1765f475445a054994611d2053cc181fb3504615 (patch)
treea816e7cada7b3bec35e866ee9b22f78bda6c5af8 /src/http/ngx_http_request_body.c
parentb798d507122449c1baa85b1de47eec31cc0487a6 (diff)
downloadnginx-release-0.3.53.tar.gz
nginx-release-0.3.53.zip
nginx-0.3.53-RELEASE importrelease-0.3.53
*) Change: the "add_header" directive adds the string to 204, 301, and 302 responses. *) Feature: the "server" directive in the "upstream" context supports the "weight" parameter. *) Feature: the "server_name" directive supports the "*" wildcard. *) Feature: nginx supports the request body size more than 2G. *) Bugfix: if a client was successfully authorized using "satisfy_any on", then anyway the message "access forbidden by rule" was written in the log. *) Bugfix: the "PUT" method may erroneously not create a file and return the 409 code. *) Bugfix: if the IMAP/POP3 backend returned an error, then nginx continued proxying anyway.
Diffstat (limited to 'src/http/ngx_http_request_body.c')
-rw-r--r--src/http/ngx_http_request_body.c25
1 files changed, 12 insertions, 13 deletions
diff --git a/src/http/ngx_http_request_body.c b/src/http/ngx_http_request_body.c
index 605c8ad52..c6fa3fc09 100644
--- a/src/http/ngx_http_request_body.c
+++ b/src/http/ngx_http_request_body.c
@@ -30,7 +30,8 @@ ngx_int_t
ngx_http_read_client_request_body(ngx_http_request_t *r,
ngx_http_client_body_handler_pt post_handler)
{
- ssize_t size, preread;
+ size_t preread;
+ ssize_t size;
ngx_buf_t *b;
ngx_chain_t *cl, **next;
ngx_http_request_body_t *rb;
@@ -95,7 +96,7 @@ ngx_http_read_client_request_body(ngx_http_request_t *r,
/* the whole request body was pre-read */
- r->header_in->pos += r->headers_in.content_length_n;
+ r->header_in->pos += (size_t) r->headers_in.content_length_n;
r->request_length += r->headers_in.content_length_n;
if (r->request_body_in_file_only) {
@@ -143,8 +144,8 @@ ngx_http_read_client_request_body(ngx_http_request_t *r,
size = clcf->client_body_buffer_size;
size += size >> 2;
- if (rb->rest < (size_t) size) {
- size = rb->rest;
+ if (rb->rest < size) {
+ size = (ssize_t) rb->rest;
if (r->request_body_in_single_buf) {
size += preread;
@@ -242,7 +243,7 @@ ngx_http_do_read_client_request_body(ngx_http_request_t *r)
size = rb->buf->end - rb->buf->last;
if (size > rb->rest) {
- size = rb->rest;
+ size = (size_t) rb->rest;
}
n = c->recv(c, rb->buf->last, size);
@@ -429,7 +430,7 @@ ngx_http_discard_body(ngx_http_request_t *r)
r->headers_in.content_length_n -= size;
} else {
- r->header_in->pos += r->headers_in.content_length_n;
+ r->header_in->pos += (size_t) r->headers_in.content_length_n;
r->headers_in.content_length_n = 0;
return NGX_OK;
}
@@ -468,7 +469,8 @@ ngx_http_read_discarded_body_handler(ngx_http_request_t *r)
static ngx_int_t
ngx_http_read_discarded_body(ngx_http_request_t *r)
{
- ssize_t size, n;
+ size_t size;
+ ssize_t n;
u_char buffer[NGX_HTTP_DISCARD_BUFFER_SIZE];
ngx_log_debug0(NGX_LOG_DEBUG_HTTP, r->connection->log, 0,
@@ -478,12 +480,9 @@ ngx_http_read_discarded_body(ngx_http_request_t *r)
return NGX_OK;
}
-
- size = r->headers_in.content_length_n;
-
- if (size > NGX_HTTP_DISCARD_BUFFER_SIZE) {
- size = NGX_HTTP_DISCARD_BUFFER_SIZE;
- }
+ size = (r->headers_in.content_length_n > NGX_HTTP_DISCARD_BUFFER_SIZE) ?
+ NGX_HTTP_DISCARD_BUFFER_SIZE:
+ (size_t) r->headers_in.content_length_n;
n = r->connection->recv(r->connection, buffer, size);