Mercurial > hg > nginx
comparison src/http/modules/proxy/ngx_http_proxy_cache.c @ 257:70e1c7d2b83d
nginx-0.0.2-2004-02-11-20:08:49 import
author | Igor Sysoev <igor@sysoev.ru> |
---|---|
date | Wed, 11 Feb 2004 17:08:49 +0000 |
parents | 8dee38ea9117 |
children | da8c5707af39 |
comparison
equal
deleted
inserted
replaced
256:8e39cab6abd5 | 257:70e1c7d2b83d |
---|---|
165 p->status = 0; | 165 p->status = 0; |
166 p->status_count = 0; | 166 p->status_count = 0; |
167 | 167 |
168 ngx_cpystrn(c->status_line.data, p->status_start, c->status_line.len + 1); | 168 ngx_cpystrn(c->status_line.data, p->status_start, c->status_line.len + 1); |
169 | 169 |
170 ngx_log_debug(r->connection->log, "http cache status %d '%s'" _ | 170 ngx_log_debug2(NGX_LOG_DEBUG_HTTP, r->connection->log, 0, |
171 c->status _ c->status_line.data); | 171 "http cache status %d \"%s\"", |
172 c->status, c->status_line.data); | |
172 | 173 |
173 /* TODO: ngx_init_table */ | 174 /* TODO: ngx_init_table */ |
174 c->headers_in.headers = ngx_create_table(r->pool, 20); | 175 c->headers_in.headers = ngx_create_table(r->pool, 20); |
175 | 176 |
176 for ( ;; ) { | 177 for ( ;; ) { |
210 + ngx_http_proxy_headers_in[i].offset)) = h; | 211 + ngx_http_proxy_headers_in[i].offset)) = h; |
211 break; | 212 break; |
212 } | 213 } |
213 } | 214 } |
214 | 215 |
215 ngx_log_debug(r->connection->log, "HTTP cache header: '%s: %s'" _ | 216 ngx_log_debug2(NGX_LOG_DEBUG_HTTP, r->connection->log, 0, |
216 h->key.data _ h->value.data); | 217 "http cache header: \"%s: %s\"", |
218 h->key.data, h->value.data); | |
217 | 219 |
218 continue; | 220 continue; |
219 | 221 |
220 } else if (rc == NGX_HTTP_PARSE_HEADER_DONE) { | 222 } else if (rc == NGX_HTTP_PARSE_HEADER_DONE) { |
221 | 223 |
222 /* a whole header has been parsed successfully */ | 224 /* a whole header has been parsed successfully */ |
223 | 225 |
224 ngx_log_debug(r->connection->log, "HTTP header done"); | 226 ngx_log_debug0(NGX_LOG_DEBUG_HTTP, r->connection->log, 0, |
227 "http cache header done"); | |
225 | 228 |
226 c->ctx.file_start = p->header_in->pos - p->header_in->start; | 229 c->ctx.file_start = p->header_in->pos - p->header_in->start; |
227 | 230 |
228 return NGX_OK; | 231 return NGX_OK; |
229 | 232 |
251 int rc, ft_type; | 254 int rc, ft_type; |
252 | 255 |
253 rc = ngx_http_busy_lock_cachable(p->lcf->busy_lock, &p->busy_lock, | 256 rc = ngx_http_busy_lock_cachable(p->lcf->busy_lock, &p->busy_lock, |
254 p->try_busy_lock); | 257 p->try_busy_lock); |
255 | 258 |
256 ngx_log_debug(p->request->connection->log, "LOCK CACHABLE: %d" _ rc); | 259 ngx_log_debug1(NGX_LOG_DEBUG_HTTP, p->request->connection->log, 0, |
260 "http cache busy lock cachable: %d", rc); | |
257 | 261 |
258 if (rc == NGX_OK) { | 262 if (rc == NGX_OK) { |
259 if (p->try_busy_lock) { | 263 if (p->try_busy_lock) { |
260 p->busy_locked = 1; | 264 p->busy_locked = 1; |
261 p->header_in->pos = p->header_in->start + p->cache->ctx.header_size; | 265 p->header_in->pos = p->header_in->start + p->cache->ctx.header_size; |
352 p->busy_lock.time = 0; | 356 p->busy_lock.time = 0; |
353 ngx_http_proxy_cache_busy_lock(p); | 357 ngx_http_proxy_cache_busy_lock(p); |
354 return; | 358 return; |
355 } | 359 } |
356 | 360 |
357 ngx_log_debug(p->request->connection->log, "OLD: %d, NEW: %d" _ | 361 ngx_log_debug2(NGX_LOG_DEBUG_HTTP, p->request->connection->log, 0, |
358 p->cache->ctx.file.fd _ ctx->file.fd); | 362 "http cache old fd:%d, new fd:%d", |
363 p->cache->ctx.file.fd, ctx->file.fd); | |
359 | 364 |
360 if (p->cache->ctx.file.fd != NGX_INVALID_FILE) { | 365 if (p->cache->ctx.file.fd != NGX_INVALID_FILE) { |
361 if (ngx_close_file(p->cache->ctx.file.fd) == NGX_FILE_ERROR) { | 366 if (ngx_close_file(p->cache->ctx.file.fd) == NGX_FILE_ERROR) { |
362 ngx_log_error(NGX_LOG_ALERT, p->request->connection->log, ngx_errno, | 367 ngx_log_error(NGX_LOG_ALERT, p->request->connection->log, ngx_errno, |
363 ngx_close_file_n " \"%s\" failed", | 368 ngx_close_file_n " \"%s\" failed", |
601 return NGX_OK; | 606 return NGX_OK; |
602 } | 607 } |
603 | 608 |
604 ep = p->upstream->event_pipe; | 609 ep = p->upstream->event_pipe; |
605 | 610 |
606 ngx_log_debug(p->request->connection->log, "LEN: " OFF_T_FMT ", " OFF_T_FMT _ | 611 ngx_log_debug2(NGX_LOG_DEBUG_HTTP, p->request->connection->log, 0, |
607 p->cache->ctx.length _ ep->read_length); | 612 "http cache update len: " OFF_T_FMT ":" OFF_T_FMT, |
613 p->cache->ctx.length, ep->read_length); | |
608 | 614 |
609 if (p->cache->ctx.length == -1) { | 615 if (p->cache->ctx.length == -1) { |
610 /* TODO: test rc */ | 616 /* TODO: test rc */ |
611 ngx_write_file(&ep->temp_file->file, | 617 ngx_write_file(&ep->temp_file->file, |
612 (char *) &ep->read_length, sizeof(off_t), | 618 (char *) &ep->read_length, sizeof(off_t), |