Mercurial > hg > nginx-vendor-1-0
comparison src/http/modules/ngx_http_fastcgi_module.c @ 320:95183808f549 NGINX_0_6_4
nginx 0.6.4
*) Security: the "msie_refresh" directive allowed XSS.
Thanks to Maxim Boguk.
*) Change: the "proxy_store" and "fastcgi_store" directives were
changed.
*) Feature: the "proxy_store_access" and "fastcgi_store_access"
directives.
*) Bugfix: nginx did not work on Solaris/sparc64 if it was built by Sun
Studio.
Thanks to Andrei Nigmatulin.
*) Workaround: for Sun Studio 12.
Thanks to Jiang Hong.
author | Igor Sysoev <http://sysoev.ru> |
---|---|
date | Tue, 17 Jul 2007 00:00:00 +0400 |
parents | fc223117327f |
children | 3a91bfeffaba |
comparison
equal
deleted
inserted
replaced
319:6ccd0af7f704 | 320:95183808f549 |
---|---|
122 static ngx_int_t ngx_http_fastcgi_script_name_variable(ngx_http_request_t *r, | 122 static ngx_int_t ngx_http_fastcgi_script_name_variable(ngx_http_request_t *r, |
123 ngx_http_variable_value_t *v, uintptr_t data); | 123 ngx_http_variable_value_t *v, uintptr_t data); |
124 | 124 |
125 static char *ngx_http_fastcgi_pass(ngx_conf_t *cf, ngx_command_t *cmd, | 125 static char *ngx_http_fastcgi_pass(ngx_conf_t *cf, ngx_command_t *cmd, |
126 void *conf); | 126 void *conf); |
127 static char *ngx_http_fastcgi_store(ngx_conf_t *cf, ngx_command_t *cmd, | |
128 void *conf); | |
127 static char *ngx_http_fastcgi_lowat_check(ngx_conf_t *cf, void *post, | 129 static char *ngx_http_fastcgi_lowat_check(ngx_conf_t *cf, void *post, |
128 void *data); | 130 void *data); |
129 | 131 |
130 static char *ngx_http_fastcgi_upstream_max_fails_unsupported(ngx_conf_t *cf, | 132 static char *ngx_http_fastcgi_upstream_max_fails_unsupported(ngx_conf_t *cf, |
131 ngx_command_t *cmd, void *conf); | 133 ngx_command_t *cmd, void *conf); |
199 NGX_HTTP_LOC_CONF_OFFSET, | 201 NGX_HTTP_LOC_CONF_OFFSET, |
200 offsetof(ngx_http_fastcgi_loc_conf_t, index), | 202 offsetof(ngx_http_fastcgi_loc_conf_t, index), |
201 NULL }, | 203 NULL }, |
202 | 204 |
203 { ngx_string("fastcgi_store"), | 205 { ngx_string("fastcgi_store"), |
206 NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_TAKE1, | |
207 ngx_http_fastcgi_store, | |
208 NGX_HTTP_LOC_CONF_OFFSET, | |
209 0, | |
210 NULL }, | |
211 | |
212 { ngx_string("fastcgi_store_access"), | |
204 NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_TAKE123, | 213 NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_TAKE123, |
205 ngx_conf_set_access_slot, | 214 ngx_conf_set_access_slot, |
206 NGX_HTTP_LOC_CONF_OFFSET, | 215 NGX_HTTP_LOC_CONF_OFFSET, |
207 offsetof(ngx_http_fastcgi_loc_conf_t, upstream.store), | 216 offsetof(ngx_http_fastcgi_loc_conf_t, upstream.store_access), |
208 NULL }, | 217 NULL }, |
209 | 218 |
210 { ngx_string("fastcgi_ignore_client_abort"), | 219 { ngx_string("fastcgi_ignore_client_abort"), |
211 NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_FLAG, | 220 NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_FLAG, |
212 ngx_conf_set_flag_slot, | 221 ngx_conf_set_flag_slot, |
1633 * conf->upstream.pass_headers = NULL; | 1642 * conf->upstream.pass_headers = NULL; |
1634 * conf->upstream.catch_stderr = NULL; | 1643 * conf->upstream.catch_stderr = NULL; |
1635 * conf->upstream.schema = { 0, NULL }; | 1644 * conf->upstream.schema = { 0, NULL }; |
1636 * conf->upstream.uri = { 0, NULL }; | 1645 * conf->upstream.uri = { 0, NULL }; |
1637 * conf->upstream.location = NULL; | 1646 * conf->upstream.location = NULL; |
1647 * conf->upstream.store_lengths = NULL; | |
1648 * conf->upstream.store_values = NULL; | |
1638 * | 1649 * |
1639 * conf->index.len = 0; | 1650 * conf->index.len = 0; |
1640 * conf->index.data = NULL; | 1651 * conf->index.data = NULL; |
1641 */ | 1652 */ |
1642 | 1653 |
1643 conf->upstream.store = NGX_CONF_UNSET_UINT; | 1654 conf->upstream.store = NGX_CONF_UNSET; |
1655 conf->upstream.store_access = NGX_CONF_UNSET_UINT; | |
1644 conf->upstream.buffering = NGX_CONF_UNSET; | 1656 conf->upstream.buffering = NGX_CONF_UNSET; |
1645 conf->upstream.ignore_client_abort = NGX_CONF_UNSET; | 1657 conf->upstream.ignore_client_abort = NGX_CONF_UNSET; |
1646 | 1658 |
1647 conf->upstream.connect_timeout = NGX_CONF_UNSET_MSEC; | 1659 conf->upstream.connect_timeout = NGX_CONF_UNSET_MSEC; |
1648 conf->upstream.send_timeout = NGX_CONF_UNSET_MSEC; | 1660 conf->upstream.send_timeout = NGX_CONF_UNSET_MSEC; |
1683 ngx_hash_key_t *hk; | 1695 ngx_hash_key_t *hk; |
1684 ngx_hash_init_t hash; | 1696 ngx_hash_init_t hash; |
1685 ngx_http_script_compile_t sc; | 1697 ngx_http_script_compile_t sc; |
1686 ngx_http_script_copy_code_t *copy; | 1698 ngx_http_script_copy_code_t *copy; |
1687 | 1699 |
1688 ngx_conf_merge_uint_value(conf->upstream.store, | 1700 if (conf->upstream.store != 0) { |
1689 prev->upstream.store, 0); | 1701 ngx_conf_merge_value(conf->upstream.store, |
1702 prev->upstream.store, 0); | |
1703 | |
1704 if (conf->upstream.store_lengths == NULL) { | |
1705 conf->upstream.store_lengths = prev->upstream.store_lengths; | |
1706 conf->upstream.store_values = prev->upstream.store_values; | |
1707 } | |
1708 } | |
1709 | |
1710 ngx_conf_merge_uint_value(conf->upstream.store_access, | |
1711 prev->upstream.store_access, 0600); | |
1690 | 1712 |
1691 ngx_conf_merge_value(conf->upstream.buffering, | 1713 ngx_conf_merge_value(conf->upstream.buffering, |
1692 prev->upstream.buffering, 1); | 1714 prev->upstream.buffering, 1); |
1693 | 1715 |
1694 ngx_conf_merge_value(conf->upstream.ignore_client_abort, | 1716 ngx_conf_merge_value(conf->upstream.ignore_client_abort, |
2157 return NGX_CONF_OK; | 2179 return NGX_CONF_OK; |
2158 } | 2180 } |
2159 | 2181 |
2160 | 2182 |
2161 static char * | 2183 static char * |
2184 ngx_http_fastcgi_store(ngx_conf_t *cf, ngx_command_t *cmd, void *conf) | |
2185 { | |
2186 ngx_http_fastcgi_loc_conf_t *flcf = conf; | |
2187 | |
2188 ngx_str_t *value; | |
2189 ngx_http_script_compile_t sc; | |
2190 | |
2191 if (flcf->upstream.store != NGX_CONF_UNSET || flcf->upstream.store_lengths) | |
2192 { | |
2193 return "is duplicate"; | |
2194 } | |
2195 | |
2196 value = cf->args->elts; | |
2197 | |
2198 if (ngx_strcmp(value[1].data, "on") == 0) { | |
2199 flcf->upstream.store = 1; | |
2200 return NGX_CONF_OK; | |
2201 } | |
2202 | |
2203 if (ngx_strcmp(value[1].data, "off") == 0) { | |
2204 flcf->upstream.store = 0; | |
2205 return NGX_CONF_OK; | |
2206 } | |
2207 | |
2208 /* include the terminating '\0' into script */ | |
2209 value[1].len++; | |
2210 | |
2211 ngx_memzero(&sc, sizeof(ngx_http_script_compile_t)); | |
2212 | |
2213 sc.cf = cf; | |
2214 sc.source = &value[1]; | |
2215 sc.lengths = &flcf->upstream.store_lengths; | |
2216 sc.values = &flcf->upstream.store_values; | |
2217 sc.variables = ngx_http_script_variables_count(&value[1]);; | |
2218 sc.complete_lengths = 1; | |
2219 sc.complete_values = 1; | |
2220 | |
2221 if (ngx_http_script_compile(&sc) != NGX_OK) { | |
2222 return NGX_CONF_ERROR; | |
2223 } | |
2224 | |
2225 return NGX_CONF_OK; | |
2226 } | |
2227 | |
2228 | |
2229 static char * | |
2162 ngx_http_fastcgi_lowat_check(ngx_conf_t *cf, void *post, void *data) | 2230 ngx_http_fastcgi_lowat_check(ngx_conf_t *cf, void *post, void *data) |
2163 { | 2231 { |
2164 #if (NGX_FREEBSD) | 2232 #if (NGX_FREEBSD) |
2165 ssize_t *np = data; | 2233 ssize_t *np = data; |
2166 | 2234 |