comparison src/http/modules/ngx_http_fastcgi_handler.c @ 30:e1ada20fc595 NGINX_0_1_15

nginx 0.1.15 *) Bugfix: the error while the connecting to the FastCGI server caused segmentation fault. *) Bugfix: the correct handling of the regular expression, that has different number of the captures and substitutions. *) Feature: the location, that is passed to the FastCGI server, can be regular expression. *) Bugfix: the FastCGI's parameter REQUEST_URI is now passed with the arguments and in the original state. *) Bugfix: the ngx_http_rewrite_module module was required to be built to use the regular expressions in locations. *) Bugfix: the directive "proxy_preserve_host on" adds port 80 to the "Host" headers, if upstream listen on port 80; bug appeared in 0.1.14. *) Bugfix: the same paths in autoconfiguration parameters --http-client-body-temp-path=PATH and --http-proxy-temp-path=PATH, or --http-client-body-temp-path=PATH and --http-fastcgi-temp-path=PATH caused segmentation fault.
author Igor Sysoev <http://sysoev.ru>
date Wed, 19 Jan 2005 00:00:00 +0300
parents 7ca9bdc82b3f
children da8c190bdaba
comparison
equal deleted inserted replaced
29:3efadd1f18f7 30:e1ada20fc595
140 static ngx_str_t ngx_http_fastcgi_methods[] = { 140 static ngx_str_t ngx_http_fastcgi_methods[] = {
141 ngx_string("GET"), 141 ngx_string("GET"),
142 ngx_string("HEAD"), 142 ngx_string("HEAD"),
143 ngx_string("POST") 143 ngx_string("POST")
144 }; 144 };
145
146
147 static ngx_str_t ngx_http_fastcgi_uri = ngx_string("/");
145 148
146 149
147 static ngx_http_header_t ngx_http_fastcgi_headers_in[] = { 150 static ngx_http_header_t ngx_http_fastcgi_headers_in[] = {
148 { ngx_string("Status"), offsetof(ngx_http_fastcgi_headers_in_t, status) }, 151 { ngx_string("Status"), offsetof(ngx_http_fastcgi_headers_in_t, status) },
149 152
472 if (flcf->params & NGX_HTTP_FASTCGI_REDIRECT_STATUS) { 475 if (flcf->params & NGX_HTTP_FASTCGI_REDIRECT_STATUS) {
473 len += 1 + 1 + sizeof("REDIRECT_STATUS200") - 1; 476 len += 1 + 1 + sizeof("REDIRECT_STATUS200") - 1;
474 } 477 }
475 478
476 if (flcf->params & NGX_HTTP_FASTCGI_REQUEST_URI) { 479 if (flcf->params & NGX_HTTP_FASTCGI_REQUEST_URI) {
477 len += 1 + ((r->uri.len > 127) ? 4 : 1) 480 len += 1 + ((r->unparsed_uri.len > 127) ? 4 : 1)
478 + sizeof("REQUEST_URI") - 1 + r->uri.len; 481 + sizeof("REQUEST_URI") - 1 + r->unparsed_uri.len;
479 } 482 }
480 483
481 if (flcf->params & NGX_HTTP_FASTCGI_SCRIPT_NAME) { 484 if (flcf->params & NGX_HTTP_FASTCGI_SCRIPT_NAME) {
482 len += 1 + ((r->uri.len + index > 127) ? 4 : 1) 485 len += 1 + ((r->uri.len + index > 127) ? 4 : 1)
483 + sizeof("SCRIPT_NAME") - 1 + r->uri.len + index ; 486 + sizeof("SCRIPT_NAME") - 1 + r->uri.len + index ;
732 735
733 736
734 if (flcf->params & NGX_HTTP_FASTCGI_REQUEST_URI) { 737 if (flcf->params & NGX_HTTP_FASTCGI_REQUEST_URI) {
735 *b->last++ = sizeof("REQUEST_URI") - 1; 738 *b->last++ = sizeof("REQUEST_URI") - 1;
736 739
737 len = r->uri.len; 740 len = r->unparsed_uri.len;
738 if (len > 127) { 741 if (len > 127) {
739 *b->last++ = (u_char) (((len >> 24) & 0x7f) | 0x80); 742 *b->last++ = (u_char) (((len >> 24) & 0x7f) | 0x80);
740 *b->last++ = (u_char) ((len >> 16) & 0xff); 743 *b->last++ = (u_char) ((len >> 16) & 0xff);
741 *b->last++ = (u_char) ((len >> 8) & 0xff); 744 *b->last++ = (u_char) ((len >> 8) & 0xff);
742 *b->last++ = (u_char) (len & 0xff); 745 *b->last++ = (u_char) (len & 0xff);
744 } else { 747 } else {
745 *b->last++ = (u_char) len; 748 *b->last++ = (u_char) len;
746 } 749 }
747 750
748 b->last = ngx_cpymem(b->last, "REQUEST_URI", sizeof("REQUEST_URI") - 1); 751 b->last = ngx_cpymem(b->last, "REQUEST_URI", sizeof("REQUEST_URI") - 1);
749 b->last = ngx_cpymem(b->last, r->uri.data, len); 752 b->last = ngx_cpymem(b->last, r->unparsed_uri.data, len);
750 } 753 }
751 754
752 755
753 if (flcf->params & NGX_HTTP_FASTCGI_SCRIPT_NAME) { 756 if (flcf->params & NGX_HTTP_FASTCGI_SCRIPT_NAME) {
754 *b->last++ = sizeof("SCRIPT_NAME") - 1; 757 *b->last++ = sizeof("SCRIPT_NAME") - 1;
1716 ngx_memzero(&unix_upstream, sizeof(ngx_unix_domain_upstream_t)); 1719 ngx_memzero(&unix_upstream, sizeof(ngx_unix_domain_upstream_t));
1717 1720
1718 unix_upstream.name = value[1]; 1721 unix_upstream.name = value[1];
1719 unix_upstream.url = value[1]; 1722 unix_upstream.url = value[1];
1720 1723
1721
1722 if (!(lcf->peers = ngx_unix_upstream_parse(cf, &unix_upstream))) { 1724 if (!(lcf->peers = ngx_unix_upstream_parse(cf, &unix_upstream))) {
1723 return NGX_CONF_ERROR; 1725 return NGX_CONF_ERROR;
1724 } 1726 }
1725 1727
1726 #else 1728 #else
1742 } 1744 }
1743 } 1745 }
1744 1746
1745 clcf = ngx_http_conf_get_module_loc_conf(cf, ngx_http_core_module); 1747 clcf = ngx_http_conf_get_module_loc_conf(cf, ngx_http_core_module);
1746 1748
1747 lcf->location = &clcf->name;
1748 clcf->handler = ngx_http_fastcgi_handler; 1749 clcf->handler = ngx_http_fastcgi_handler;
1750
1751 lcf->location = clcf->regex ? &ngx_http_fastcgi_uri: &clcf->name;
1749 1752
1750 if (clcf->name.data[clcf->name.len - 1] == '/') { 1753 if (clcf->name.data[clcf->name.len - 1] == '/') {
1751 clcf->auto_redirect = 1; 1754 clcf->auto_redirect = 1;
1752 } 1755 }
1753 1756