diff options
| author | Igor Sysoev <igor@sysoev.ru> | 2009-07-27 13:25:29 +0000 |
|---|---|---|
| committer | Igor Sysoev <igor@sysoev.ru> | 2009-07-27 13:25:29 +0000 |
| commit | 15b7420aa6ff79469e75c73def2070944502315e (patch) | |
| tree | 8c71bff0940e02726446e23805f737948161363a /src/http/ngx_http_upstream.c | |
| parent | b477b2c2f43550859ac21ddbde9481de05dc13e5 (diff) | |
| download | nginx-15b7420aa6ff79469e75c73def2070944502315e.tar.gz nginx-15b7420aa6ff79469e75c73def2070944502315e.tar.bz2 | |
ngx_http_upstream_create() to cleanup the previous upstream after
internal redirect
Diffstat (limited to '')
| -rw-r--r-- | src/http/ngx_http_upstream.c | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/src/http/ngx_http_upstream.c b/src/http/ngx_http_upstream.c index a8cf07fa8..23cf1b605 100644 --- a/src/http/ngx_http_upstream.c +++ b/src/http/ngx_http_upstream.c @@ -348,6 +348,35 @@ ngx_conf_bitmask_t ngx_http_upstream_cache_method_mask[] = { }; +ngx_int_t +ngx_http_upstream_create(ngx_http_request_t *r) +{ + ngx_http_upstream_t *u; + + u = r->upstream; + + if (u && u->cleanup) { + ngx_http_upstream_cleanup(r); + *u->cleanup = NULL; + } + + u = ngx_pcalloc(r->pool, sizeof(ngx_http_upstream_t)); + if (u == NULL) { + return NGX_ERROR; + } + + r->upstream = u; + + u->peer.log = r->connection->log; + u->peer.log_error = NGX_ERROR_ERR; +#if (NGX_THREADS) + u->peer.lock = &r->connection->lock; +#endif + + return NGX_OK; +} + + void ngx_http_upstream_init(ngx_http_request_t *r) { |
