Mercurial > hg > nginx-vendor-0-5
comparison src/http/ngx_http_upstream.c @ 328:26ff8d6b618d NGINX_0_5_34
nginx 0.5.34
*) Change: now the full request line instead of URI only is written to
error_log.
*) Feature: Cygwin compatibility.
Thanks to Vladimir Kutakov.
*) Feature: the "merge_slashes" directive.
*) Feature: the "gzip_vary" directive.
*) Feature: the "server_tokens" directive.
*) Feature: the "access_log" directive may be used inside the
"limit_except" block.
*) Bugfix: if the $server_protocol was used in FastCGI parameters and a
request line length was near to the "client_header_buffer_size"
directive value, then nginx issued an alert "fastcgi: the request
record is too big".
*) Bugfix: if a plain text HTTP/0.9 version request was made to HTTPS
server, then nginx returned usual response.
*) Bugfix: URL double escaping in a redirect of the "msie_refresh"
directive; bug appeared in 0.5.28.
*) Bugfix: a segmentation fault might occur in worker process if
subrequests were used.
*) Bugfix: the big responses may be transferred truncated if SSL and
gzip were used.
*) Bugfix: compatibility with mget.
*) Bugfix: nginx did not unescape URI in the "include" SSI command.
*) Bugfix: the segmentation fault was occurred on start or while
reconfiguration if variable was used in the "charset" or
"source_charset" directives.
*) Bugfix: nginx returned the 400 response on requests like
"GET http://www.domain.com HTTP/1.0".
Thanks to James Oakley.
*) Bugfix: a segmentation fault occurred in worker process if
$date_local and $date_gmt were used outside the
ngx_http_ssi_filter_module.
*) Bugfix: a segmentation fault might occur in worker process if debug
log was enabled.
Thanks to Andrei Nigmatulin.
*) Bugfix: ngx_http_memcached_module did not set
$upstream_response_time.
Thanks to Maxim Dounin.
*) Bugfix: a worker process may got caught in an endless loop, if the
memcached was used.
author | Igor Sysoev <http://sysoev.ru> |
---|---|
date | Thu, 13 Dec 2007 00:00:00 +0300 |
parents | f70f2f565fe0 |
children | 2eea67ed0bc2 |
comparison
equal
deleted
inserted
replaced
327:cb962a94cd7b | 328:26ff8d6b618d |
---|---|
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); |
976 u->buffer.last = u->buffer.pos; | 976 u->buffer.last = u->buffer.pos; |
977 } | 977 } |
978 #endif | 978 #endif |
979 } | 979 } |
980 | 980 |
981 n = u->peer.connection->recv(u->peer.connection, u->buffer.last, | 981 n = c->recv(c, u->buffer.last, u->buffer.end - u->buffer.last); |
982 u->buffer.end - u->buffer.last); | |
983 | 982 |
984 if (n == NGX_AGAIN) { | 983 if (n == NGX_AGAIN) { |
985 #if 0 | 984 #if 0 |
986 ngx_add_timer(rev, u->read_timeout); | 985 ngx_add_timer(rev, u->read_timeout); |
987 #endif | 986 #endif |
1510 ngx_close_file_n " \"%s\" failed", | 1509 ngx_close_file_n " \"%s\" failed", |
1511 u->cache->ctx.file.name.data); | 1510 u->cache->ctx.file.name.data); |
1512 } | 1511 } |
1513 } | 1512 } |
1514 | 1513 |
1515 if (u->cachable) { | 1514 if (u->cacheable) { |
1516 header = (ngx_http_cache_header_t *) u->buffer->start; | 1515 header = (ngx_http_cache_header_t *) u->buffer->start; |
1517 | 1516 |
1518 header->expires = u->cache->ctx.expires; | 1517 header->expires = u->cache->ctx.expires; |
1519 header->last_modified = u->cache->ctx.last_modified; | 1518 header->last_modified = u->cache->ctx.last_modified; |
1520 header->date = u->cache->ctx.date; | 1519 header->date = u->cache->ctx.date; |
1538 p->upstream = u->peer.connection; | 1537 p->upstream = u->peer.connection; |
1539 p->downstream = c; | 1538 p->downstream = c; |
1540 p->pool = r->pool; | 1539 p->pool = r->pool; |
1541 p->log = c->log; | 1540 p->log = c->log; |
1542 | 1541 |
1543 p->cachable = u->cachable || u->store; | 1542 p->cacheable = u->cacheable || u->store; |
1544 | 1543 |
1545 p->temp_file = ngx_pcalloc(r->pool, sizeof(ngx_temp_file_t)); | 1544 p->temp_file = ngx_pcalloc(r->pool, sizeof(ngx_temp_file_t)); |
1546 if (p->temp_file == NULL) { | 1545 if (p->temp_file == NULL) { |
1547 ngx_http_upstream_finalize_request(r, u, 0); | 1546 ngx_http_upstream_finalize_request(r, u, 0); |
1548 return; | 1547 return; |
1551 p->temp_file->file.fd = NGX_INVALID_FILE; | 1550 p->temp_file->file.fd = NGX_INVALID_FILE; |
1552 p->temp_file->file.log = c->log; | 1551 p->temp_file->file.log = c->log; |
1553 p->temp_file->path = u->conf->temp_path; | 1552 p->temp_file->path = u->conf->temp_path; |
1554 p->temp_file->pool = r->pool; | 1553 p->temp_file->pool = r->pool; |
1555 | 1554 |
1556 if (u->cachable || u->store) { | 1555 if (u->cacheable || u->store) { |
1557 p->temp_file->persistent = 1; | 1556 p->temp_file->persistent = 1; |
1558 | 1557 |
1559 } else { | 1558 } else { |
1560 p->temp_file->log_level = NGX_LOG_WARN; | 1559 p->temp_file->log_level = NGX_LOG_WARN; |
1561 p->temp_file->warn = "an upstream response is buffered " | 1560 p->temp_file->warn = "an upstream response is buffered " |
1575 p->preread_bufs->next = NULL; | 1574 p->preread_bufs->next = NULL; |
1576 u->buffer.recycled = 1; | 1575 u->buffer.recycled = 1; |
1577 | 1576 |
1578 p->preread_size = u->buffer.last - u->buffer.pos; | 1577 p->preread_size = u->buffer.last - u->buffer.pos; |
1579 | 1578 |
1580 if (u->cachable) { | 1579 if (u->cacheable) { |
1581 | 1580 |
1582 p->buf_to_file = ngx_calloc_buf(r->pool); | 1581 p->buf_to_file = ngx_calloc_buf(r->pool); |
1583 if (p->buf_to_file == NULL) { | 1582 if (p->buf_to_file == NULL) { |
1584 ngx_http_upstream_finalize_request(r, u, 0); | 1583 ngx_http_upstream_finalize_request(r, u, 0); |
1585 return; | 1584 return; |
1952 } | 1951 } |
1953 } | 1952 } |
1954 | 1953 |
1955 #if (NGX_HTTP_FILE_CACHE) | 1954 #if (NGX_HTTP_FILE_CACHE) |
1956 | 1955 |
1957 if (p->upstream_done && u->cachable) { | 1956 if (p->upstream_done && u->cacheable) { |
1958 if (ngx_http_cache_update(r) == NGX_ERROR) { | 1957 if (ngx_http_cache_update(r) == NGX_ERROR) { |
1959 ngx_http_busy_unlock(u->conf->busy_lock, &u->busy_lock); | 1958 ngx_http_busy_unlock(u->conf->busy_lock, &u->busy_lock); |
1960 ngx_http_upstream_finalize_request(r, u, 0); | 1959 ngx_http_upstream_finalize_request(r, u, 0); |
1961 return; | 1960 return; |
1962 } | 1961 } |
1963 | 1962 |
1964 } else if (p->upstream_eof && u->cachable) { | 1963 } else if (p->upstream_eof && u->cacheable) { |
1965 | 1964 |
1966 /* TODO: check length & update cache */ | 1965 /* TODO: check length & update cache */ |
1967 | 1966 |
1968 if (ngx_http_cache_update(r) == NGX_ERROR) { | 1967 if (ngx_http_cache_update(r) == NGX_ERROR) { |
1969 ngx_http_busy_unlock(u->conf->busy_lock, &u->busy_lock); | 1968 ngx_http_busy_unlock(u->conf->busy_lock, &u->busy_lock); |
1987 | 1986 |
1988 if (p->downstream_error) { | 1987 if (p->downstream_error) { |
1989 ngx_log_debug0(NGX_LOG_DEBUG_HTTP, c->log, 0, | 1988 ngx_log_debug0(NGX_LOG_DEBUG_HTTP, c->log, 0, |
1990 "http upstream downstream error"); | 1989 "http upstream downstream error"); |
1991 | 1990 |
1992 if (!u->cachable && u->peer.connection) { | 1991 if (!u->cacheable && u->peer.connection) { |
1993 ngx_http_upstream_finalize_request(r, u, 0); | 1992 ngx_http_upstream_finalize_request(r, u, 0); |
1994 } | 1993 } |
1995 } | 1994 } |
1996 } | 1995 } |
1997 | 1996 |
2709 size_t len; | 2708 size_t len; |
2710 ngx_uint_t i; | 2709 ngx_uint_t i; |
2711 ngx_http_upstream_state_t *state; | 2710 ngx_http_upstream_state_t *state; |
2712 | 2711 |
2713 v->valid = 1; | 2712 v->valid = 1; |
2714 v->no_cachable = 0; | 2713 v->no_cacheable = 0; |
2715 v->not_found = 0; | 2714 v->not_found = 0; |
2716 | 2715 |
2717 if (r->upstream_states == NULL || r->upstream_states->nelts == 0) { | 2716 if (r->upstream_states == NULL || r->upstream_states->nelts == 0) { |
2718 v->not_found = 1; | 2717 v->not_found = 1; |
2719 return NGX_OK; | 2718 return NGX_OK; |
2780 size_t len; | 2779 size_t len; |
2781 ngx_uint_t i; | 2780 ngx_uint_t i; |
2782 ngx_http_upstream_state_t *state; | 2781 ngx_http_upstream_state_t *state; |
2783 | 2782 |
2784 v->valid = 1; | 2783 v->valid = 1; |
2785 v->no_cachable = 0; | 2784 v->no_cacheable = 0; |
2786 v->not_found = 0; | 2785 v->not_found = 0; |
2787 | 2786 |
2788 if (r->upstream_states == NULL || r->upstream_states->nelts == 0) { | 2787 if (r->upstream_states == NULL || r->upstream_states->nelts == 0) { |
2789 v->not_found = 1; | 2788 v->not_found = 1; |
2790 return NGX_OK; | 2789 return NGX_OK; |
2846 ngx_uint_t i; | 2845 ngx_uint_t i; |
2847 ngx_msec_int_t ms; | 2846 ngx_msec_int_t ms; |
2848 ngx_http_upstream_state_t *state; | 2847 ngx_http_upstream_state_t *state; |
2849 | 2848 |
2850 v->valid = 1; | 2849 v->valid = 1; |
2851 v->no_cachable = 0; | 2850 v->no_cacheable = 0; |
2852 v->not_found = 0; | 2851 v->not_found = 0; |
2853 | 2852 |
2854 if (r->upstream_states == NULL || r->upstream_states->nelts == 0) { | 2853 if (r->upstream_states == NULL || r->upstream_states->nelts == 0) { |
2855 v->not_found = 1; | 2854 v->not_found = 1; |
2856 return NGX_OK; | 2855 return NGX_OK; |
3060 ngx_memzero(&u, sizeof(ngx_url_t)); | 3059 ngx_memzero(&u, sizeof(ngx_url_t)); |
3061 | 3060 |
3062 u.url = value[1]; | 3061 u.url = value[1]; |
3063 u.default_port = 80; | 3062 u.default_port = 80; |
3064 | 3063 |
3065 if (ngx_parse_url(cf, &u) != NGX_OK) { | 3064 if (ngx_parse_url(cf->pool, &u) != NGX_OK) { |
3066 if (u.err) { | 3065 if (u.err) { |
3067 ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, | 3066 ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, |
3068 "%s in upstream \"%V\"", u.err, &u.url); | 3067 "%s in upstream \"%V\"", u.err, &u.url); |
3069 } | 3068 } |
3070 | 3069 |
3164 ngx_http_upstream_srv_conf_t *uscf, **uscfp; | 3163 ngx_http_upstream_srv_conf_t *uscf, **uscfp; |
3165 ngx_http_upstream_main_conf_t *umcf; | 3164 ngx_http_upstream_main_conf_t *umcf; |
3166 | 3165 |
3167 if (!(flags & NGX_HTTP_UPSTREAM_CREATE)) { | 3166 if (!(flags & NGX_HTTP_UPSTREAM_CREATE)) { |
3168 | 3167 |
3169 if (ngx_parse_url(cf, u) != NGX_OK) { | 3168 if (ngx_parse_url(cf->pool, u) != NGX_OK) { |
3170 if (u->err) { | 3169 if (u->err) { |
3171 ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, | 3170 ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, |
3172 "%s in upstream \"%V\"", u->err, &u->url); | 3171 "%s in upstream \"%V\"", u->err, &u->url); |
3173 } | 3172 } |
3174 | 3173 |