]> git.kaiwu.me - nginx.git/commitdiff
Merge of r4461: upstream: fixed "too big header" check.
authorMaxim Dounin <mdounin@mdounin.ru>
Mon, 5 Mar 2012 12:15:02 +0000 (12:15 +0000)
committerMaxim Dounin <mdounin@mdounin.ru>
Mon, 5 Mar 2012 12:15:02 +0000 (12:15 +0000)
If header filter postponed processing of a header by returning NGX_AGAIN
and not moved u->buffer->pos, previous check incorrectly assumed there
is additional space and did another recv() with zero-size buffer.  This
resulted in "upstream prematurely closed connection" error instead
of correct "upstream sent too big header" one.

Patch by Feibo Li.

src/http/ngx_http_upstream.c

index d4f50a3685e0f750150a6d8cac0ca7bb8874c57c..377e10ffb1343ec9077be2affd7003f0a216fd5d 100644 (file)
@@ -1561,7 +1561,7 @@ ngx_http_upstream_process_header(ngx_http_request_t *r, ngx_http_upstream_t *u)
 
         if (rc == NGX_AGAIN) {
 
-            if (u->buffer.pos == u->buffer.end) {
+            if (u->buffer.last == u->buffer.end) {
                 ngx_log_error(NGX_LOG_ERR, c->log, 0,
                               "upstream sent too big header");