From 1aae4c3350b6b09373d3656a1ac9df73b622dec4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?agentzh=20=28=E7=AB=A0=E4=BA=A6=E6=98=A5=29?= Date: Sat, 21 Jul 2012 12:01:22 -0700 Subject: [PATCH] removed nginx 1.2.1 patches that are not really used. --- .../nginx-1.2.1-null_character_fixes.patch | 113 ------------------ ...inx-1.2.1-request_body_in_single_buf.patch | 27 ----- ...nginx-1.2.1-request_body_preread_fix.patch | 17 --- ...1.2.1-variable_header_ignore_no_hash.patch | 73 ----------- 4 files changed, 230 deletions(-) delete mode 100644 patches/nginx-1.2.1-null_character_fixes.patch delete mode 100644 patches/nginx-1.2.1-request_body_in_single_buf.patch delete mode 100644 patches/nginx-1.2.1-request_body_preread_fix.patch delete mode 100644 patches/nginx-1.2.1-variable_header_ignore_no_hash.patch diff --git a/patches/nginx-1.2.1-null_character_fixes.patch b/patches/nginx-1.2.1-null_character_fixes.patch deleted file mode 100644 index 940d1ce..0000000 --- a/patches/nginx-1.2.1-null_character_fixes.patch +++ /dev/null @@ -1,113 +0,0 @@ ---- src/http/modules/ngx_http_fastcgi_module.c -+++ src/http/modules/ngx_http_fastcgi_module.c -@@ -1501,10 +1501,10 @@ ngx_http_fastcgi_process_header(ngx_http - h->lowcase_key = h->key.data + h->key.len + 1 - + h->value.len + 1; - -- ngx_cpystrn(h->key.data, r->header_name_start, -- h->key.len + 1); -- ngx_cpystrn(h->value.data, r->header_start, -- h->value.len + 1); -+ ngx_memcpy(h->key.data, r->header_name_start, h->key.len); -+ h->key.data[h->key.len] = '\0'; -+ ngx_memcpy(h->value.data, r->header_start, h->value.len); -+ h->value.data[h->value.len] = '\0'; - } - - h->hash = r->header_hash; ---- src/http/modules/ngx_http_proxy_module.c -+++ src/http/modules/ngx_http_proxy_module.c -@@ -1381,8 +1381,10 @@ ngx_http_proxy_process_header(ngx_http_r - h->value.data = h->key.data + h->key.len + 1; - h->lowcase_key = h->key.data + h->key.len + 1 + h->value.len + 1; - -- ngx_cpystrn(h->key.data, r->header_name_start, h->key.len + 1); -- ngx_cpystrn(h->value.data, r->header_start, h->value.len + 1); -+ ngx_memcpy(h->key.data, r->header_name_start, h->key.len); -+ h->key.data[h->key.len] = '\0'; -+ ngx_memcpy(h->value.data, r->header_start, h->value.len); -+ h->value.data[h->value.len] = '\0'; - - if (h->key.len == r->lowcase_index) { - ngx_memcpy(h->lowcase_key, r->lowcase_header, h->key.len); ---- src/http/modules/ngx_http_scgi_module.c -+++ src/http/modules/ngx_http_scgi_module.c -@@ -941,8 +941,10 @@ ngx_http_scgi_process_header(ngx_http_re - h->value.data = h->key.data + h->key.len + 1; - h->lowcase_key = h->key.data + h->key.len + 1 + h->value.len + 1; - -- ngx_cpystrn(h->key.data, r->header_name_start, h->key.len + 1); -- ngx_cpystrn(h->value.data, r->header_start, h->value.len + 1); -+ ngx_memcpy(h->key.data, r->header_name_start, h->key.len); -+ h->key.data[h->key.len] = '\0'; -+ ngx_memcpy(h->value.data, r->header_start, h->value.len); -+ h->value.data[h->value.len] = '\0'; - - if (h->key.len == r->lowcase_index) { - ngx_memcpy(h->lowcase_key, r->lowcase_header, h->key.len); ---- src/http/modules/ngx_http_uwsgi_module.c -+++ src/http/modules/ngx_http_uwsgi_module.c -@@ -985,8 +985,10 @@ ngx_http_uwsgi_process_header(ngx_http_r - h->value.data = h->key.data + h->key.len + 1; - h->lowcase_key = h->key.data + h->key.len + 1 + h->value.len + 1; - -- ngx_cpystrn(h->key.data, r->header_name_start, h->key.len + 1); -- ngx_cpystrn(h->value.data, r->header_start, h->value.len + 1); -+ ngx_memcpy(h->key.data, r->header_name_start, h->key.len); -+ h->key.data[h->key.len] = '\0'; -+ ngx_memcpy(h->value.data, r->header_start, h->value.len); -+ h->value.data[h->value.len] = '\0'; - - if (h->key.len == r->lowcase_index) { - ngx_memcpy(h->lowcase_key, r->lowcase_header, h->key.len); ---- src/http/ngx_http_parse.c -+++ src/http/ngx_http_parse.c -@@ -874,6 +874,10 @@ ngx_http_parse_header_line(ngx_http_requ - break; - } - -+ if (ch == '\0') { -+ return NGX_HTTP_PARSE_INVALID_HEADER; -+ } -+ - r->invalid_header = 1; - - break; -@@ -936,6 +940,10 @@ ngx_http_parse_header_line(ngx_http_requ - break; - } - -+ if (ch == '\0') { -+ return NGX_HTTP_PARSE_INVALID_HEADER; -+ } -+ - r->invalid_header = 1; - - break; -@@ -954,6 +962,8 @@ ngx_http_parse_header_line(ngx_http_requ - r->header_start = p; - r->header_end = p; - goto done; -+ case '\0': -+ return NGX_HTTP_PARSE_INVALID_HEADER; - default: - r->header_start = p; - state = sw_value; -@@ -975,6 +985,8 @@ ngx_http_parse_header_line(ngx_http_requ - case LF: - r->header_end = p; - goto done; -+ case '\0': -+ return NGX_HTTP_PARSE_INVALID_HEADER; - } - break; - -@@ -988,6 +1000,8 @@ ngx_http_parse_header_line(ngx_http_requ - break; - case LF: - goto done; -+ case '\0': -+ return NGX_HTTP_PARSE_INVALID_HEADER; - default: - state = sw_value; - break; diff --git a/patches/nginx-1.2.1-request_body_in_single_buf.patch b/patches/nginx-1.2.1-request_body_in_single_buf.patch deleted file mode 100644 index 7d50d73..0000000 --- a/patches/nginx-1.2.1-request_body_in_single_buf.patch +++ /dev/null @@ -1,27 +0,0 @@ -# HG changeset patch -# User Maxim Dounin -# Date 1309799136 -14400 -# Node ID 99e276bba8596bc4df9e638482ee413f4c6bf700 -# Parent e7b2f945d55ae44a2295facf9e3336dc4633e5b5 -Core: fix body with request_body_in_single_buf. - -If there were preread data and request body was big enough first part -of request body was duplicated. - -See report here: -http://nginx.org/pipermail/nginx/2011-July/027756.html - -diff --git a/src/http/ngx_http_request_body.c b/src/http/ngx_http_request_body.c ---- a/src/http/ngx_http_request_body.c -+++ b/src/http/ngx_http_request_body.c -@@ -372,7 +372,9 @@ ngx_http_do_read_client_request_body(ngx - } - } - -- if (r->request_body_in_file_only && rb->bufs->next) { -+ if (rb->bufs->next -+ && (r->request_body_in_file_only || r->request_body_in_single_buf)) -+ { - rb->bufs = rb->bufs->next; - } - diff --git a/patches/nginx-1.2.1-request_body_preread_fix.patch b/patches/nginx-1.2.1-request_body_preread_fix.patch deleted file mode 100644 index 850b122..0000000 --- a/patches/nginx-1.2.1-request_body_preread_fix.patch +++ /dev/null @@ -1,17 +0,0 @@ -# HG changeset patch -# User Maxim Dounin -# Date 1309776931 -14400 -# Node ID e7b2f945d55ae44a2295facf9e3336dc4633e5b5 -# Parent 610e909bb9e29766188aa86fae3abe0bd3432940 -Core: fix body if it's preread and there are extra data. - ---- nginx-1.2.1/src/http/ngx_http_request_body.c 2011-07-05 12:11:21.619264633 +0800 -+++ nginx-1.2.1-patched/src/http/ngx_http_request_body.c 2011-07-05 12:14:30.694321554 +0800 -@@ -141,6 +141,7 @@ - - /* the whole request body was pre-read */ - -+ b->last = b->pos + r->headers_in.content_length_n; - r->header_in->pos += (size_t) r->headers_in.content_length_n; - r->request_length += r->headers_in.content_length_n; - diff --git a/patches/nginx-1.2.1-variable_header_ignore_no_hash.patch b/patches/nginx-1.2.1-variable_header_ignore_no_hash.patch deleted file mode 100644 index f0f0eec..0000000 --- a/patches/nginx-1.2.1-variable_header_ignore_no_hash.patch +++ /dev/null @@ -1,73 +0,0 @@ ---- nginx-1.2.1/src/http/ngx_http_variables.c 2011-05-30 20:36:17.000000000 +0800 -+++ nginx-1.2.1-patched/src/http/ngx_http_variables.c 2011-11-08 22:21:55.229247198 +0800 -@@ -648,7 +648,17 @@ - - a = (ngx_array_t *) ((char *) r + data); - -- n = a->nelts; -+ h = a->elts; -+ n = 0; -+ -+ for (i = 0; i < a->nelts; i++) { -+ -+ if (h[i]->hash == 0) { -+ continue; -+ } -+ -+ n++; -+ } - - if (n == 0) { - v->not_found = 1; -@@ -659,9 +669,7 @@ - v->no_cacheable = 0; - v->not_found = 0; - -- h = a->elts; -- -- if (n == 1) { -+ if (n == 1 && a->nelts == 1) { - v->len = (*h)->value.len; - v->data = (*h)->value.data; - -@@ -670,7 +678,12 @@ - - len = - (ssize_t) (sizeof("; ") - 1); - -- for (i = 0; i < n; i++) { -+ for (i = 0; i < a->nelts; i++) { -+ -+ if (h[i]->hash == 0) { -+ continue; -+ } -+ - len += h[i]->value.len + sizeof("; ") - 1; - } - -@@ -683,9 +696,14 @@ - v->data = p; - - for (i = 0; /* void */ ; i++) { -+ -+ if (h[i]->hash == 0) { -+ continue; -+ } -+ - p = ngx_copy(p, h[i]->value.data, h[i]->value.len); - -- if (i == n - 1) { -+ if (--n == 0) { - break; - } - -@@ -738,6 +756,10 @@ - i = 0; - } - -+ if (header[i].hash == 0) { -+ continue; -+ } -+ - for (n = 0; n + prefix < var->len && n < header[i].key.len; n++) { - ch = header[i].key.data[n]; -