diff src/http/ngx_http_upstream.c @ 4118:dbddec65fdab

Upstream: r->upstream->length type change to off_t. Previous use of size_t may cause wierd effects on 32bit platforms with certain big responses transferred in unbuffered mode. Nuke "if (size > u->length)" check as it's not usefull anyway (preread body data isn't subject to this check) and now requires additional check for u->length being positive.
author Maxim Dounin <mdounin@mdounin.ru>
date Thu, 15 Sep 2011 18:43:19 +0000
parents 103b0d9afe07
children b66712cde67d
line wrap: on
line diff
--- a/src/http/ngx_http_upstream.c
+++ b/src/http/ngx_http_upstream.c
@@ -1942,12 +1942,7 @@ ngx_http_upstream_process_headers(ngx_ht
 
     r->headers_out.content_length_n = u->headers_in.content_length_n;
 
-    if (u->headers_in.content_length_n != -1) {
-        u->length = (size_t) u->headers_in.content_length_n;
-
-    } else {
-        u->length = NGX_MAX_SIZE_T_VALUE;
-    }
+    u->length = u->headers_in.content_length_n;
 
     return NGX_OK;
 }
@@ -2419,10 +2414,6 @@ ngx_http_upstream_process_non_buffered_r
 
         size = b->end - b->last;
 
-        if (size > u->length) {
-            size = u->length;
-        }
-
         if (size && upstream->read->ready) {
 
             n = upstream->recv(upstream, b->last, size);
@@ -2519,7 +2510,7 @@ ngx_http_upstream_non_buffered_filter(vo
     cl->buf->last = b->last;
     cl->buf->tag = u->output.tag;
 
-    if (u->length == NGX_MAX_SIZE_T_VALUE) {
+    if (u->length == -1) {
         return NGX_OK;
     }