mirror of
https://github.com/openresty/openresty.git
synced 2024-10-13 00:29:41 +00:00
Compare commits
13 Commits
v1.0.11.23
...
v1.0.11.28
Author | SHA1 | Date | |
---|---|---|---|
ce803e8a94 | |||
843fd34df6 | |||
39cea1cbb3 | |||
b4f3bd982f | |||
fcb85fb288 | |||
9a756394cc | |||
922f49f734 | |||
99c37ea419 | |||
767863f552 | |||
45eb5fd21d | |||
926f75812b | |||
0fed5de57c | |||
deff21617c |
113
patches/nginx-1.0.11-null_character_fixes.patch
Normal file
113
patches/nginx-1.0.11-null_character_fixes.patch
Normal file
@ -0,0 +1,113 @@
|
|||||||
|
--- 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;
|
32
patches/nginx-1.0.11-upstream_pipelining.patch
Normal file
32
patches/nginx-1.0.11-upstream_pipelining.patch
Normal file
@ -0,0 +1,32 @@
|
|||||||
|
diff -ur nginx-1.0.11/src/http/ngx_http_upstream.c nginx-1.0.11-patched/src/http/ngx_http_upstream.c
|
||||||
|
--- nginx-1.0.11/src/http/ngx_http_upstream.c 2011-12-14 02:34:34.000000000 +0800
|
||||||
|
+++ nginx-1.0.11-patched/src/http/ngx_http_upstream.c 2012-03-21 21:20:17.333111806 +0800
|
||||||
|
@@ -1385,6 +1385,8 @@
|
||||||
|
|
||||||
|
/* rc == NGX_OK */
|
||||||
|
|
||||||
|
+ u->request_all_sent = 1;
|
||||||
|
+
|
||||||
|
if (c->tcp_nopush == NGX_TCP_NOPUSH_SET) {
|
||||||
|
if (ngx_tcp_push(c->fd) == NGX_ERROR) {
|
||||||
|
ngx_log_error(NGX_LOG_CRIT, c->log, ngx_socket_errno,
|
||||||
|
@@ -1451,7 +1453,7 @@
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
- if (u->header_sent) {
|
||||||
|
+ if (u->request_all_sent) {
|
||||||
|
u->write_event_handler = ngx_http_upstream_dummy_handler;
|
||||||
|
|
||||||
|
(void) ngx_handle_write_event(c->write, 0);
|
||||||
|
diff -ur nginx-1.0.11/src/http/ngx_http_upstream.h nginx-1.0.11-patched/src/http/ngx_http_upstream.h
|
||||||
|
--- nginx-1.0.11/src/http/ngx_http_upstream.h 2011-11-01 22:18:10.000000000 +0800
|
||||||
|
+++ nginx-1.0.11-patched/src/http/ngx_http_upstream.h 2012-03-21 21:18:21.041237173 +0800
|
||||||
|
@@ -313,6 +313,7 @@
|
||||||
|
unsigned buffering:1;
|
||||||
|
|
||||||
|
unsigned request_sent:1;
|
||||||
|
+ unsigned request_all_sent:1;
|
||||||
|
unsigned header_sent:1;
|
||||||
|
};
|
||||||
|
|
113
patches/nginx-1.1.15-null_character_fixes.patch
Normal file
113
patches/nginx-1.1.15-null_character_fixes.patch
Normal file
@ -0,0 +1,113 @@
|
|||||||
|
--- 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;
|
542
t/sanity.t
542
t/sanity.t
File diff suppressed because it is too large
Load Diff
@ -26,6 +26,9 @@ cd nginx-$ver || exit 1
|
|||||||
|
|
||||||
# patch the patch
|
# patch the patch
|
||||||
|
|
||||||
|
echo "INFO: applying the upstream-pipelining patch"
|
||||||
|
patch -p1 < $root/patches/nginx-$main_ver-upstream_pipelining.patch || exit 1
|
||||||
|
|
||||||
cp $root/patches/nginx-$main_ver-server_header.patch server_header.patch || exit 1
|
cp $root/patches/nginx-$main_ver-server_header.patch server_header.patch || exit 1
|
||||||
sed $"s/NGINX_VERSION \".unknown\"/NGINX_VERSION \".$minor_ver\"/" server_header.patch \
|
sed $"s/NGINX_VERSION \".unknown\"/NGINX_VERSION \".$minor_ver\"/" server_header.patch \
|
||||||
> server_header.patch.tmp && mv -f server_header.patch.tmp server_header.patch || exit 1
|
> server_header.patch.tmp && mv -f server_header.patch.tmp server_header.patch || exit 1
|
||||||
@ -57,6 +60,9 @@ patch -p1 < $root/patches/nginx-$main_ver-allow_request_body_updating.patch || e
|
|||||||
|
|
||||||
patch -p1 < $root/patches/nginx-$main_ver-log_escape_non_ascii.patch || exit 1
|
patch -p1 < $root/patches/nginx-$main_ver-log_escape_non_ascii.patch || exit 1
|
||||||
|
|
||||||
|
echo "INFO: applying null-character-fixes patch"
|
||||||
|
patch -p0 < $root/patches/nginx-$main_ver-null_character_fixes.patch || exit 1
|
||||||
|
|
||||||
#patch -p1 < $root/patches/nginx-$main_ver-gzip_ok_invalid_read_fix.patch || exit 1
|
#patch -p1 < $root/patches/nginx-$main_ver-gzip_ok_invalid_read_fix.patch || exit 1
|
||||||
|
|
||||||
rm -f *.patch || exit 1
|
rm -f *.patch || exit 1
|
||||||
@ -70,7 +76,7 @@ sed $"s/NGINX_VERSION \".unknown/NGINX_VERSION \".$minor_ver/" \
|
|||||||
|| exit 1
|
|| exit 1
|
||||||
rm -rf no-pool-nginx-$ver
|
rm -rf no-pool-nginx-$ver
|
||||||
|
|
||||||
ver=0.38rc1
|
ver=0.38rc2
|
||||||
$root/util/get-tarball "http://github.com/agentzh/echo-nginx-module/tarball/v$ver" -O echo-nginx-module-$ver.tar.gz || exit 1
|
$root/util/get-tarball "http://github.com/agentzh/echo-nginx-module/tarball/v$ver" -O echo-nginx-module-$ver.tar.gz || exit 1
|
||||||
tar -xzf echo-nginx-module-$ver.tar.gz || exit 1
|
tar -xzf echo-nginx-module-$ver.tar.gz || exit 1
|
||||||
mv agentzh-echo-nginx-module-* echo-nginx-module-$ver || exit 1
|
mv agentzh-echo-nginx-module-* echo-nginx-module-$ver || exit 1
|
||||||
@ -114,7 +120,7 @@ mv chaoslawful-drizzle-nginx-module-* drizzle-nginx-module-$ver || exit 1
|
|||||||
|
|
||||||
#################################
|
#################################
|
||||||
|
|
||||||
ver=0.5.0rc19
|
ver=0.5.0rc21
|
||||||
$root/util/get-tarball "http://github.com/chaoslawful/lua-nginx-module/tarball/v$ver" -O lua-nginx-module-$ver.tar.gz || exit 1
|
$root/util/get-tarball "http://github.com/chaoslawful/lua-nginx-module/tarball/v$ver" -O lua-nginx-module-$ver.tar.gz || exit 1
|
||||||
tar -xzf lua-nginx-module-$ver.tar.gz || exit 1
|
tar -xzf lua-nginx-module-$ver.tar.gz || exit 1
|
||||||
mv chaoslawful-lua-nginx-module-* ngx_lua-$ver || exit 1
|
mv chaoslawful-lua-nginx-module-* ngx_lua-$ver || exit 1
|
||||||
@ -135,7 +141,7 @@ mv agentzh-memc-nginx-module-* memc-nginx-module-$ver || exit 1
|
|||||||
|
|
||||||
#################################
|
#################################
|
||||||
|
|
||||||
ver=0.13rc5
|
ver=0.13rc6
|
||||||
$root/util/get-tarball "http://github.com/agentzh/srcache-nginx-module/tarball/v$ver" -O srcache-nginx-module-$ver.tar.gz || exit 1
|
$root/util/get-tarball "http://github.com/agentzh/srcache-nginx-module/tarball/v$ver" -O srcache-nginx-module-$ver.tar.gz || exit 1
|
||||||
tar -xzf srcache-nginx-module-$ver.tar.gz || exit 1
|
tar -xzf srcache-nginx-module-$ver.tar.gz || exit 1
|
||||||
mv agentzh-srcache-nginx-module-* srcache-nginx-module-$ver || exit 1
|
mv agentzh-srcache-nginx-module-* srcache-nginx-module-$ver || exit 1
|
||||||
@ -300,5 +306,6 @@ cp $root/util/install bundle/
|
|||||||
|
|
||||||
cd $root
|
cd $root
|
||||||
|
|
||||||
tar czf $name.tar.gz $name
|
tar cf $name.tar $name
|
||||||
|
gzip -f --best $name.tar
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user