Welcome! Log In Create A New Profile

Advanced

[PATCH] Enable HTTP/2 by default.

Auke Kok
March 29, 2019 02:14PM
Adds a `nohttp2` option to explicitly disable HTTP/2 support.
---
contrib/vim/syntax/nginx.vim | 2 +-
src/http/ngx_http_core_module.c | 9 ++++++++-
2 files changed, 9 insertions(+), 2 deletions(-)

diff --git a/contrib/vim/syntax/nginx.vim b/contrib/vim/syntax/nginx.vim
index 075b19a..8cff3e0 100644
--- a/contrib/vim/syntax/nginx.vim
+++ b/contrib/vim/syntax/nginx.vim
@@ -62,7 +62,7 @@ syn match ngxListenComment '#.*$'
\ contained
\ nextgroup=@ngxListenParams skipwhite skipempty
syn keyword ngxListenOptions contained
- \ default_server ssl http2 proxy_protocol
+ \ default_server ssl http2 nohttp2 proxy_protocol
\ setfib fastopen backlog rcvbuf sndbuf accept_filter deferred bind
\ ipv6only reuseport so_keepalive
\ nextgroup=@ngxListenParams skipwhite skipempty
diff --git a/src/http/ngx_http_core_module.c b/src/http/ngx_http_core_module.c
index 6b318dd..c7b5c72 100644
--- a/src/http/ngx_http_core_module.c
+++ b/src/http/ngx_http_core_module.c
@@ -3773,6 +3773,9 @@ ngx_http_core_listen(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
lsopt.backlog = NGX_LISTEN_BACKLOG;
lsopt.rcvbuf = -1;
lsopt.sndbuf = -1;
+#if (NGX_HTTP_V2)
+ lsopt.http2 = 1;
+#endif
#if (NGX_HAVE_SETFIB)
lsopt.setfib = -1;
#endif
@@ -3975,7 +3978,6 @@ ngx_http_core_listen(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)

if (ngx_strcmp(value[n].data, "http2") == 0) {
#if (NGX_HTTP_V2)
- lsopt.http2 = 1;
continue;
#else
ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
@@ -3985,6 +3987,11 @@ ngx_http_core_listen(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
#endif
}

+ if (ngx_strcmp(value[n].data, "nohttp2") == 0) {
+ lsopt.http2 = 0;
+ continue;
+ }
+
if (ngx_strcmp(value[n].data, "spdy") == 0) {
ngx_conf_log_error(NGX_LOG_WARN, cf, 0,
"invalid parameter \"spdy\": "
--
2.21.0

_______________________________________________
nginx-devel mailing list
nginx-devel@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx-devel
Subject Author Views Posted

[PATCH] Enable HTTP/2 by default.

Auke Kok 326 March 29, 2019 02:14PM

Re: [PATCH] Enable HTTP/2 by default.

Maxim Dounin 161 March 29, 2019 02:18PM



Sorry, you do not have permission to post/reply in this forum.

Online Users

Guests: 212
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready