logo

oasis

Own branch of Oasis Linux (upstream: <https://git.sr.ht/~mcf/oasis/>) git clone https://anongit.hacktivis.me/git/oasis.git
commit: 9e68e70d127c870a7ba5423cec2aba6e4ee59ea5
parent ff670cfc52458af40e871dbc996f2d0734dd0c35
Author: Michael Forney <mforney@mforney.org>
Date:   Sun, 25 Apr 2021 19:01:34 -0700

nginx: Update to 1.20.0

Diffstat:

M.gitmodules1-
Mpkg/nginx/ngx_auto_config.h2+-
Dpkg/nginx/patch/0001-HTTP-2-lingering-close-after-GOAWAY.patch213-------------------------------------------------------------------------------
Mpkg/nginx/sources.txt2++
4 files changed, 3 insertions(+), 215 deletions(-)

diff --git a/.gitmodules b/.gitmodules @@ -238,7 +238,6 @@ [submodule "pkg/nginx/src"] path = pkg/nginx/src url = https://github.com/nginx/nginx - ignore = all [submodule "pkg/oksh/src"] path = pkg/oksh/src url = https://github.com/ibara/oksh.git diff --git a/pkg/nginx/ngx_auto_config.h b/pkg/nginx/ngx_auto_config.h @@ -8,6 +8,7 @@ /* auto/os/linux */ #define NGX_HAVE_EPOLL 1 +#define NGX_HAVE_EVENTFD 1 #define NGX_HAVE_CLEAR_EVENT 1 #define NGX_HAVE_EPOLLRDHUP 1 #define NGX_HAVE_EPOLLEXCLUSIVE 1 @@ -42,7 +43,6 @@ #define NGX_HAVE_TCP_FASTOPEN 1 #define NGX_HAVE_TCP_INFO 1 #define NGX_HAVE_ACCEPT4 1 -#define NGX_HAVE_EVENTFD 1 #define NGX_HAVE_SYS_EVENTFD_H 1 #define NGX_HAVE_UNIX_DOMAIN 1 #define NGX_PTR_SIZE 8 diff --git a/pkg/nginx/patch/0001-HTTP-2-lingering-close-after-GOAWAY.patch b/pkg/nginx/patch/0001-HTTP-2-lingering-close-after-GOAWAY.patch @@ -1,213 +0,0 @@ -From 33a5a57ec7d114e52865e11527660249b996f56e Mon Sep 17 00:00:00 2001 -From: Ruslan Ermilov <ru@nginx.com> -Date: Fri, 3 Jul 2020 16:16:47 +0300 -Subject: [PATCH] HTTP/2: lingering close after GOAWAY. - -After sending the GOAWAY frame, a connection is now closed using -the lingering close mechanism. - -This allows for the reliable delivery of the GOAWAY frames, while -also fixing connection resets observed when http2_max_requests is -reached (ticket #1250), or with graceful shutdown (ticket #1544), -when some additional data from the client is received on a fully -closed connection. - -For HTTP/2, the settings lingering_close, lingering_timeout, and -lingering_time are taken from the "server" level. ---- - src/http/v2/ngx_http_v2.c | 128 ++++++++++++++++++++++++++++++++++++-- - src/http/v2/ngx_http_v2.h | 2 + - 2 files changed, 124 insertions(+), 6 deletions(-) - -diff --git a/src/http/v2/ngx_http_v2.c b/src/http/v2/ngx_http_v2.c -index 8b0fc53b..48733fe3 100644 ---- a/src/http/v2/ngx_http_v2.c -+++ b/src/http/v2/ngx_http_v2.c -@@ -60,6 +60,8 @@ typedef struct { - static void ngx_http_v2_read_handler(ngx_event_t *rev); - static void ngx_http_v2_write_handler(ngx_event_t *wev); - static void ngx_http_v2_handle_connection(ngx_http_v2_connection_t *h2c); -+static void ngx_http_v2_lingering_close(ngx_http_v2_connection_t *h2c); -+static void ngx_http_v2_lingering_close_handler(ngx_event_t *rev); - - static u_char *ngx_http_v2_state_proxy_protocol(ngx_http_v2_connection_t *h2c, - u_char *pos, u_char *end); -@@ -661,7 +663,7 @@ ngx_http_v2_handle_connection(ngx_http_v2_connection_t *h2c) - } - - if (h2c->goaway) { -- ngx_http_close_connection(c); -+ ngx_http_v2_lingering_close(h2c); - return; - } - -@@ -699,6 +701,113 @@ ngx_http_v2_handle_connection(ngx_http_v2_connection_t *h2c) - } - - -+static void -+ngx_http_v2_lingering_close(ngx_http_v2_connection_t *h2c) -+{ -+ ngx_event_t *rev, *wev; -+ ngx_connection_t *c; -+ ngx_http_core_loc_conf_t *clcf; -+ -+ c = h2c->connection; -+ -+ clcf = ngx_http_get_module_loc_conf(h2c->http_connection->conf_ctx, -+ ngx_http_core_module); -+ -+ if (clcf->lingering_close == NGX_HTTP_LINGERING_OFF) { -+ ngx_http_close_connection(c); -+ return; -+ } -+ -+ rev = c->read; -+ rev->handler = ngx_http_v2_lingering_close_handler; -+ -+ h2c->lingering_time = ngx_time() + (time_t) (clcf->lingering_time / 1000); -+ ngx_add_timer(rev, clcf->lingering_timeout); -+ -+ if (ngx_handle_read_event(rev, 0) != NGX_OK) { -+ ngx_http_close_connection(c); -+ return; -+ } -+ -+ wev = c->write; -+ wev->handler = ngx_http_empty_handler; -+ -+ if (wev->active && (ngx_event_flags & NGX_USE_LEVEL_EVENT)) { -+ if (ngx_del_event(wev, NGX_WRITE_EVENT, 0) != NGX_OK) { -+ ngx_http_close_connection(c); -+ return; -+ } -+ } -+ -+ if (ngx_shutdown_socket(c->fd, NGX_WRITE_SHUTDOWN) == -1) { -+ ngx_connection_error(c, ngx_socket_errno, -+ ngx_shutdown_socket_n " failed"); -+ ngx_http_close_connection(c); -+ return; -+ } -+ -+ if (rev->ready) { -+ ngx_http_v2_lingering_close_handler(rev); -+ } -+} -+ -+ -+static void -+ngx_http_v2_lingering_close_handler(ngx_event_t *rev) -+{ -+ ssize_t n; -+ ngx_msec_t timer; -+ ngx_connection_t *c; -+ ngx_http_core_loc_conf_t *clcf; -+ ngx_http_v2_connection_t *h2c; -+ u_char buffer[NGX_HTTP_LINGERING_BUFFER_SIZE]; -+ -+ c = rev->data; -+ h2c = c->data; -+ -+ ngx_log_debug0(NGX_LOG_DEBUG_HTTP, c->log, 0, -+ "http2 lingering close handler"); -+ -+ if (rev->timedout) { -+ ngx_http_close_connection(c); -+ return; -+ } -+ -+ timer = (ngx_msec_t) h2c->lingering_time - (ngx_msec_t) ngx_time(); -+ if ((ngx_msec_int_t) timer <= 0) { -+ ngx_http_close_connection(c); -+ return; -+ } -+ -+ do { -+ n = c->recv(c, buffer, NGX_HTTP_LINGERING_BUFFER_SIZE); -+ -+ ngx_log_debug1(NGX_LOG_DEBUG_HTTP, c->log, 0, "lingering read: %z", n); -+ -+ if (n == NGX_ERROR || n == 0) { -+ ngx_http_close_connection(c); -+ return; -+ } -+ -+ } while (rev->ready); -+ -+ if (ngx_handle_read_event(rev, 0) != NGX_OK) { -+ ngx_http_close_connection(c); -+ return; -+ } -+ -+ clcf = ngx_http_get_module_loc_conf(h2c->http_connection->conf_ctx, -+ ngx_http_core_module); -+ timer *= 1000; -+ -+ if (timer > clcf->lingering_timeout) { -+ timer = clcf->lingering_timeout; -+ } -+ -+ ngx_add_timer(rev, timer); -+} -+ -+ - static u_char * - ngx_http_v2_state_proxy_protocol(ngx_http_v2_connection_t *h2c, u_char *pos, - u_char *end) -@@ -4543,16 +4652,15 @@ ngx_http_v2_finalize_connection(ngx_http_v2_connection_t *h2c, - h2c->blocked = 1; - - if (!c->error && !h2c->goaway) { -+ h2c->goaway = 1; -+ - if (ngx_http_v2_send_goaway(h2c, status) != NGX_ERROR) { - (void) ngx_http_v2_send_output_queue(h2c); - } - } - -- c->error = 1; -- - if (!h2c->processing && !h2c->pushing) { -- ngx_http_close_connection(c); -- return; -+ goto done; - } - - c->read->handler = ngx_http_empty_handler; -@@ -4600,10 +4708,18 @@ ngx_http_v2_finalize_connection(ngx_http_v2_connection_t *h2c, - h2c->blocked = 0; - - if (h2c->processing || h2c->pushing) { -+ c->error = 1; -+ return; -+ } -+ -+done: -+ -+ if (c->error) { -+ ngx_http_close_connection(c); - return; - } - -- ngx_http_close_connection(c); -+ ngx_http_v2_lingering_close(h2c); - } - - -diff --git a/src/http/v2/ngx_http_v2.h b/src/http/v2/ngx_http_v2.h -index 59ddf54e..34922971 100644 ---- a/src/http/v2/ngx_http_v2.h -+++ b/src/http/v2/ngx_http_v2.h -@@ -157,6 +157,8 @@ struct ngx_http_v2_connection_s { - ngx_uint_t last_sid; - ngx_uint_t last_push; - -+ time_t lingering_time; -+ - unsigned closed_nodes:8; - unsigned settings_ack:1; - unsigned table_update:1; --- -2.27.0 - diff --git a/pkg/nginx/sources.txt b/pkg/nginx/sources.txt @@ -98,6 +98,7 @@ mail_imap mail/ngx_mail_imap_module.c mail/ngx_mail_imap_handler.c mail_smtp mail/ngx_mail_smtp_module.c mail/ngx_mail_smtp_handler.c mail_auth_http mail/ngx_mail_auth_http_module.c mail_proxy mail/ngx_mail_proxy_module.c +mail_realip mail/ngx_mail_realip_module.c # STREAM_MODULES stream stream/ngx_stream.c stream/ngx_stream_variables.c stream/ngx_stream_script.c stream/ngx_stream_handler.c @@ -117,6 +118,7 @@ stream_map stream/ngx_stream_map_module.c stream_split_clients stream/ngx_stream_split_clients_module.c stream_return stream/ngx_stream_return_module.c stream_upstream_hash stream/ngx_stream_upstream_hash_module.c +stream_set stream/ngx_stream_set_module.c stream_upstream_least_conn stream/ngx_stream_upstream_least_conn_module.c stream_upstream_random_module stream/ngx_stream_upstream_random_module.c stream_upstream_zone stream/ngx_stream_upstream_zone_module.c