aboutsummaryrefslogtreecommitdiff
path: root/src/http/modules
diff options
context:
space:
mode:
Diffstat (limited to 'src/http/modules')
-rw-r--r--src/http/modules/ngx_http_fastcgi_module.c33
-rw-r--r--src/http/modules/ngx_http_headers_filter_module.c23
2 files changed, 28 insertions, 28 deletions
diff --git a/src/http/modules/ngx_http_fastcgi_module.c b/src/http/modules/ngx_http_fastcgi_module.c
index 480a22895..c5a2c4bc4 100644
--- a/src/http/modules/ngx_http_fastcgi_module.c
+++ b/src/http/modules/ngx_http_fastcgi_module.c
@@ -144,15 +144,6 @@ static ngx_http_fastcgi_request_start_t ngx_http_fastcgi_request_start = {
};
-#if 0
-static ngx_str_t ngx_http_fastcgi_methods[] = {
- ngx_string("GET"),
- ngx_string("HEAD"),
- ngx_string("POST")
-};
-#endif
-
-
static ngx_str_t ngx_http_fastcgi_script_name =
ngx_string("fastcgi_script_name");
@@ -428,9 +419,7 @@ ngx_http_fastcgi_create_request(ngx_http_request_t *r)
}
le.ip += sizeof(uintptr_t);
- if (val_len) {
- len += 1 + key_len + ((val_len > 127) ? 4 : 1) + val_len;
- }
+ len += 1 + key_len + ((val_len > 127) ? 4 : 1) + val_len;
}
}
@@ -527,22 +516,18 @@ ngx_http_fastcgi_create_request(ngx_http_request_t *r)
}
le.ip += sizeof(uintptr_t);
- if (val_len) {
- *e.pos++ = (u_char) key_len;
+ *e.pos++ = (u_char) key_len;
- if (val_len > 127) {
- *e.pos++ = (u_char) (((val_len >> 24) & 0x7f) | 0x80);
- *e.pos++ = (u_char) ((val_len >> 16) & 0xff);
- *e.pos++ = (u_char) ((val_len >> 8) & 0xff);
- *e.pos++ = (u_char) (val_len & 0xff);
+ if (val_len > 127) {
+ *e.pos++ = (u_char) (((val_len >> 24) & 0x7f) | 0x80);
+ *e.pos++ = (u_char) ((val_len >> 16) & 0xff);
+ *e.pos++ = (u_char) ((val_len >> 8) & 0xff);
+ *e.pos++ = (u_char) (val_len & 0xff);
- } else {
- *e.pos++ = (u_char) val_len;
- }
+ } else {
+ *e.pos++ = (u_char) val_len;
}
- e.skip = val_len ? 0 : 1;
-
while (*(uintptr_t *) e.ip) {
code = *(ngx_http_script_code_pt *) e.ip;
code((ngx_http_script_engine_t *) &e);
diff --git a/src/http/modules/ngx_http_headers_filter_module.c b/src/http/modules/ngx_http_headers_filter_module.c
index f27ab476d..91bebdc50 100644
--- a/src/http/modules/ngx_http_headers_filter_module.c
+++ b/src/http/modules/ngx_http_headers_filter_module.c
@@ -73,7 +73,7 @@ ngx_http_headers_filter(ngx_http_request_t *r)
{
size_t len;
ngx_uint_t i;
- ngx_table_elt_t *expires, *cc;
+ ngx_table_elt_t *expires, *cc, **ccp;
ngx_http_headers_conf_t *conf;
if (r->headers_out.status != NGX_HTTP_OK || r->main) {
@@ -103,9 +103,20 @@ ngx_http_headers_filter(ngx_http_request_t *r)
len = sizeof("Mon, 28 Sep 1970 06:00:00 GMT");
expires->value.len = len - 1;
- cc = r->headers_out.cache_control.elts;
+ ccp = r->headers_out.cache_control.elts;
- if (cc == NULL) {
+ if (ccp == NULL) {
+
+ if (ngx_array_init(&r->headers_out.cache_control, r->pool,
+ 1, sizeof(ngx_table_elt_t *)) != NGX_OK)
+ {
+ return NGX_ERROR;
+ }
+
+ ccp = ngx_array_push(&r->headers_out.cache_control);
+ if (ccp == NULL) {
+ return NGX_ERROR;
+ }
cc = ngx_list_push(&r->headers_out.headers);
if (cc == NULL) {
@@ -116,10 +127,14 @@ ngx_http_headers_filter(ngx_http_request_t *r)
cc->key.len = sizeof("Cache-Control") - 1;
cc->key.data = (u_char *) "Cache-Control";
+ *ccp = cc;
+
} else {
for (i = 1; i < r->headers_out.cache_control.nelts; i++) {
- cc[i].hash = 0;
+ ccp[i]->hash = 0;
}
+
+ cc = ccp[0];
}
if (conf->expires == NGX_HTTP_EXPIRES_EPOCH) {