]> git.kaiwu.me - nginx.git/commitdiff
memcached response was stored in variable with END
authorIgor Sysoev <igor@sysoev.ru>
Wed, 12 Nov 2008 21:01:01 +0000 (21:01 +0000)
committerIgor Sysoev <igor@sysoev.ru>
Wed, 12 Nov 2008 21:01:01 +0000 (21:01 +0000)
src/http/ngx_http_upstream.c

index c3fc8612cde2120a1a97a0e5706f4b24755d948b..31468fc7ad5658a5d4725c23a943ccb811929e20 100644 (file)
@@ -1337,14 +1337,20 @@ ngx_http_upstream_process_header(ngx_event_t *rev)
         return;
     }
 
-    if (u->buffer.last - u->buffer.pos >= (ssize_t) u->length) {
-        if (u->input_filter(u->input_filter_ctx, 0) == NGX_ERROR) {
+    n = u->buffer.last - u->buffer.pos;
+
+    if (n) {
+        u->buffer.last -= n;
+
+        if (u->input_filter(u->input_filter_ctx, n) == NGX_ERROR) {
             ngx_http_upstream_finalize_request(r, u, NGX_ERROR);
             return;
         }
 
-        ngx_http_upstream_finalize_request(r, u, 0);
-        return;
+        if (u->length == 0) {
+            ngx_http_upstream_finalize_request(r, u, 0);
+            return;
+        }
     }
 
     rev->handler = ngx_http_upstream_process_body_in_memory;