diff options
author | Igor Sysoev <igor@sysoev.ru> | 2005-10-24 15:09:41 +0000 |
---|---|---|
committer | Igor Sysoev <igor@sysoev.ru> | 2005-10-24 15:09:41 +0000 |
commit | 9ac946bcc9f8f3735af8eb253c1e89f177db5827 (patch) | |
tree | 0d42898bfbe5931131d4544699b18c9d697d2cef /src/http/ngx_http_upstream.c | |
parent | 51d8bcc28b729a8a3056a0c98e2c44e466351141 (diff) | |
download | nginx-9ac946bcc9f8f3735af8eb253c1e89f177db5827.tar.gz nginx-9ac946bcc9f8f3735af8eb253c1e89f177db5827.zip |
nginx-0.3.6-RELEASE importrelease-0.3.6
*) Change: now the IMAP/POP3 proxy do not send the empty login to
authorization server.
*) Feature: the "log_format" supports the variables in the $name form.
*) Bugfix: if at least in one server was no the "listen" directive,
then nginx did not listen on the 80 port; the bug had appeared in
0.3.3.
*) Bugfix: if the URI part is omitted in "proxy_pass" directive, the
the 80 port was always used.
Diffstat (limited to 'src/http/ngx_http_upstream.c')
-rw-r--r-- | src/http/ngx_http_upstream.c | 34 |
1 files changed, 30 insertions, 4 deletions
diff --git a/src/http/ngx_http_upstream.c b/src/http/ngx_http_upstream.c index 6d1bd497d..6ec9933da 100644 --- a/src/http/ngx_http_upstream.c +++ b/src/http/ngx_http_upstream.c @@ -29,6 +29,7 @@ static void ngx_http_upstream_process_body(ngx_event_t *ev); static void ngx_http_upstream_dummy_handler(ngx_event_t *wev); static void ngx_http_upstream_next(ngx_http_request_t *r, ngx_http_upstream_t *u, ngx_uint_t ft_type); +static void ngx_http_upstream_cleanup(void *data); static void ngx_http_upstream_finalize_request(ngx_http_request_t *r, ngx_http_upstream_t *u, ngx_int_t rc); @@ -223,6 +224,7 @@ ngx_http_upstream_init(ngx_http_request_t *r) { ngx_time_t *tp; ngx_connection_t *c; + ngx_http_cleanup_t *cln; ngx_http_upstream_t *u; ngx_http_core_loc_conf_t *clcf; @@ -277,7 +279,8 @@ ngx_http_upstream_init(ngx_http_request_t *r) u->writer.pool = r->pool; if (ngx_array_init(&u->states, r->pool, u->peer.peers->number, - sizeof(ngx_http_upstream_state_t)) != NGX_OK) + sizeof(ngx_http_upstream_state_t)) + != NGX_OK) { ngx_http_finalize_request(r, NGX_HTTP_INTERNAL_SERVER_ERROR); return; @@ -295,6 +298,16 @@ ngx_http_upstream_init(ngx_http_request_t *r) u->state->response_time = tp->sec * 1000 + tp->msec; + cln = ngx_http_cleanup_add(r, sizeof(void *)); + if (cln == NULL) { + ngx_http_finalize_request(r, NGX_HTTP_INTERNAL_SERVER_ERROR); + return; + } + + cln->handler = ngx_http_upstream_cleanup; + cln->data = r; + u->cleanup = &cln->handler; + ngx_http_upstream_connect(r, u); } @@ -1379,8 +1392,7 @@ ngx_http_upstream_next(ngx_http_request_t *r, ngx_http_upstream_t *u, } } - if (r->connection->write->eof) { - r->connection->closed = 1; + if (r->connection->closed) { ngx_http_upstream_finalize_request(r, u, NGX_HTTP_CLIENT_CLOSED_REQUEST); return; @@ -1426,6 +1438,18 @@ ngx_http_upstream_next(ngx_http_request_t *r, ngx_http_upstream_t *u, static void +ngx_http_upstream_cleanup(void *data) +{ + ngx_http_request_t *r = data; + + ngx_log_debug1(NGX_LOG_DEBUG_HTTP, r->connection->log, 0, + "cleanup http upstream request: \"%V\"", &r->uri); + + ngx_http_upstream_finalize_request(r, r->upstream, NGX_DONE); +} + + +static void ngx_http_upstream_finalize_request(ngx_http_request_t *r, ngx_http_upstream_t *u, ngx_int_t rc) { @@ -1434,6 +1458,8 @@ ngx_http_upstream_finalize_request(ngx_http_request_t *r, ngx_log_debug1(NGX_LOG_DEBUG_HTTP, r->connection->log, 0, "finalize http upstream request: %i", rc); + *u->cleanup = NULL; + if (u->state->response_time) { tp = ngx_timeofday(); u->state->response_time = tp->sec * 1000 + tp->msec @@ -1864,7 +1890,7 @@ ngx_http_upstream_log_error(ngx_http_request_t *r, u_char *buf, size_t len) p = ngx_snprintf(buf, len, ", server: %V, URL: \"%V\"," - " upstream: %V%V%s%V", + " upstream: \"%V%V%s%V\"", &r->server_name, &r->unparsed_uri, &u->conf->schema, |