Mercurial > hg > nginx-quic
comparison 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 |
comparison
equal
deleted
inserted
replaced
4117:103b0d9afe07 | 4118:dbddec65fdab |
---|---|
1940 r->headers_out.status = u->headers_in.status_n; | 1940 r->headers_out.status = u->headers_in.status_n; |
1941 r->headers_out.status_line = u->headers_in.status_line; | 1941 r->headers_out.status_line = u->headers_in.status_line; |
1942 | 1942 |
1943 r->headers_out.content_length_n = u->headers_in.content_length_n; | 1943 r->headers_out.content_length_n = u->headers_in.content_length_n; |
1944 | 1944 |
1945 if (u->headers_in.content_length_n != -1) { | 1945 u->length = u->headers_in.content_length_n; |
1946 u->length = (size_t) u->headers_in.content_length_n; | |
1947 | |
1948 } else { | |
1949 u->length = NGX_MAX_SIZE_T_VALUE; | |
1950 } | |
1951 | 1946 |
1952 return NGX_OK; | 1947 return NGX_OK; |
1953 } | 1948 } |
1954 | 1949 |
1955 | 1950 |
2417 } | 2412 } |
2418 } | 2413 } |
2419 | 2414 |
2420 size = b->end - b->last; | 2415 size = b->end - b->last; |
2421 | 2416 |
2422 if (size > u->length) { | |
2423 size = u->length; | |
2424 } | |
2425 | |
2426 if (size && upstream->read->ready) { | 2417 if (size && upstream->read->ready) { |
2427 | 2418 |
2428 n = upstream->recv(upstream, b->last, size); | 2419 n = upstream->recv(upstream, b->last, size); |
2429 | 2420 |
2430 if (n == NGX_AGAIN) { | 2421 if (n == NGX_AGAIN) { |
2517 cl->buf->pos = b->last; | 2508 cl->buf->pos = b->last; |
2518 b->last += bytes; | 2509 b->last += bytes; |
2519 cl->buf->last = b->last; | 2510 cl->buf->last = b->last; |
2520 cl->buf->tag = u->output.tag; | 2511 cl->buf->tag = u->output.tag; |
2521 | 2512 |
2522 if (u->length == NGX_MAX_SIZE_T_VALUE) { | 2513 if (u->length == -1) { |
2523 return NGX_OK; | 2514 return NGX_OK; |
2524 } | 2515 } |
2525 | 2516 |
2526 u->length -= bytes; | 2517 u->length -= bytes; |
2527 | 2518 |