Merge branch 'nginx' (nginx-1.19.6). Change-Id: I98abe7c29a46e6299b28d5ec325b8b6b7a192d35 Signed-off-by: Piotr Sikora <piotrsikora@google.com>
diff --git a/.hgtags b/.hgtags index dc8b8d8..4dffd1a 100644 --- a/.hgtags +++ b/.hgtags
@@ -455,3 +455,4 @@ 3cbc2602325f0ac08917a4397d76f5155c34b7b1 release-1.19.3 dc0cc425fa63a80315f6efb68697cadb6626cdf2 release-1.19.4 8e5b068f761cd512d10c9671fbde0b568c1fd08b release-1.19.5 +f618488eb769e0ed74ef0d93cd118d2ad79ef94d release-1.19.6
diff --git a/BUILD b/BUILD index dd27c76..05340d7 100644 --- a/BUILD +++ b/BUILD
@@ -1536,5 +1536,5 @@ preinst = "@nginx_pkgoss//:debian_preinst", prerm = "@nginx_pkgoss//:debian_prerm", section = "httpd", - version = "1.19.5", + version = "1.19.6", )
diff --git a/build.bzl b/build.bzl index 0eee17a..a26a8b0 100644 --- a/build.bzl +++ b/build.bzl
@@ -673,9 +673,9 @@ name = "nginx_pkgoss", build_file_content = _PKGOSS_BUILD_FILE.format(nginx = nginx) + _PKGOSS_BUILD_FILE_TAIL, - commit = "2d2699f5a66808ac119f4509ceccd90d44ef2dfb", # nginx-1.19.5 + commit = "3beb77a81cf0f56f37a90ba2c2641559425d71e8", # nginx-1.19.6 remote = "https://nginx.googlesource.com/nginx-pkgoss", - shallow_since = "1606224304 +0300", + shallow_since = "1608040820 +0300", ) def nginx_repositories_zlib(bind):
diff --git a/docs/xml/nginx/changes.xml b/docs/xml/nginx/changes.xml index d1bd021..3d56667 100644 --- a/docs/xml/nginx/changes.xml +++ b/docs/xml/nginx/changes.xml
@@ -5,6 +5,55 @@ <change_log title="nginx"> +<changes ver="1.19.6" date="2020-12-15"> + +<change type="bugfix"> +<para lang="ru"> +ошибки "no live upstreams", +если server в блоке upstream был помечен как down. +</para> +<para lang="en"> +"no live upstreams" errors +if a "server" inside "upstream" block was marked as "down". +</para> +</change> + +<change type="bugfix"> +<para lang="ru"> +при использовании HTTPS в рабочем процессе мог произойти segmentation fault; +ошибка появилась в 1.19.5. +</para> +<para lang="en"> +a segmentation fault might occur in a worker process if HTTPS was used; +the bug had appeared in 1.19.5. +</para> +</change> + +<change type="bugfix"> +<para lang="ru"> +nginx возвращал ошибку 400 на запросы вида +<nobr>"GET http://example.com?args HTTP/1.0"</nobr>. +</para> +<para lang="en"> +nginx returned the 400 response on requests like +<nobr>"GET http://example.com?args HTTP/1.0"</nobr>. +</para> +</change> + +<change type="bugfix"> +<para lang="ru"> +в модулях ngx_http_flv_module и ngx_http_mp4_module.<br/> +Спасибо Chris Newton. +</para> +<para lang="en"> +in the ngx_http_flv_module and ngx_http_mp4_module.<br/> +Thanks to Chris Newton. +</para> +</change> + +</changes> + + <changes ver="1.19.5" date="2020-11-24"> <change type="feature">
diff --git a/misc/GNUmakefile b/misc/GNUmakefile index 80eb9b9..5c75505 100644 --- a/misc/GNUmakefile +++ b/misc/GNUmakefile
@@ -6,7 +6,7 @@ CC = cl OBJS = objs.msvc8 -OPENSSL = openssl-1.1.1h +OPENSSL = openssl-1.1.1i ZLIB = zlib-1.2.11 PCRE = pcre-8.44
diff --git a/src/core/nginx.h b/src/core/nginx.h index 04710fd..458af5b 100644 --- a/src/core/nginx.h +++ b/src/core/nginx.h
@@ -13,8 +13,8 @@ #define NGINX_NAME "nginx" #endif -#define nginx_version 1019005 -#define NGINX_VERSION "1.19.5" +#define nginx_version 1019006 +#define NGINX_VERSION "1.19.6" #define NGINX_VER NGINX_NAME "/" NGINX_VERSION #ifdef NGX_BUILD
diff --git a/src/event/ngx_event_openssl.c b/src/event/ngx_event_openssl.c index 2e739c8..2929a2e 100644 --- a/src/event/ngx_event_openssl.c +++ b/src/event/ngx_event_openssl.c
@@ -2903,6 +2903,7 @@ SSL_free(c->ssl->connection); c->ssl = NULL; + c->recv = ngx_recv; return NGX_OK; } @@ -2948,6 +2949,7 @@ if (n == 1) { SSL_free(c->ssl->connection); c->ssl = NULL; + c->recv = ngx_recv; return NGX_OK; } @@ -2990,6 +2992,7 @@ if (sslerr == SSL_ERROR_ZERO_RETURN || ERR_peek_error() == 0) { SSL_free(c->ssl->connection); c->ssl = NULL; + c->recv = ngx_recv; return NGX_OK; } @@ -3000,6 +3003,7 @@ SSL_free(c->ssl->connection); c->ssl = NULL; + c->recv = ngx_recv; return NGX_ERROR; }
diff --git a/src/http/modules/ngx_http_flv_module.c b/src/http/modules/ngx_http_flv_module.c index 7b72fae..cc06d53 100644 --- a/src/http/modules/ngx_http_flv_module.c +++ b/src/http/modules/ngx_http_flv_module.c
@@ -156,12 +156,6 @@ } if (!of.is_file) { - - if (ngx_close_file(of.fd) == NGX_FILE_ERROR) { - ngx_log_error(NGX_LOG_ALERT, log, ngx_errno, - ngx_close_file_n " \"%s\" failed", path.data); - } - return NGX_DECLINED; }
diff --git a/src/http/modules/ngx_http_mp4_module.c b/src/http/modules/ngx_http_mp4_module.c index c1006ab..0e93fbd 100644 --- a/src/http/modules/ngx_http_mp4_module.c +++ b/src/http/modules/ngx_http_mp4_module.c
@@ -521,12 +521,6 @@ } if (!of.is_file) { - - if (ngx_close_file(of.fd) == NGX_FILE_ERROR) { - ngx_log_error(NGX_LOG_ALERT, log, ngx_errno, - ngx_close_file_n " \"%s\" failed", path.data); - } - return NGX_DECLINED; }
diff --git a/src/http/ngx_http_parse.c b/src/http/ngx_http_parse.c index cfc42f9..20ad89a 100644 --- a/src/http/ngx_http_parse.c +++ b/src/http/ngx_http_parse.c
@@ -380,6 +380,12 @@ r->uri_start = p; state = sw_after_slash_in_uri; break; + case '?': + r->uri_start = p; + r->args_start = p + 1; + r->empty_path_in_uri = 1; + state = sw_uri; + break; case ' ': /* * use single "/" from request line to preserve pointers, @@ -446,6 +452,13 @@ r->uri_start = p; state = sw_after_slash_in_uri; break; + case '?': + r->port_end = p; + r->uri_start = p; + r->args_start = p + 1; + r->empty_path_in_uri = 1; + state = sw_uri; + break; case ' ': r->port_end = p; /* @@ -1287,6 +1300,10 @@ r->uri_ext = NULL; r->args_start = NULL; + if (r->empty_path_in_uri) { + *u++ = '/'; + } + ch = *p++; while (p <= r->uri_end) {
diff --git a/src/http/ngx_http_request.c b/src/http/ngx_http_request.c index cc822c4..7397965 100644 --- a/src/http/ngx_http_request.c +++ b/src/http/ngx_http_request.c
@@ -1388,9 +1388,13 @@ r->uri.len = r->uri_end - r->uri_start; } - if (r->complex_uri || r->quoted_uri) { + if (r->complex_uri || r->quoted_uri || r->empty_path_in_uri) { - r->uri.data = ngx_pnalloc(r->pool, r->uri.len + 1); + if (r->empty_path_in_uri) { + r->uri.len++; + } + + r->uri.data = ngx_pnalloc(r->pool, r->uri.len); if (r->uri.data == NULL) { ngx_http_close_request(r, NGX_HTTP_INTERNAL_SERVER_ERROR); return NGX_ERROR; @@ -1414,7 +1418,7 @@ r->unparsed_uri.len = r->uri_end - r->uri_start; r->unparsed_uri.data = r->uri_start; - r->valid_unparsed_uri = r->space_in_uri ? 0 : 1; + r->valid_unparsed_uri = (r->space_in_uri || r->empty_path_in_uri) ? 0 : 1; if (r->uri_ext) { if (r->args_start) { @@ -3577,8 +3581,6 @@ c->ssl->handler = ngx_http_set_lingering_close; return; } - - c->recv = ngx_recv; } #endif
diff --git a/src/http/ngx_http_request.h b/src/http/ngx_http_request.h index f49a8d5..68d5c18 100644 --- a/src/http/ngx_http_request.h +++ b/src/http/ngx_http_request.h
@@ -470,6 +470,9 @@ /* URI with " " */ unsigned space_in_uri:1; + /* URI with empty path */ + unsigned empty_path_in_uri:1; + unsigned invalid_header:1; unsigned add_uri_to_alias:1;
diff --git a/src/http/ngx_http_upstream_round_robin.c b/src/http/ngx_http_upstream_round_robin.c index c630ae5..ee13b07 100644 --- a/src/http/ngx_http_upstream_round_robin.c +++ b/src/http/ngx_http_upstream_round_robin.c
@@ -10,8 +10,8 @@ #include <ngx_http.h> -#define ngx_http_upstream_tries(p) ((p)->number \ - + ((p)->next ? (p)->next->number : 0)) +#define ngx_http_upstream_tries(p) ((p)->tries \ + + ((p)->next ? (p)->next->tries : 0)) static ngx_http_upstream_rr_peer_t *ngx_http_upstream_get_peer( @@ -32,7 +32,7 @@ ngx_http_upstream_srv_conf_t *us) { ngx_url_t u; - ngx_uint_t i, j, n, w; + ngx_uint_t i, j, n, w, t; ngx_http_upstream_server_t *server; ngx_http_upstream_rr_peer_t *peer, **peerp; ngx_http_upstream_rr_peers_t *peers, *backup; @@ -44,6 +44,7 @@ n = 0; w = 0; + t = 0; for (i = 0; i < us->servers->nelts; i++) { if (server[i].backup) { @@ -52,6 +53,10 @@ n += server[i].naddrs; w += server[i].naddrs * server[i].weight; + + if (!server[i].down) { + t += server[i].naddrs; + } } if (n == 0) { @@ -75,6 +80,7 @@ peers->number = n; peers->weighted = (w != n); peers->total_weight = w; + peers->tries = t; peers->name = &us->host; n = 0; @@ -110,6 +116,7 @@ n = 0; w = 0; + t = 0; for (i = 0; i < us->servers->nelts; i++) { if (!server[i].backup) { @@ -118,6 +125,10 @@ n += server[i].naddrs; w += server[i].naddrs * server[i].weight; + + if (!server[i].down) { + t += server[i].naddrs; + } } if (n == 0) { @@ -139,6 +150,7 @@ backup->number = n; backup->weighted = (w != n); backup->total_weight = w; + backup->tries = t; backup->name = &us->host; n = 0; @@ -214,6 +226,7 @@ peers->number = n; peers->weighted = 0; peers->total_weight = n; + peers->tries = n; peers->name = &us->host; peerp = &peers->peer; @@ -332,6 +345,7 @@ peers->single = (ur->naddrs == 1); peers->number = ur->naddrs; + peers->tries = ur->naddrs; peers->name = &ur->host; if (ur->sockaddr) {
diff --git a/src/http/ngx_http_upstream_round_robin.h b/src/http/ngx_http_upstream_round_robin.h index 8b5060f..f03e997 100644 --- a/src/http/ngx_http_upstream_round_robin.h +++ b/src/http/ngx_http_upstream_round_robin.h
@@ -68,6 +68,7 @@ #endif ngx_uint_t total_weight; + ngx_uint_t tries; unsigned single:1; unsigned weighted:1;
diff --git a/src/http/v2/ngx_http_v2.c b/src/http/v2/ngx_http_v2.c index 97fd5e4..e4d06f5 100644 --- a/src/http/v2/ngx_http_v2.c +++ b/src/http/v2/ngx_http_v2.c
@@ -740,8 +740,6 @@ c->ssl->handler = ngx_http_v2_lingering_close; return; } - - c->recv = ngx_recv; } #endif
diff --git a/src/stream/ngx_stream_upstream_round_robin.c b/src/stream/ngx_stream_upstream_round_robin.c index b4c1541..f2c1969 100644 --- a/src/stream/ngx_stream_upstream_round_robin.c +++ b/src/stream/ngx_stream_upstream_round_robin.c
@@ -10,8 +10,8 @@ #include <ngx_stream.h> -#define ngx_stream_upstream_tries(p) ((p)->number \ - + ((p)->next ? (p)->next->number : 0)) +#define ngx_stream_upstream_tries(p) ((p)->tries \ + + ((p)->next ? (p)->next->tries : 0)) static ngx_stream_upstream_rr_peer_t *ngx_stream_upstream_get_peer( @@ -38,7 +38,7 @@ ngx_stream_upstream_srv_conf_t *us) { ngx_url_t u; - ngx_uint_t i, j, n, w; + ngx_uint_t i, j, n, w, t; ngx_stream_upstream_server_t *server; ngx_stream_upstream_rr_peer_t *peer, **peerp; ngx_stream_upstream_rr_peers_t *peers, *backup; @@ -50,6 +50,7 @@ n = 0; w = 0; + t = 0; for (i = 0; i < us->servers->nelts; i++) { if (server[i].backup) { @@ -58,6 +59,10 @@ n += server[i].naddrs; w += server[i].naddrs * server[i].weight; + + if (!server[i].down) { + t += server[i].naddrs; + } } if (n == 0) { @@ -81,6 +86,7 @@ peers->number = n; peers->weighted = (w != n); peers->total_weight = w; + peers->tries = t; peers->name = &us->host; n = 0; @@ -116,6 +122,7 @@ n = 0; w = 0; + t = 0; for (i = 0; i < us->servers->nelts; i++) { if (!server[i].backup) { @@ -124,6 +131,10 @@ n += server[i].naddrs; w += server[i].naddrs * server[i].weight; + + if (!server[i].down) { + t += server[i].naddrs; + } } if (n == 0) { @@ -145,6 +156,7 @@ backup->number = n; backup->weighted = (w != n); backup->total_weight = w; + backup->tries = t; backup->name = &us->host; n = 0; @@ -220,6 +232,7 @@ peers->number = n; peers->weighted = 0; peers->total_weight = n; + peers->tries = n; peers->name = &us->host; peerp = &peers->peer; @@ -342,6 +355,7 @@ peers->single = (ur->naddrs == 1); peers->number = ur->naddrs; + peers->tries = ur->naddrs; peers->name = &ur->host; if (ur->sockaddr) {
diff --git a/src/stream/ngx_stream_upstream_round_robin.h b/src/stream/ngx_stream_upstream_round_robin.h index 01bfe53..b8b1cf6 100644 --- a/src/stream/ngx_stream_upstream_round_robin.h +++ b/src/stream/ngx_stream_upstream_round_robin.h
@@ -66,6 +66,7 @@ #endif ngx_uint_t total_weight; + ngx_uint_t tries; unsigned single:1; unsigned weighted:1;