diff options
author | Maxim Dounin <mdounin@mdounin.ru> | 2011-09-15 18:21:24 +0000 |
---|---|---|
committer | Maxim Dounin <mdounin@mdounin.ru> | 2011-09-15 18:21:24 +0000 |
commit | 360ed25d657fba94634f0715e6b1adadeea4a8fd (patch) | |
tree | 852ac7f0afa685d0dd8897266ab2f856ec28d1c1 /src/http/ngx_http_upstream.c | |
parent | c42c70f478b4ec1a153b77129fd3e905f5b74314 (diff) | |
download | nginx-360ed25d657fba94634f0715e6b1adadeea4a8fd.tar.gz nginx-360ed25d657fba94634f0715e6b1adadeea4a8fd.zip |
Upstream: separate pool for peer connections.
This is required to support persistent https connections as various ssl
structures are allocated from connection's pool.
Diffstat (limited to 'src/http/ngx_http_upstream.c')
-rw-r--r-- | src/http/ngx_http_upstream.c | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/src/http/ngx_http_upstream.c b/src/http/ngx_http_upstream.c index 3913e1389..3b32e27bb 100644 --- a/src/http/ngx_http_upstream.c +++ b/src/http/ngx_http_upstream.c @@ -1136,8 +1136,20 @@ ngx_http_upstream_connect(ngx_http_request_t *r, ngx_http_upstream_t *u) c->sendfile &= r->connection->sendfile; u->output.sendfile = c->sendfile; - c->pool = r->pool; + if (c->pool == NULL) { + + /* we need separate pool here to be able to cache SSL connections */ + + c->pool = ngx_create_pool(128, r->connection->log); + if (c->pool == NULL) { + ngx_http_upstream_finalize_request(r, u, + NGX_HTTP_INTERNAL_SERVER_ERROR); + return; + } + } + c->log = r->connection->log; + c->pool->log = c->log; c->read->log = c->log; c->write->log = c->log; @@ -2890,6 +2902,7 @@ ngx_http_upstream_next(ngx_http_request_t *r, ngx_http_upstream_t *u, } #endif + ngx_destroy_pool(u->peer.connection->pool); ngx_close_connection(u->peer.connection); } @@ -2984,6 +2997,7 @@ ngx_http_upstream_finalize_request(ngx_http_request_t *r, "close http upstream connection: %d", u->peer.connection->fd); + ngx_destroy_pool(u->peer.connection->pool); ngx_close_connection(u->peer.connection); } |