Skip to content

Commit 0975adf

Browse files
committed
merged master to nginx-1.1.x.
2 parents 05c914e + 45eb5fd commit 0975adf

File tree

3 files changed

+231
-2
lines changed

3 files changed

+231
-2
lines changed
Lines changed: 113 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,113 @@
1+
--- src/http/modules/ngx_http_fastcgi_module.c
2+
+++ src/http/modules/ngx_http_fastcgi_module.c
3+
@@ -1501,10 +1501,10 @@ ngx_http_fastcgi_process_header(ngx_http
4+
h->lowcase_key = h->key.data + h->key.len + 1
5+
+ h->value.len + 1;
6+
7+
- ngx_cpystrn(h->key.data, r->header_name_start,
8+
- h->key.len + 1);
9+
- ngx_cpystrn(h->value.data, r->header_start,
10+
- h->value.len + 1);
11+
+ ngx_memcpy(h->key.data, r->header_name_start, h->key.len);
12+
+ h->key.data[h->key.len] = '\0';
13+
+ ngx_memcpy(h->value.data, r->header_start, h->value.len);
14+
+ h->value.data[h->value.len] = '\0';
15+
}
16+
17+
h->hash = r->header_hash;
18+
--- src/http/modules/ngx_http_proxy_module.c
19+
+++ src/http/modules/ngx_http_proxy_module.c
20+
@@ -1381,8 +1381,10 @@ ngx_http_proxy_process_header(ngx_http_r
21+
h->value.data = h->key.data + h->key.len + 1;
22+
h->lowcase_key = h->key.data + h->key.len + 1 + h->value.len + 1;
23+
24+
- ngx_cpystrn(h->key.data, r->header_name_start, h->key.len + 1);
25+
- ngx_cpystrn(h->value.data, r->header_start, h->value.len + 1);
26+
+ ngx_memcpy(h->key.data, r->header_name_start, h->key.len);
27+
+ h->key.data[h->key.len] = '\0';
28+
+ ngx_memcpy(h->value.data, r->header_start, h->value.len);
29+
+ h->value.data[h->value.len] = '\0';
30+
31+
if (h->key.len == r->lowcase_index) {
32+
ngx_memcpy(h->lowcase_key, r->lowcase_header, h->key.len);
33+
--- src/http/modules/ngx_http_scgi_module.c
34+
+++ src/http/modules/ngx_http_scgi_module.c
35+
@@ -941,8 +941,10 @@ ngx_http_scgi_process_header(ngx_http_re
36+
h->value.data = h->key.data + h->key.len + 1;
37+
h->lowcase_key = h->key.data + h->key.len + 1 + h->value.len + 1;
38+
39+
- ngx_cpystrn(h->key.data, r->header_name_start, h->key.len + 1);
40+
- ngx_cpystrn(h->value.data, r->header_start, h->value.len + 1);
41+
+ ngx_memcpy(h->key.data, r->header_name_start, h->key.len);
42+
+ h->key.data[h->key.len] = '\0';
43+
+ ngx_memcpy(h->value.data, r->header_start, h->value.len);
44+
+ h->value.data[h->value.len] = '\0';
45+
46+
if (h->key.len == r->lowcase_index) {
47+
ngx_memcpy(h->lowcase_key, r->lowcase_header, h->key.len);
48+
--- src/http/modules/ngx_http_uwsgi_module.c
49+
+++ src/http/modules/ngx_http_uwsgi_module.c
50+
@@ -985,8 +985,10 @@ ngx_http_uwsgi_process_header(ngx_http_r
51+
h->value.data = h->key.data + h->key.len + 1;
52+
h->lowcase_key = h->key.data + h->key.len + 1 + h->value.len + 1;
53+
54+
- ngx_cpystrn(h->key.data, r->header_name_start, h->key.len + 1);
55+
- ngx_cpystrn(h->value.data, r->header_start, h->value.len + 1);
56+
+ ngx_memcpy(h->key.data, r->header_name_start, h->key.len);
57+
+ h->key.data[h->key.len] = '\0';
58+
+ ngx_memcpy(h->value.data, r->header_start, h->value.len);
59+
+ h->value.data[h->value.len] = '\0';
60+
61+
if (h->key.len == r->lowcase_index) {
62+
ngx_memcpy(h->lowcase_key, r->lowcase_header, h->key.len);
63+
--- src/http/ngx_http_parse.c
64+
+++ src/http/ngx_http_parse.c
65+
@@ -874,6 +874,10 @@ ngx_http_parse_header_line(ngx_http_requ
66+
break;
67+
}
68+
69+
+ if (ch == '\0') {
70+
+ return NGX_HTTP_PARSE_INVALID_HEADER;
71+
+ }
72+
+
73+
r->invalid_header = 1;
74+
75+
break;
76+
@@ -936,6 +940,10 @@ ngx_http_parse_header_line(ngx_http_requ
77+
break;
78+
}
79+
80+
+ if (ch == '\0') {
81+
+ return NGX_HTTP_PARSE_INVALID_HEADER;
82+
+ }
83+
+
84+
r->invalid_header = 1;
85+
86+
break;
87+
@@ -954,6 +962,8 @@ ngx_http_parse_header_line(ngx_http_requ
88+
r->header_start = p;
89+
r->header_end = p;
90+
goto done;
91+
+ case '\0':
92+
+ return NGX_HTTP_PARSE_INVALID_HEADER;
93+
default:
94+
r->header_start = p;
95+
state = sw_value;
96+
@@ -975,6 +985,8 @@ ngx_http_parse_header_line(ngx_http_requ
97+
case LF:
98+
r->header_end = p;
99+
goto done;
100+
+ case '\0':
101+
+ return NGX_HTTP_PARSE_INVALID_HEADER;
102+
}
103+
break;
104+
105+
@@ -988,6 +1000,8 @@ ngx_http_parse_header_line(ngx_http_requ
106+
break;
107+
case LF:
108+
goto done;
109+
+ case '\0':
110+
+ return NGX_HTTP_PARSE_INVALID_HEADER;
111+
default:
112+
state = sw_value;
113+
break;
Lines changed: 113 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,113 @@
1+
--- src/http/modules/ngx_http_fastcgi_module.c
2+
+++ src/http/modules/ngx_http_fastcgi_module.c
3+
@@ -1501,10 +1501,10 @@ ngx_http_fastcgi_process_header(ngx_http
4+
h->lowcase_key = h->key.data + h->key.len + 1
5+
+ h->value.len + 1;
6+
7+
- ngx_cpystrn(h->key.data, r->header_name_start,
8+
- h->key.len + 1);
9+
- ngx_cpystrn(h->value.data, r->header_start,
10+
- h->value.len + 1);
11+
+ ngx_memcpy(h->key.data, r->header_name_start, h->key.len);
12+
+ h->key.data[h->key.len] = '\0';
13+
+ ngx_memcpy(h->value.data, r->header_start, h->value.len);
14+
+ h->value.data[h->value.len] = '\0';
15+
}
16+
17+
h->hash = r->header_hash;
18+
--- src/http/modules/ngx_http_proxy_module.c
19+
+++ src/http/modules/ngx_http_proxy_module.c
20+
@@ -1381,8 +1381,10 @@ ngx_http_proxy_process_header(ngx_http_r
21+
h->value.data = h->key.data + h->key.len + 1;
22+
h->lowcase_key = h->key.data + h->key.len + 1 + h->value.len + 1;
23+
24+
- ngx_cpystrn(h->key.data, r->header_name_start, h->key.len + 1);
25+
- ngx_cpystrn(h->value.data, r->header_start, h->value.len + 1);
26+
+ ngx_memcpy(h->key.data, r->header_name_start, h->key.len);
27+
+ h->key.data[h->key.len] = '\0';
28+
+ ngx_memcpy(h->value.data, r->header_start, h->value.len);
29+
+ h->value.data[h->value.len] = '\0';
30+
31+
if (h->key.len == r->lowcase_index) {
32+
ngx_memcpy(h->lowcase_key, r->lowcase_header, h->key.len);
33+
--- src/http/modules/ngx_http_scgi_module.c
34+
+++ src/http/modules/ngx_http_scgi_module.c
35+
@@ -941,8 +941,10 @@ ngx_http_scgi_process_header(ngx_http_re
36+
h->value.data = h->key.data + h->key.len + 1;
37+
h->lowcase_key = h->key.data + h->key.len + 1 + h->value.len + 1;
38+
39+
- ngx_cpystrn(h->key.data, r->header_name_start, h->key.len + 1);
40+
- ngx_cpystrn(h->value.data, r->header_start, h->value.len + 1);
41+
+ ngx_memcpy(h->key.data, r->header_name_start, h->key.len);
42+
+ h->key.data[h->key.len] = '\0';
43+
+ ngx_memcpy(h->value.data, r->header_start, h->value.len);
44+
+ h->value.data[h->value.len] = '\0';
45+
46+
if (h->key.len == r->lowcase_index) {
47+
ngx_memcpy(h->lowcase_key, r->lowcase_header, h->key.len);
48+
--- src/http/modules/ngx_http_uwsgi_module.c
49+
+++ src/http/modules/ngx_http_uwsgi_module.c
50+
@@ -985,8 +985,10 @@ ngx_http_uwsgi_process_header(ngx_http_r
51+
h->value.data = h->key.data + h->key.len + 1;
52+
h->lowcase_key = h->key.data + h->key.len + 1 + h->value.len + 1;
53+
54+
- ngx_cpystrn(h->key.data, r->header_name_start, h->key.len + 1);
55+
- ngx_cpystrn(h->value.data, r->header_start, h->value.len + 1);
56+
+ ngx_memcpy(h->key.data, r->header_name_start, h->key.len);
57+
+ h->key.data[h->key.len] = '\0';
58+
+ ngx_memcpy(h->value.data, r->header_start, h->value.len);
59+
+ h->value.data[h->value.len] = '\0';
60+
61+
if (h->key.len == r->lowcase_index) {
62+
ngx_memcpy(h->lowcase_key, r->lowcase_header, h->key.len);
63+
--- src/http/ngx_http_parse.c
64+
+++ src/http/ngx_http_parse.c
65+
@@ -874,6 +874,10 @@ ngx_http_parse_header_line(ngx_http_requ
66+
break;
67+
}
68+
69+
+ if (ch == '\0') {
70+
+ return NGX_HTTP_PARSE_INVALID_HEADER;
71+
+ }
72+
+
73+
r->invalid_header = 1;
74+
75+
break;
76+
@@ -936,6 +940,10 @@ ngx_http_parse_header_line(ngx_http_requ
77+
break;
78+
}
79+
80+
+ if (ch == '\0') {
81+
+ return NGX_HTTP_PARSE_INVALID_HEADER;
82+
+ }
83+
+
84+
r->invalid_header = 1;
85+
86+
break;
87+
@@ -954,6 +962,8 @@ ngx_http_parse_header_line(ngx_http_requ
88+
r->header_start = p;
89+
r->header_end = p;
90+
goto done;
91+
+ case '\0':
92+
+ return NGX_HTTP_PARSE_INVALID_HEADER;
93+
default:
94+
r->header_start = p;
95+
state = sw_value;
96+
@@ -975,6 +985,8 @@ ngx_http_parse_header_line(ngx_http_requ
97+
case LF:
98+
r->header_end = p;
99+
goto done;
100+
+ case '\0':
101+
+ return NGX_HTTP_PARSE_INVALID_HEADER;
102+
}
103+
break;
104+
105+
@@ -988,6 +1000,8 @@ ngx_http_parse_header_line(ngx_http_requ
106+
break;
107+
case LF:
108+
goto done;
109+
+ case '\0':
110+
+ return NGX_HTTP_PARSE_INVALID_HEADER;
111+
default:
112+
state = sw_value;
113+
break;

util/mirror-tarballs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,9 @@ patch -p1 < $root/patches/nginx-$main_ver-allow_request_body_updating.patch || e
6363

6464
patch -p1 < $root/patches/nginx-$main_ver-log_escape_non_ascii.patch || exit 1
6565

66+
echo "INFO: applying null-character-fixes patch"
67+
patch -p0 < $root/patches/nginx-$main_ver-null_character_fixes.patch || exit 1
68+
6669
#patch -p1 < $root/patches/nginx-$main_ver-gzip_ok_invalid_read_fix.patch || exit 1
6770

6871
rm -f *.patch || exit 1
@@ -120,7 +123,7 @@ mv chaoslawful-drizzle-nginx-module-* drizzle-nginx-module-$ver || exit 1
120123

121124
#################################
122125

123-
ver=0.5.0rc17
126+
ver=0.5.0rc19
124127
$root/util/get-tarball "http://github.com/chaoslawful/lua-nginx-module/tarball/v$ver" -O lua-nginx-module-$ver.tar.gz || exit 1
125128
tar -xzf lua-nginx-module-$ver.tar.gz || exit 1
126129
mv chaoslawful-lua-nginx-module-* ngx_lua-$ver || exit 1
@@ -141,7 +144,7 @@ mv agentzh-memc-nginx-module-* memc-nginx-module-$ver || exit 1
141144

142145
#################################
143146

144-
ver=0.13rc3
147+
ver=0.13rc5
145148
$root/util/get-tarball "http://github.com/agentzh/srcache-nginx-module/tarball/v$ver" -O srcache-nginx-module-$ver.tar.gz || exit 1
146149
tar -xzf srcache-nginx-module-$ver.tar.gz || exit 1
147150
mv agentzh-srcache-nginx-module-* srcache-nginx-module-$ver || exit 1

0 commit comments

Comments
 (0)