comparison src/http/modules/ngx_http_fastcgi_module.c @ 306:55328d69b335 NGINX_0_5_23

nginx 0.5.23 *) Feature: the ngx_http_ssl_module supports Server Name Indication TLS extension. *) Feature: the "fastcgi_catch_stderr" directive. Thanks to Nick S. Grechukh, OWOX project. *) Bugfix: a segmentation fault occurred in master process if two virtual servers should bind() to the overlapping ports. *) Bugfix: if nginx was built with ngx_http_perl_module and perl supported threads, then during second reconfiguration the error messages "panic: MUTEX_LOCK" and "perl_parse() failed" were issued. *) Bugfix: in the HTTPS protocol in the "proxy_pass" directive.
author Igor Sysoev <http://sysoev.ru>
date Mon, 04 Jun 2007 00:00:00 +0400
parents 92402f034b28
children a6d84efa5106
comparison
equal deleted inserted replaced
305:892db29abb4f 306:55328d69b335
17 17
18 ngx_array_t *flushes; 18 ngx_array_t *flushes;
19 ngx_array_t *params_len; 19 ngx_array_t *params_len;
20 ngx_array_t *params; 20 ngx_array_t *params;
21 ngx_array_t *params_source; 21 ngx_array_t *params_source;
22 ngx_array_t *catch_stderr;
22 } ngx_http_fastcgi_loc_conf_t; 23 } ngx_http_fastcgi_loc_conf_t;
23 24
24 25
25 typedef enum { 26 typedef enum {
26 ngx_http_fastcgi_st_version = 0, 27 ngx_http_fastcgi_st_version = 0,
341 { ngx_string("fastcgi_hide_header"), 342 { ngx_string("fastcgi_hide_header"),
342 NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_FLAG, 343 NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_FLAG,
343 ngx_conf_set_str_array_slot, 344 ngx_conf_set_str_array_slot,
344 NGX_HTTP_LOC_CONF_OFFSET, 345 NGX_HTTP_LOC_CONF_OFFSET,
345 offsetof(ngx_http_fastcgi_loc_conf_t, upstream.hide_headers), 346 offsetof(ngx_http_fastcgi_loc_conf_t, upstream.hide_headers),
347 NULL },
348
349 { ngx_string("fastcgi_catch_stderr"),
350 NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_FLAG,
351 ngx_conf_set_str_array_slot,
352 NGX_HTTP_LOC_CONF_OFFSET,
353 offsetof(ngx_http_fastcgi_loc_conf_t, catch_stderr),
346 NULL }, 354 NULL },
347 355
348 ngx_null_command 356 ngx_null_command
349 }; 357 };
350 358
831 839
832 static ngx_int_t 840 static ngx_int_t
833 ngx_http_fastcgi_process_header(ngx_http_request_t *r) 841 ngx_http_fastcgi_process_header(ngx_http_request_t *r)
834 { 842 {
835 u_char *start, *last; 843 u_char *start, *last;
836 ngx_str_t *status_line, line; 844 ngx_str_t *status_line, line, *pattern;
837 ngx_int_t rc, status; 845 ngx_int_t rc, status;
838 ngx_uint_t i; 846 ngx_uint_t i;
839 ngx_table_elt_t *h; 847 ngx_table_elt_t *h;
840 ngx_http_upstream_t *u; 848 ngx_http_upstream_t *u;
841 ngx_http_fastcgi_ctx_t *f; 849 ngx_http_fastcgi_ctx_t *f;
842 ngx_http_upstream_header_t *hh; 850 ngx_http_upstream_header_t *hh;
851 ngx_http_fastcgi_loc_conf_t *flcf;
843 ngx_http_upstream_main_conf_t *umcf; 852 ngx_http_upstream_main_conf_t *umcf;
844 853
845 f = ngx_http_get_module_ctx(r, ngx_http_fastcgi_module); 854 f = ngx_http_get_module_ctx(r, ngx_http_fastcgi_module);
846 855
847 umcf = ngx_http_get_module_main_conf(r, ngx_http_upstream_module); 856 umcf = ngx_http_get_module_main_conf(r, ngx_http_upstream_module);
945 line.len--; 954 line.len--;
946 } 955 }
947 956
948 ngx_log_error(NGX_LOG_ERR, r->connection->log, 0, 957 ngx_log_error(NGX_LOG_ERR, r->connection->log, 0,
949 "FastCGI sent in stderr: \"%V\"", &line); 958 "FastCGI sent in stderr: \"%V\"", &line);
959
960 flcf = ngx_http_get_module_loc_conf(r, ngx_http_fastcgi_module);
961
962 if (flcf->catch_stderr) {
963 pattern = flcf->catch_stderr->elts;
964
965 line.data[line.len - 1] = '\0';
966
967 for (i = 0; i < flcf->catch_stderr->nelts; i++) {
968 if (ngx_strstr(line.data, pattern[i].data)) {
969 return NGX_HTTP_BAD_GATEWAY;
970 }
971 }
972 }
950 973
951 if (u->buffer.pos == u->buffer.last) { 974 if (u->buffer.pos == u->buffer.last) {
952 975
953 if (!f->fastcgi_stdout) { 976 if (!f->fastcgi_stdout) {
954 977
1526 * conf->upstream.next_upstream = 0; 1549 * conf->upstream.next_upstream = 0;
1527 * conf->upstream.temp_path = NULL; 1550 * conf->upstream.temp_path = NULL;
1528 * conf->upstream.hide_headers_hash = { NULL, 0 }; 1551 * conf->upstream.hide_headers_hash = { NULL, 0 };
1529 * conf->upstream.hide_headers = NULL; 1552 * conf->upstream.hide_headers = NULL;
1530 * conf->upstream.pass_headers = NULL; 1553 * conf->upstream.pass_headers = NULL;
1554 * conf->upstream.catch_stderr = NULL;
1531 * conf->upstream.schema = { 0, NULL }; 1555 * conf->upstream.schema = { 0, NULL };
1532 * conf->upstream.uri = { 0, NULL }; 1556 * conf->upstream.uri = { 0, NULL };
1533 * conf->upstream.location = NULL; 1557 * conf->upstream.location = NULL;
1534 * 1558 *
1535 * conf->index.len = 0; 1559 * conf->index.len = 0;
1717 prev->upstream.pass_request_body, 1); 1741 prev->upstream.pass_request_body, 1);
1718 1742
1719 ngx_conf_merge_value(conf->upstream.intercept_errors, 1743 ngx_conf_merge_value(conf->upstream.intercept_errors,
1720 prev->upstream.intercept_errors, 0); 1744 prev->upstream.intercept_errors, 0);
1721 1745
1746 ngx_conf_merge_ptr_value(conf->catch_stderr, prev->catch_stderr, NULL);
1747
1722 1748
1723 ngx_conf_merge_str_value(conf->index, prev->index, ""); 1749 ngx_conf_merge_str_value(conf->index, prev->index, "");
1724 1750
1725 if (conf->upstream.hide_headers == NULL 1751 if (conf->upstream.hide_headers == NULL
1726 && conf->upstream.pass_headers == NULL) 1752 && conf->upstream.pass_headers == NULL)