Mercurial > hg > nginx-quic
comparison src/http/ngx_http_upstream.c @ 1565:4c43e25d11ea
fix English grammar
author | Igor Sysoev <igor@sysoev.ru> |
---|---|
date | Sun, 14 Oct 2007 18:56:15 +0000 |
parents | fe11e2a3946d |
children | 02a22cd5282a |
comparison
equal
deleted
inserted
replaced
1564:6725c3f56216 | 1565:4c43e25d11ea |
---|---|
432 | 432 |
433 if (ev->kq_errno) { | 433 if (ev->kq_errno) { |
434 ev->error = 1; | 434 ev->error = 1; |
435 } | 435 } |
436 | 436 |
437 if (!u->cachable && !u->store && u->peer.connection) { | 437 if (!u->cacheable && !u->store && u->peer.connection) { |
438 ngx_log_error(NGX_LOG_INFO, ev->log, ev->kq_errno, | 438 ngx_log_error(NGX_LOG_INFO, ev->log, ev->kq_errno, |
439 "kevent() reported that client closed prematurely " | 439 "kevent() reported that client closed prematurely " |
440 "connection, so upstream connection is closed too"); | 440 "connection, so upstream connection is closed too"); |
441 ngx_http_upstream_finalize_request(r, u, | 441 ngx_http_upstream_finalize_request(r, u, |
442 NGX_HTTP_CLIENT_CLOSED_REQUEST); | 442 NGX_HTTP_CLIENT_CLOSED_REQUEST); |
498 } | 498 } |
499 | 499 |
500 ev->eof = 1; | 500 ev->eof = 1; |
501 c->error = 1; | 501 c->error = 1; |
502 | 502 |
503 if (!u->cachable && !u->store && u->peer.connection) { | 503 if (!u->cacheable && !u->store && u->peer.connection) { |
504 ngx_log_error(NGX_LOG_INFO, ev->log, err, | 504 ngx_log_error(NGX_LOG_INFO, ev->log, err, |
505 "client closed prematurely connection, " | 505 "client closed prematurely connection, " |
506 "so upstream connection is closed too"); | 506 "so upstream connection is closed too"); |
507 ngx_http_upstream_finalize_request(r, u, | 507 ngx_http_upstream_finalize_request(r, u, |
508 NGX_HTTP_CLIENT_CLOSED_REQUEST); | 508 NGX_HTTP_CLIENT_CLOSED_REQUEST); |
1511 ngx_close_file_n " \"%s\" failed", | 1511 ngx_close_file_n " \"%s\" failed", |
1512 u->cache->ctx.file.name.data); | 1512 u->cache->ctx.file.name.data); |
1513 } | 1513 } |
1514 } | 1514 } |
1515 | 1515 |
1516 if (u->cachable) { | 1516 if (u->cacheable) { |
1517 header = (ngx_http_cache_header_t *) u->buffer->start; | 1517 header = (ngx_http_cache_header_t *) u->buffer->start; |
1518 | 1518 |
1519 header->expires = u->cache->ctx.expires; | 1519 header->expires = u->cache->ctx.expires; |
1520 header->last_modified = u->cache->ctx.last_modified; | 1520 header->last_modified = u->cache->ctx.last_modified; |
1521 header->date = u->cache->ctx.date; | 1521 header->date = u->cache->ctx.date; |
1539 p->upstream = u->peer.connection; | 1539 p->upstream = u->peer.connection; |
1540 p->downstream = c; | 1540 p->downstream = c; |
1541 p->pool = r->pool; | 1541 p->pool = r->pool; |
1542 p->log = c->log; | 1542 p->log = c->log; |
1543 | 1543 |
1544 p->cachable = u->cachable || u->store; | 1544 p->cacheable = u->cacheable || u->store; |
1545 | 1545 |
1546 p->temp_file = ngx_pcalloc(r->pool, sizeof(ngx_temp_file_t)); | 1546 p->temp_file = ngx_pcalloc(r->pool, sizeof(ngx_temp_file_t)); |
1547 if (p->temp_file == NULL) { | 1547 if (p->temp_file == NULL) { |
1548 ngx_http_upstream_finalize_request(r, u, 0); | 1548 ngx_http_upstream_finalize_request(r, u, 0); |
1549 return; | 1549 return; |
1552 p->temp_file->file.fd = NGX_INVALID_FILE; | 1552 p->temp_file->file.fd = NGX_INVALID_FILE; |
1553 p->temp_file->file.log = c->log; | 1553 p->temp_file->file.log = c->log; |
1554 p->temp_file->path = u->conf->temp_path; | 1554 p->temp_file->path = u->conf->temp_path; |
1555 p->temp_file->pool = r->pool; | 1555 p->temp_file->pool = r->pool; |
1556 | 1556 |
1557 if (u->cachable || u->store) { | 1557 if (u->cacheable || u->store) { |
1558 p->temp_file->persistent = 1; | 1558 p->temp_file->persistent = 1; |
1559 | 1559 |
1560 } else { | 1560 } else { |
1561 p->temp_file->log_level = NGX_LOG_WARN; | 1561 p->temp_file->log_level = NGX_LOG_WARN; |
1562 p->temp_file->warn = "an upstream response is buffered " | 1562 p->temp_file->warn = "an upstream response is buffered " |
1576 p->preread_bufs->next = NULL; | 1576 p->preread_bufs->next = NULL; |
1577 u->buffer.recycled = 1; | 1577 u->buffer.recycled = 1; |
1578 | 1578 |
1579 p->preread_size = u->buffer.last - u->buffer.pos; | 1579 p->preread_size = u->buffer.last - u->buffer.pos; |
1580 | 1580 |
1581 if (u->cachable) { | 1581 if (u->cacheable) { |
1582 | 1582 |
1583 p->buf_to_file = ngx_calloc_buf(r->pool); | 1583 p->buf_to_file = ngx_calloc_buf(r->pool); |
1584 if (p->buf_to_file == NULL) { | 1584 if (p->buf_to_file == NULL) { |
1585 ngx_http_upstream_finalize_request(r, u, 0); | 1585 ngx_http_upstream_finalize_request(r, u, 0); |
1586 return; | 1586 return; |
1953 } | 1953 } |
1954 } | 1954 } |
1955 | 1955 |
1956 #if (NGX_HTTP_FILE_CACHE) | 1956 #if (NGX_HTTP_FILE_CACHE) |
1957 | 1957 |
1958 if (p->upstream_done && u->cachable) { | 1958 if (p->upstream_done && u->cacheable) { |
1959 if (ngx_http_cache_update(r) == NGX_ERROR) { | 1959 if (ngx_http_cache_update(r) == NGX_ERROR) { |
1960 ngx_http_busy_unlock(u->conf->busy_lock, &u->busy_lock); | 1960 ngx_http_busy_unlock(u->conf->busy_lock, &u->busy_lock); |
1961 ngx_http_upstream_finalize_request(r, u, 0); | 1961 ngx_http_upstream_finalize_request(r, u, 0); |
1962 return; | 1962 return; |
1963 } | 1963 } |
1964 | 1964 |
1965 } else if (p->upstream_eof && u->cachable) { | 1965 } else if (p->upstream_eof && u->cacheable) { |
1966 | 1966 |
1967 /* TODO: check length & update cache */ | 1967 /* TODO: check length & update cache */ |
1968 | 1968 |
1969 if (ngx_http_cache_update(r) == NGX_ERROR) { | 1969 if (ngx_http_cache_update(r) == NGX_ERROR) { |
1970 ngx_http_busy_unlock(u->conf->busy_lock, &u->busy_lock); | 1970 ngx_http_busy_unlock(u->conf->busy_lock, &u->busy_lock); |
1988 | 1988 |
1989 if (p->downstream_error) { | 1989 if (p->downstream_error) { |
1990 ngx_log_debug0(NGX_LOG_DEBUG_HTTP, c->log, 0, | 1990 ngx_log_debug0(NGX_LOG_DEBUG_HTTP, c->log, 0, |
1991 "http upstream downstream error"); | 1991 "http upstream downstream error"); |
1992 | 1992 |
1993 if (!u->cachable && u->peer.connection) { | 1993 if (!u->cacheable && u->peer.connection) { |
1994 ngx_http_upstream_finalize_request(r, u, 0); | 1994 ngx_http_upstream_finalize_request(r, u, 0); |
1995 } | 1995 } |
1996 } | 1996 } |
1997 } | 1997 } |
1998 | 1998 |
2712 size_t len; | 2712 size_t len; |
2713 ngx_uint_t i; | 2713 ngx_uint_t i; |
2714 ngx_http_upstream_state_t *state; | 2714 ngx_http_upstream_state_t *state; |
2715 | 2715 |
2716 v->valid = 1; | 2716 v->valid = 1; |
2717 v->no_cachable = 0; | 2717 v->no_cacheable = 0; |
2718 v->not_found = 0; | 2718 v->not_found = 0; |
2719 | 2719 |
2720 if (r->upstream_states == NULL || r->upstream_states->nelts == 0) { | 2720 if (r->upstream_states == NULL || r->upstream_states->nelts == 0) { |
2721 v->not_found = 1; | 2721 v->not_found = 1; |
2722 return NGX_OK; | 2722 return NGX_OK; |
2783 size_t len; | 2783 size_t len; |
2784 ngx_uint_t i; | 2784 ngx_uint_t i; |
2785 ngx_http_upstream_state_t *state; | 2785 ngx_http_upstream_state_t *state; |
2786 | 2786 |
2787 v->valid = 1; | 2787 v->valid = 1; |
2788 v->no_cachable = 0; | 2788 v->no_cacheable = 0; |
2789 v->not_found = 0; | 2789 v->not_found = 0; |
2790 | 2790 |
2791 if (r->upstream_states == NULL || r->upstream_states->nelts == 0) { | 2791 if (r->upstream_states == NULL || r->upstream_states->nelts == 0) { |
2792 v->not_found = 1; | 2792 v->not_found = 1; |
2793 return NGX_OK; | 2793 return NGX_OK; |
2849 ngx_uint_t i; | 2849 ngx_uint_t i; |
2850 ngx_msec_int_t ms; | 2850 ngx_msec_int_t ms; |
2851 ngx_http_upstream_state_t *state; | 2851 ngx_http_upstream_state_t *state; |
2852 | 2852 |
2853 v->valid = 1; | 2853 v->valid = 1; |
2854 v->no_cachable = 0; | 2854 v->no_cacheable = 0; |
2855 v->not_found = 0; | 2855 v->not_found = 0; |
2856 | 2856 |
2857 if (r->upstream_states == NULL || r->upstream_states->nelts == 0) { | 2857 if (r->upstream_states == NULL || r->upstream_states->nelts == 0) { |
2858 v->not_found = 1; | 2858 v->not_found = 1; |
2859 return NGX_OK; | 2859 return NGX_OK; |