]> git.kaiwu.me - nginx.git/commitdiff
fix handling cached HTTP/0.9 response
authorIgor Sysoev <igor@sysoev.ru>
Sun, 29 Nov 2009 20:48:01 +0000 (20:48 +0000)
committerIgor Sysoev <igor@sysoev.ru>
Sun, 29 Nov 2009 20:48:01 +0000 (20:48 +0000)
src/http/ngx_http_file_cache.c
src/http/ngx_http_upstream.c

index 431b1e52b233a13c5b2120422f4f266f059919a7..4290c9f868820bbfe0b091d64d28cc3d797e5a2b 100644 (file)
@@ -338,7 +338,7 @@ ngx_http_file_cache_read(ngx_http_request_t *r, ngx_http_cache_t *c)
         return n;
     }
 
-    if ((size_t) n <= c->header_start) {
+    if ((size_t) n < c->header_start) {
         ngx_log_error(NGX_LOG_CRIT, r->connection->log, 0,
                       "cache file \"%s\" is too small", c->file.name.data);
         return NGX_ERROR;
index b82bfa97ba1624d9349bb5a8e35c004ea62ab24f..9f1a8975357ab9dcbf3f3eb31a4f215193b56d16 100644 (file)
@@ -752,6 +752,11 @@ ngx_http_upstream_cache_send(ngx_http_request_t *r, ngx_http_upstream_t *u)
     r->cached = 1;
     c = r->cache;
 
+    if (c->header_start == c->body_start) {
+        r->http_version = NGX_HTTP_VERSION_9;
+        return ngx_http_cache_send(r);
+    }
+
     /* TODO: cache stack */
 
     u->buffer = *c->buf;