Mercurial > hg > nginx
comparison src/http/modules/ngx_http_fastcgi_module.c @ 3245:61962127b166 stable-0.7
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
author | Igor Sysoev <igor@sysoev.ru> |
---|---|
date | Mon, 26 Oct 2009 17:09:27 +0000 |
parents | 2efa8d2fcde1 |
children | 0189a8f4c7c3 |
comparison
equal
deleted
inserted
replaced
3244:8b2d478de54b | 3245:61962127b166 |
---|---|
541 "ngx_http_fastcgi_module does not support " | 541 "ngx_http_fastcgi_module does not support " |
542 "subrequest in memory"); | 542 "subrequest in memory"); |
543 return NGX_HTTP_INTERNAL_SERVER_ERROR; | 543 return NGX_HTTP_INTERNAL_SERVER_ERROR; |
544 } | 544 } |
545 | 545 |
546 if (ngx_http_upstream_create(r) != NGX_OK) { | |
547 return NGX_HTTP_INTERNAL_SERVER_ERROR; | |
548 } | |
549 | |
546 f = ngx_pcalloc(r->pool, sizeof(ngx_http_fastcgi_ctx_t)); | 550 f = ngx_pcalloc(r->pool, sizeof(ngx_http_fastcgi_ctx_t)); |
547 if (f == NULL) { | 551 if (f == NULL) { |
548 return NGX_ERROR; | 552 return NGX_HTTP_INTERNAL_SERVER_ERROR; |
549 } | 553 } |
550 | 554 |
551 ngx_http_set_ctx(r, f, ngx_http_fastcgi_module); | 555 ngx_http_set_ctx(r, f, ngx_http_fastcgi_module); |
552 | |
553 u = ngx_pcalloc(r->pool, sizeof(ngx_http_upstream_t)); | |
554 if (u == NULL) { | |
555 return NGX_HTTP_INTERNAL_SERVER_ERROR; | |
556 } | |
557 | |
558 r->upstream = u; | |
559 | 556 |
560 flcf = ngx_http_get_module_loc_conf(r, ngx_http_fastcgi_module); | 557 flcf = ngx_http_get_module_loc_conf(r, ngx_http_fastcgi_module); |
561 | 558 |
562 if (flcf->fastcgi_lengths) { | 559 if (flcf->fastcgi_lengths) { |
563 if (ngx_http_fastcgi_eval(r, flcf) != NGX_OK) { | 560 if (ngx_http_fastcgi_eval(r, flcf) != NGX_OK) { |
564 return NGX_HTTP_INTERNAL_SERVER_ERROR; | 561 return NGX_HTTP_INTERNAL_SERVER_ERROR; |
565 } | 562 } |
566 } | 563 } |
567 | 564 |
565 u = r->upstream; | |
566 | |
568 u->schema.len = sizeof("fastcgi://") - 1; | 567 u->schema.len = sizeof("fastcgi://") - 1; |
569 u->schema.data = (u_char *) "fastcgi://"; | 568 u->schema.data = (u_char *) "fastcgi://"; |
570 | |
571 u->peer.log = r->connection->log; | |
572 u->peer.log_error = NGX_ERROR_ERR; | |
573 #if (NGX_THREADS) | |
574 u->peer.lock = &r->connection->lock; | |
575 #endif | |
576 | 569 |
577 u->output.tag = (ngx_buf_tag_t) &ngx_http_fastcgi_module; | 570 u->output.tag = (ngx_buf_tag_t) &ngx_http_fastcgi_module; |
578 | 571 |
579 u->conf = &flcf->upstream; | 572 u->conf = &flcf->upstream; |
580 | 573 |