Welcome! Log In Create A New Profile

Advanced

[nginx] HTTP/2: invalid connection preface logging (ticket #1981).

Maxim Dounin
May 25, 2020 02:04PM
details: https://hg.nginx.org/nginx/rev/7114d21bc2b1
branches:
changeset: 7656:7114d21bc2b1
user: Maxim Dounin <mdounin@mdounin.ru>
date: Mon May 25 18:33:42 2020 +0300
description:
HTTP/2: invalid connection preface logging (ticket #1981).

Previously, invalid connection preface errors were only logged at debug
level, providing no visible feedback, in particular, when a plain text
HTTP/2 listening socket is erroneously used for HTTP/1.x connections.
Now these are explicitly logged at the info level, much like other
client-related errors.

diffstat:

src/http/v2/ngx_http_v2.c | 10 ++++------
1 files changed, 4 insertions(+), 6 deletions(-)

diffs (27 lines):

diff -r bd4d1b9db0ee -r 7114d21bc2b1 src/http/v2/ngx_http_v2.c
--- a/src/http/v2/ngx_http_v2.c Sat May 23 15:53:08 2020 +0300
+++ b/src/http/v2/ngx_http_v2.c Mon May 25 18:33:42 2020 +0300
@@ -731,9 +731,8 @@ ngx_http_v2_state_preface(ngx_http_v2_co
}

if (ngx_memcmp(pos, preface, sizeof(preface) - 1) != 0) {
- ngx_log_debug2(NGX_LOG_DEBUG_HTTP, h2c->connection->log, 0,
- "invalid http2 connection preface \"%*s\"",
- sizeof(preface) - 1, pos);
+ ngx_log_error(NGX_LOG_INFO, h2c->connection->log, 0,
+ "invalid connection preface");

return ngx_http_v2_connection_error(h2c, NGX_HTTP_V2_PROTOCOL_ERROR);
}
@@ -754,9 +753,8 @@ ngx_http_v2_state_preface_end(ngx_http_v
}

if (ngx_memcmp(pos, preface, sizeof(preface) - 1) != 0) {
- ngx_log_debug2(NGX_LOG_DEBUG_HTTP, h2c->connection->log, 0,
- "invalid http2 connection preface \"%*s\"",
- sizeof(preface) - 1, pos);
+ ngx_log_error(NGX_LOG_INFO, h2c->connection->log, 0,
+ "invalid connection preface");

return ngx_http_v2_connection_error(h2c, NGX_HTTP_V2_PROTOCOL_ERROR);
}
_______________________________________________
nginx-devel mailing list
nginx-devel@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx-devel
Subject Author Views Posted

[nginx] HTTP/2: invalid connection preface logging (ticket #1981).

Maxim Dounin 416 May 25, 2020 02:04PM



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

Online Users

Guests: 194
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