diff src/http/modules/proxy/ngx_http_proxy_upstream.c @ 174:ea464a6c0581

nginx-0.0.1-2003-11-05-01:12:39 import
author Igor Sysoev <igor@sysoev.ru>
date Tue, 04 Nov 2003 22:12:39 +0000
parents caa57ddf6d77
children e92c2c647c57
line wrap: on
line diff
--- a/src/http/modules/proxy/ngx_http_proxy_upstream.c
+++ b/src/http/modules/proxy/ngx_http_proxy_upstream.c
@@ -300,6 +300,9 @@ static void ngx_http_proxy_reinit_upstre
             p->header_in->last = p->header_in->start;
         }
     }
+
+    p->status = 0;
+    p->status_count = 0;
 }
 
 
@@ -557,6 +560,8 @@ static void ngx_http_proxy_process_upstr
         return;
     }
 
+    p->valid_header_in = 0;
+
     p->upstream->peer.cached = 0;
 
     rc = ngx_http_proxy_parse_status_line(p);
@@ -811,7 +816,7 @@ static void ngx_http_proxy_send_response
     int                           rc;
     ngx_event_pipe_t             *ep;
     ngx_http_request_t           *r;
-    ngx_http_cache_file_t        *header;
+    ngx_http_cache_header_t      *header;
     ngx_http_core_loc_conf_t     *clcf;
 
     r = p->request;
@@ -836,14 +841,15 @@ static void ngx_http_proxy_send_response
 
     p->header_sent = 1;
 
-    if (p->cache) {
-        header = (ngx_http_cache_file_t *) p->header_in->start;
+    if (p->cachable) {
+        header = (ngx_http_cache_header_t *) p->header_in->start;
 
-        /* STUB */
-        header->header.expires = 0;
-        header->header.last_modified = 0;
+        header->expires = p->cache->ctx.expires;
+        header->last_modified = p->cache->ctx.last_modified;
+        header->date = p->cache->ctx.date;
+        /* TODO: r->headers_out.content_length_n == -1 */
+        header->length = r->headers_out.content_length_n;
 
-        header->header.length = r->headers_out.content_length_n;
         header->key_len = p->cache->ctx.key.len;
         ngx_memcpy(&header->key, p->cache->ctx.key.data, header->key_len);
         header->key[header->key_len] = LF;