diff options
| author | Igor Sysoev <igor@sysoev.ru> | 2009-10-26 17:09:27 +0000 |
|---|---|---|
| committer | Igor Sysoev <igor@sysoev.ru> | 2009-10-26 17:09:27 +0000 |
| commit | 6118897e3388e4db5d693f27ac4c7312e07f3d12 (patch) | |
| tree | 0228aaa538e452a4a655648d51fe06e97820bb52 /src/http/modules/ngx_http_fastcgi_module.c | |
| parent | f3c5789e7d3ad2e124079c388ee90c6d54c18495 (diff) | |
| download | nginx-6118897e3388e4db5d693f27ac4c7312e07f3d12.tar.gz nginx-6118897e3388e4db5d693f27ac4c7312e07f3d12.tar.bz2 | |
merge r3001, r3007, r3013:
fix variuos segfaults:
*) fix segfault if 400 or 414 errors are handled intricately
*) ngx_http_upstream_create() to cleanup the previous upstream after
internal redirect
Diffstat (limited to 'src/http/modules/ngx_http_fastcgi_module.c')
| -rw-r--r-- | src/http/modules/ngx_http_fastcgi_module.c | 21 |
1 files changed, 7 insertions, 14 deletions
diff --git a/src/http/modules/ngx_http_fastcgi_module.c b/src/http/modules/ngx_http_fastcgi_module.c index 6aa1c7599..3ce608db1 100644 --- a/src/http/modules/ngx_http_fastcgi_module.c +++ b/src/http/modules/ngx_http_fastcgi_module.c @@ -543,19 +543,16 @@ ngx_http_fastcgi_handler(ngx_http_request_t *r) return NGX_HTTP_INTERNAL_SERVER_ERROR; } - f = ngx_pcalloc(r->pool, sizeof(ngx_http_fastcgi_ctx_t)); - if (f == NULL) { - return NGX_ERROR; + if (ngx_http_upstream_create(r) != NGX_OK) { + return NGX_HTTP_INTERNAL_SERVER_ERROR; } - ngx_http_set_ctx(r, f, ngx_http_fastcgi_module); - - u = ngx_pcalloc(r->pool, sizeof(ngx_http_upstream_t)); - if (u == NULL) { + f = ngx_pcalloc(r->pool, sizeof(ngx_http_fastcgi_ctx_t)); + if (f == NULL) { return NGX_HTTP_INTERNAL_SERVER_ERROR; } - r->upstream = u; + ngx_http_set_ctx(r, f, ngx_http_fastcgi_module); flcf = ngx_http_get_module_loc_conf(r, ngx_http_fastcgi_module); @@ -565,15 +562,11 @@ ngx_http_fastcgi_handler(ngx_http_request_t *r) } } + u = r->upstream; + u->schema.len = sizeof("fastcgi://") - 1; u->schema.data = (u_char *) "fastcgi://"; - u->peer.log = r->connection->log; - u->peer.log_error = NGX_ERROR_ERR; -#if (NGX_THREADS) - u->peer.lock = &r->connection->lock; -#endif - u->output.tag = (ngx_buf_tag_t) &ngx_http_fastcgi_module; u->conf = &flcf->upstream; |
