comparison src/http/modules/ngx_http_fastcgi_module.c @ 322:56675f002600 NGINX_0_5_31

nginx 0.5.31 *) Feature: named locations. *) Feature: the "proxy_store" and "fastcgi_store" directives. *) Feature: the "proxy_store_access" and "fastcgi_store_access" directives.
author Igor Sysoev <http://sysoev.ru>
date Wed, 15 Aug 2007 00:00:00 +0400
parents 3021f899881a
children 7cf404023f50
comparison
equal deleted inserted replaced
321:6762c33c7da8 322:56675f002600
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);
196 { ngx_string("fastcgi_index"), 198 { ngx_string("fastcgi_index"),
197 NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_TAKE1, 199 NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_TAKE1,
198 ngx_conf_set_str_slot, 200 ngx_conf_set_str_slot,
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),
203 NULL },
204
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"),
213 NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_TAKE123,
214 ngx_conf_set_access_slot,
215 NGX_HTTP_LOC_CONF_OFFSET,
216 offsetof(ngx_http_fastcgi_loc_conf_t, upstream.store_access),
201 NULL }, 217 NULL },
202 218
203 { ngx_string("fastcgi_ignore_client_abort"), 219 { ngx_string("fastcgi_ignore_client_abort"),
204 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,
205 ngx_conf_set_flag_slot, 221 ngx_conf_set_flag_slot,
1626 * conf->upstream.pass_headers = NULL; 1642 * conf->upstream.pass_headers = NULL;
1627 * conf->upstream.catch_stderr = NULL; 1643 * conf->upstream.catch_stderr = NULL;
1628 * conf->upstream.schema = { 0, NULL }; 1644 * conf->upstream.schema = { 0, NULL };
1629 * conf->upstream.uri = { 0, NULL }; 1645 * conf->upstream.uri = { 0, NULL };
1630 * conf->upstream.location = NULL; 1646 * conf->upstream.location = NULL;
1647 * conf->upstream.store_lengths = NULL;
1648 * conf->upstream.store_values = NULL;
1631 * 1649 *
1632 * conf->index.len = 0; 1650 * conf->index.len = 0;
1633 * conf->index.data = NULL; 1651 * conf->index.data = NULL;
1634 */ 1652 */
1635 1653
1654 conf->upstream.store = NGX_CONF_UNSET;
1655 conf->upstream.store_access = NGX_CONF_UNSET_UINT;
1636 conf->upstream.buffering = NGX_CONF_UNSET; 1656 conf->upstream.buffering = NGX_CONF_UNSET;
1637 conf->upstream.ignore_client_abort = NGX_CONF_UNSET; 1657 conf->upstream.ignore_client_abort = NGX_CONF_UNSET;
1638 1658
1639 conf->upstream.connect_timeout = NGX_CONF_UNSET_MSEC; 1659 conf->upstream.connect_timeout = NGX_CONF_UNSET_MSEC;
1640 conf->upstream.send_timeout = NGX_CONF_UNSET_MSEC; 1660 conf->upstream.send_timeout = NGX_CONF_UNSET_MSEC;
1675 ngx_hash_key_t *hk; 1695 ngx_hash_key_t *hk;
1676 ngx_hash_init_t hash; 1696 ngx_hash_init_t hash;
1677 ngx_http_script_compile_t sc; 1697 ngx_http_script_compile_t sc;
1678 ngx_http_script_copy_code_t *copy; 1698 ngx_http_script_copy_code_t *copy;
1679 1699
1700 if (conf->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);
1712
1680 ngx_conf_merge_value(conf->upstream.buffering, 1713 ngx_conf_merge_value(conf->upstream.buffering,
1681 prev->upstream.buffering, 1); 1714 prev->upstream.buffering, 1);
1682 1715
1683 ngx_conf_merge_value(conf->upstream.ignore_client_abort, 1716 ngx_conf_merge_value(conf->upstream.ignore_client_abort,
1684 prev->upstream.ignore_client_abort, 0); 1717 prev->upstream.ignore_client_abort, 0);
2146 return NGX_CONF_OK; 2179 return NGX_CONF_OK;
2147 } 2180 }
2148 2181
2149 2182
2150 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 *
2151 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)
2152 { 2231 {
2153 #if (NGX_FREEBSD) 2232 #if (NGX_FREEBSD)
2154 ssize_t *np = data; 2233 ssize_t *np = data;
2155 2234