aboutsummaryrefslogtreecommitdiff
path: root/src/http/modules/ngx_http_fastcgi_module.c
diff options
context:
space:
mode:
authorIgor Sysoev <igor@sysoev.ru>2005-11-09 17:25:55 +0000
committerIgor Sysoev <igor@sysoev.ru>2005-11-09 17:25:55 +0000
commit09c684b2d53b46b6ffb706c686ca4dbed62cf6da (patch)
tree28d1d57070b5e8d95c8608d45678298d63f9621d /src/http/modules/ngx_http_fastcgi_module.c
parent51425a465a22ad2e33e7048b880aa594c376f79c (diff)
downloadnginx-release-0.3.8.tar.gz
nginx-release-0.3.8.zip
nginx-0.3.8-RELEASE importrelease-0.3.8
*) Security: nginx now checks URI got from a backend in "X-Accel-Redirect" header line or in SSI file for the "/../" paths and zeroes. *) Change: nginx now does not treat the empty user name in the "Authorization" header line as valid one. *) Feature: the "ssl_session_timeout" directives of the ngx_http_ssl_module and ngx_imap_ssl_module. *) Feature: the "auth_http_header" directive of the ngx_imap_auth_http_module. *) Feature: the "add_header" directive. *) Feature: the ngx_http_realip_module. *) Feature: the new variables to use in the "log_format" directive: $bytes_sent, $apache_bytes_sent, $status, $time_gmt, $uri, $request_time, $request_length, $upstream_status, $upstream_response_time, $gzip_ratio, $uid_got, $uid_set, $connection, $pipe, and $msec. The parameters in the "%name" form will be canceled soon. *) Change: now the false variable values in the "if" directive are the empty string "" and string starting with "0". *) Bugfix: while using proxied or FastCGI-server nginx may leave connections and temporary files with client requests in open state. *) Bugfix: the worker processes did not flush the buffered logs on graceful exit. *) Bugfix: if the request URI was changes by the "rewrite" directive and the request was proxied in location given by regular expression, then the incorrect request was transferred to backend; the bug had appeared in 0.2.6. *) Bugfix: the "expires" directive did not remove the previous "Expires" header. *) Bugfix: nginx may stop to accept requests if the "rtsig" method and several worker processes were used. *) Bugfix: the "\"" and "\'" escape symbols were incorrectly handled in SSI commands. *) Bugfix: if the response was ended just after the SSI command and gzipping was used, then the response did not transferred complete or did not transferred at all.
Diffstat (limited to 'src/http/modules/ngx_http_fastcgi_module.c')
-rw-r--r--src/http/modules/ngx_http_fastcgi_module.c54
1 files changed, 29 insertions, 25 deletions
diff --git a/src/http/modules/ngx_http_fastcgi_module.c b/src/http/modules/ngx_http_fastcgi_module.c
index d58c7c664..160aacbc3 100644
--- a/src/http/modules/ngx_http_fastcgi_module.c
+++ b/src/http/modules/ngx_http_fastcgi_module.c
@@ -17,6 +17,7 @@ typedef struct {
ngx_str_t index;
+ ngx_array_t *flushes;
ngx_array_t *params_len;
ngx_array_t *params;
ngx_array_t *params_source;
@@ -111,9 +112,8 @@ static ngx_int_t ngx_http_fastcgi_add_variables(ngx_conf_t *cf);
static void *ngx_http_fastcgi_create_loc_conf(ngx_conf_t *cf);
static char *ngx_http_fastcgi_merge_loc_conf(ngx_conf_t *cf,
void *parent, void *child);
-static ngx_http_variable_value_t *
- ngx_http_fastcgi_script_name_variable(ngx_http_request_t *r,
- uintptr_t data);
+static ngx_int_t ngx_http_fastcgi_script_name_variable(ngx_http_request_t *r,
+ ngx_http_variable_value_t *v, uintptr_t data);
static char *ngx_http_fastcgi_pass(ngx_conf_t *cf, ngx_command_t *cmd,
void *conf);
@@ -410,6 +410,9 @@ ngx_http_fastcgi_create_request(ngx_http_request_t *r)
if (flcf->params_len) {
ngx_memzero(&le, sizeof(ngx_http_script_engine_t));
+ ngx_http_script_flush_no_cachable_variables(r, flcf->flushes);
+ le.flushed = 1;
+
le.ip = flcf->params_len->elts;
le.request = r;
@@ -507,6 +510,7 @@ ngx_http_fastcgi_create_request(ngx_http_request_t *r)
e.ip = flcf->params->elts;
e.pos = b->last;
e.request = r;
+ e.flushed = 1;
le.ip = flcf->params_len->elts;
@@ -597,8 +601,8 @@ ngx_http_fastcgi_create_request(ngx_http_request_t *r)
*b->last++ = ch;
}
- b->last = ngx_cpymem(b->last, header[i].value.data,
- header[i].value.len);
+ b->last = ngx_copy(b->last, header[i].value.data,
+ header[i].value.len);
}
}
@@ -1634,9 +1638,10 @@ ngx_http_fastcgi_merge_loc_conf(ngx_conf_t *cf, void *parent, void *child)
}
if (conf->params_source == NULL) {
- conf->params_source = prev->params_source;
+ conf->flushes = prev->flushes;
conf->params_len = prev->params_len;
conf->params = prev->params;
+ conf->params_source = prev->params_source;
if (conf->params_source == NULL) {
return NGX_CONF_OK;
@@ -1647,7 +1652,7 @@ ngx_http_fastcgi_merge_loc_conf(ngx_conf_t *cf, void *parent, void *child)
if (conf->params_len == NULL) {
return NGX_CONF_ERROR;
}
-
+
conf->params = ngx_array_create(cf->pool, 512, 1);
if (conf->params == NULL) {
return NGX_CONF_ERROR;
@@ -1729,6 +1734,7 @@ ngx_http_fastcgi_merge_loc_conf(ngx_conf_t *cf, void *parent, void *child)
sc.cf = cf;
sc.source = &src[i].value;
+ sc.flushes = &conf->flushes;
sc.lengths = &conf->params_len;
sc.values = &conf->params;
@@ -1764,38 +1770,36 @@ ngx_http_fastcgi_merge_loc_conf(ngx_conf_t *cf, void *parent, void *child)
}
-static ngx_http_variable_value_t *
-ngx_http_fastcgi_script_name_variable(ngx_http_request_t *r, uintptr_t data)
+static ngx_int_t
+ngx_http_fastcgi_script_name_variable(ngx_http_request_t *r,
+ ngx_http_variable_value_t *v, uintptr_t data)
{
u_char *p;
- ngx_http_variable_value_t *vv;
ngx_http_fastcgi_loc_conf_t *flcf;
- vv = ngx_palloc(r->pool, sizeof(ngx_http_variable_value_t));
- if (vv == NULL) {
- return NULL;
- }
-
- vv->value = 0;
+ v->valid = 1;
+ v->no_cachable = 0;
+ v->not_found = 0;
flcf = ngx_http_get_module_loc_conf(r, ngx_http_fastcgi_module);
if (r->uri.data[r->uri.len - 1] != '/') {
- vv->text = r->uri;
- return vv;
+ v->len = r->uri.len;
+ v->data = r->uri.data;
+ return NGX_OK;
}
- vv->text.len = r->uri.len + flcf->index.len;
+ v->len = r->uri.len + flcf->index.len;
- vv->text.data = ngx_palloc(r->pool, vv->text.len);
- if (vv->text.data == NULL) {
- return NULL;
+ v->data = ngx_palloc(r->pool, v->len);
+ if (v->data == NULL) {
+ return NGX_ERROR;
}
- p = ngx_cpymem(vv->text.data, r->uri.data, r->uri.len);
+ p = ngx_copy(v->data, r->uri.data, r->uri.len);
ngx_memcpy(p, flcf->index.data, flcf->index.len);
- return vv;
+ return NGX_OK;
}
@@ -1860,7 +1864,7 @@ ngx_http_fastcgi_pass(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
clcf->handler = ngx_http_fastcgi_handler;
- lcf->upstream.location = &clcf->name;
+ lcf->upstream.location = clcf->name;
if (clcf->name.data[clcf->name.len - 1] == '/') {
clcf->auto_redirect = 1;