Mercurial > hg > nginx
comparison src/http/modules/proxy/ngx_http_proxy_cache.c @ 195:8dee38ea9117
nginx-0.0.1-2003-11-25-23:44:56 import
author | Igor Sysoev <igor@sysoev.ru> |
---|---|
date | Tue, 25 Nov 2003 20:44:56 +0000 |
parents | dd66383796a5 |
children | 70e1c7d2b83d |
comparison
equal
deleted
inserted
replaced
194:2357fa41738a | 195:8dee38ea9117 |
---|---|
84 } else if (rc == NGX_HTTP_CACHE_AGED) { | 84 } else if (rc == NGX_HTTP_CACHE_AGED) { |
85 p->state->cache_state = NGX_HTTP_PROXY_CACHE_AGED; | 85 p->state->cache_state = NGX_HTTP_PROXY_CACHE_AGED; |
86 } | 86 } |
87 | 87 |
88 if (rc == NGX_HTTP_CACHE_STALE || rc == NGX_HTTP_CACHE_AGED) { | 88 if (rc == NGX_HTTP_CACHE_STALE || rc == NGX_HTTP_CACHE_AGED) { |
89 p->state->expired = ngx_time() - p->cache->ctx.expires; | |
89 p->header_in->pos = p->header_in->start + p->cache->ctx.header_size; | 90 p->header_in->pos = p->header_in->start + p->cache->ctx.header_size; |
90 | 91 |
91 if (ngx_http_proxy_process_cached_header(p) == NGX_ERROR) { | 92 if (ngx_http_proxy_process_cached_header(p) == NGX_ERROR) { |
92 return NGX_HTTP_INTERNAL_SERVER_ERROR; | 93 return NGX_HTTP_INTERNAL_SERVER_ERROR; |
93 } | 94 } |
485 out[i].next = NULL; | 486 out[i].next = NULL; |
486 if (!r->main) { | 487 if (!r->main) { |
487 out[i].hunk->type |= NGX_HUNK_LAST; | 488 out[i].hunk->type |= NGX_HUNK_LAST; |
488 } | 489 } |
489 | 490 |
491 r->file.fd = p->cache->ctx.file.fd; | |
492 | |
490 return ngx_http_output_filter(r, out); | 493 return ngx_http_output_filter(r, out); |
491 } | 494 } |
492 | 495 |
493 | 496 |
494 int ngx_http_proxy_is_cachable(ngx_http_proxy_ctx_t *p) | 497 int ngx_http_proxy_is_cachable(ngx_http_proxy_ctx_t *p) |
598 return NGX_OK; | 601 return NGX_OK; |
599 } | 602 } |
600 | 603 |
601 ep = p->upstream->event_pipe; | 604 ep = p->upstream->event_pipe; |
602 | 605 |
603 ngx_log_debug(p->request->connection->log, "LEN: " OFF_FMT ", " OFF_FMT _ | 606 ngx_log_debug(p->request->connection->log, "LEN: " OFF_T_FMT ", " OFF_T_FMT _ |
604 p->cache->ctx.length _ ep->read_length); | 607 p->cache->ctx.length _ ep->read_length); |
605 | 608 |
606 if (p->cache->ctx.length == -1) { | 609 if (p->cache->ctx.length == -1) { |
607 /* TODO: test rc */ | 610 /* TODO: test rc */ |
608 ngx_write_file(&ep->temp_file->file, | 611 ngx_write_file(&ep->temp_file->file, |