Mercurial > hg > nginx-vendor-current
diff src/http/ngx_http_request_body.c @ 212:56688ed172c8 NGINX_0_3_53
nginx 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.
author | Igor Sysoev <http://sysoev.ru> |
---|---|
date | Fri, 07 Jul 2006 00:00:00 +0400 |
parents | 54aabf2b0bc6 |
children | 0ad9eeb6ac7f |
line wrap: on
line diff
--- 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_ht /* 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_ht 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 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->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 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_re 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);