summaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authorMaxim Dounin <mdounin@mdounin.ru>2011-09-15 18:43:19 +0000
committerMaxim Dounin <mdounin@mdounin.ru>2011-09-15 18:43:19 +0000
commitffe4f114173468e2eb205448820c66af0863a9db (patch)
tree4ab6c65844bd30b259d14b70931dc0b3b5f77d9b /src
parente19f005daf634f15540c5747dd3689a00719f0f9 (diff)
downloadnginx-ffe4f114173468e2eb205448820c66af0863a9db.tar.gz
nginx-ffe4f114173468e2eb205448820c66af0863a9db.tar.bz2
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.
Diffstat (limited to 'src')
-rw-r--r--src/http/modules/ngx_http_memcached_module.c2
-rw-r--r--src/http/ngx_http_upstream.c13
-rw-r--r--src/http/ngx_http_upstream.h2
3 files changed, 4 insertions, 13 deletions
diff --git a/src/http/modules/ngx_http_memcached_module.c b/src/http/modules/ngx_http_memcached_module.c
index beafb6af8..cdc586964 100644
--- a/src/http/modules/ngx_http_memcached_module.c
+++ b/src/http/modules/ngx_http_memcached_module.c
@@ -407,7 +407,7 @@ ngx_http_memcached_filter(void *data, ssize_t bytes)
u = ctx->request->upstream;
b = &u->buffer;
- if (u->length == ctx->rest) {
+ if (u->length == (ssize_t) ctx->rest) {
if (ngx_strncmp(b->last,
ngx_http_memcached_end + NGX_HTTP_MEMCACHED_END - ctx->rest,
diff --git a/src/http/ngx_http_upstream.c b/src/http/ngx_http_upstream.c
index faf69ecd4..f3730a063 100644
--- a/src/http/ngx_http_upstream.c
+++ b/src/http/ngx_http_upstream.c
@@ -1942,12 +1942,7 @@ ngx_http_upstream_process_headers(ngx_http_request_t *r, ngx_http_upstream_t *u)
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_request(ngx_http_request_t *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(void *data, ssize_t bytes)
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;
}
diff --git a/src/http/ngx_http_upstream.h b/src/http/ngx_http_upstream.h
index fa848c0d3..c3f706e14 100644
--- a/src/http/ngx_http_upstream.h
+++ b/src/http/ngx_http_upstream.h
@@ -267,7 +267,7 @@ struct ngx_http_upstream_s {
ngx_http_upstream_resolved_t *resolved;
ngx_buf_t buffer;
- size_t length;
+ off_t length;
ngx_chain_t *out_bufs;
ngx_chain_t *busy_bufs;