Mercurial > hg > nginx
comparison src/http/modules/proxy/ngx_http_proxy_cache.c @ 175:e92c2c647c57
nginx-0.0.1-2003-11-05-20:03:41 import
author | Igor Sysoev <igor@sysoev.ru> |
---|---|
date | Wed, 05 Nov 2003 17:03:41 +0000 |
parents | ea464a6c0581 |
children | c0552e5ab567 |
comparison
equal
deleted
inserted
replaced
174:ea464a6c0581 | 175:e92c2c647c57 |
---|---|
214 return NGX_ERROR; | 214 return NGX_ERROR; |
215 } | 215 } |
216 } | 216 } |
217 | 217 |
218 | 218 |
219 #if 0 | |
220 | |
221 static void ngx_http_proxy_cache_busy_lock(ngx_http_proxy_ctx_t *p) | |
222 { | |
223 rc = ngx_http_busy_lock(p->lcf->busy_lock, p->cache->ctx.md5); | |
224 | |
225 if (rc == NGX_OK) { | |
226 ngx_http_proxy_request_upstream(p); | |
227 } | |
228 | |
229 if (rc == NGX_AGAIN) { | |
230 if (p->busy_lock_time) { | |
231 ngx_add_timer(p->request->connection->read, 1000); | |
232 return; | |
233 } | |
234 } | |
235 | |
236 rc == NGX_ERROR | |
237 check waitn | |
238 } | |
239 | |
240 #endif | |
241 | |
242 | |
219 int ngx_http_proxy_send_cached_response(ngx_http_proxy_ctx_t *p) | 243 int ngx_http_proxy_send_cached_response(ngx_http_proxy_ctx_t *p) |
220 { | 244 { |
221 int rc, len, i; | 245 int rc, len, i; |
222 off_t rest; | 246 off_t rest; |
223 ngx_hunk_t *h0, *h1; | 247 ngx_hunk_t *h0, *h1; |
426 } | 450 } |
427 | 451 |
428 | 452 |
429 int ngx_http_proxy_update_cache(ngx_http_proxy_ctx_t *p) | 453 int ngx_http_proxy_update_cache(ngx_http_proxy_ctx_t *p) |
430 { | 454 { |
455 ngx_event_pipe_t *ep; | |
456 | |
431 if (p->cache == NULL) { | 457 if (p->cache == NULL) { |
432 return NGX_OK; | 458 return NGX_OK; |
433 } | 459 } |
434 | 460 |
461 ep = p->upstream->event_pipe; | |
462 | |
463 if (p->cache->ctx.length == -1) { | |
464 /* TODO: test rc */ | |
465 ngx_write_file(&ep->temp_file->file, | |
466 (char *) &ep->read_length, sizeof(off_t), | |
467 offsetof(ngx_http_cache_header_t, length)); | |
468 } | |
469 | |
435 return ngx_http_cache_update_file(p->request, &p->cache->ctx, | 470 return ngx_http_cache_update_file(p->request, &p->cache->ctx, |
436 &p->upstream->event_pipe->temp_file->file.name); | 471 &ep->temp_file->file.name); |
437 } | 472 } |