Welcome! Log In Create A New Profile

Advanced

[PATCH] [nginx-quic] fix error code when reached maximum number of requests or timeout

Andrey Kolyshkin
May 27, 2021 08:18AM
# HG changeset patch
# User Andrey Kolyshkin <i@morfi.ru>
# Date 1622115662 -10800
# Thu May 27 14:41:02 2021 +0300
# Branch quic
# Node ID cfb1ac5fa0f6e2b86d4e4ce51e9ce0b33f959d66
# Parent e6c26cb4d38b8cecb89f26e002bfacf11eafe4a1
fix error code when reached maximum number of requests or timeout

chrome has marked quic connection as broken after
getting NGX_HTTP_V3_ERR_NO_ERROR (0x100) as code instead of NGX_QUIC_ERR_NO_ERROR (0x0)

QUIC_SESSION_CONNECTION_CLOSE_FRAME_RECEIVED
--> close_type = "Application"
--> details = "reached maximum number of requests"
--> quic_error = 122 (QUIC_IETF_GQUIC_ERROR_MISSING)
--> quic_wire_error = 256

diff -r e6c26cb4d38b -r cfb1ac5fa0f6 src/event/quic/ngx_event_quic.c
--- a/src/event/quic/ngx_event_quic.c Thu May 27 13:29:00 2021 +0300
+++ b/src/event/quic/ngx_event_quic.c Thu May 27 14:41:02 2021 +0300
@@ -607,7 +607,7 @@


void
-ngx_quic_finalize_connection(ngx_connection_t *c, ngx_uint_t err,
+ngx_quic_finalize_connection(ngx_connection_t *c, ngx_int_t rc, ngx_uint_t err,
const char *reason)
{
ngx_quic_connection_t *qc;
@@ -618,12 +618,12 @@
qc->error_app = 1;
qc->error_ftype = 0;

- ngx_quic_close_connection(c, NGX_ERROR);
+ ngx_quic_close_connection(c, rc);
}


void
-ngx_quic_shutdown_connection(ngx_connection_t *c, ngx_uint_t err,
+ngx_quic_shutdown_connection(ngx_connection_t *c, ngx_int_t rc, ngx_uint_t err,
const char *reason)
{
ngx_quic_connection_t *qc;
@@ -633,7 +633,7 @@
qc->shutdown_code = err;
qc->shutdown_reason = reason;

- ngx_quic_shutdown_quic(c);
+ ngx_quic_shutdown_quic(c, rc);
}


@@ -1369,7 +1369,7 @@


void
-ngx_quic_shutdown_quic(ngx_connection_t *c)
+ngx_quic_shutdown_quic(ngx_connection_t *c, ngx_int_t rc)
{
ngx_rbtree_t *tree;
ngx_rbtree_node_t *node;
@@ -1397,7 +1397,7 @@
}
}

- ngx_quic_finalize_connection(c, qc->shutdown_code, qc->shutdown_reason);
+ ngx_quic_finalize_connection(c, rc, qc->shutdown_code, qc->shutdown_reason);
}


diff -r e6c26cb4d38b -r cfb1ac5fa0f6 src/event/quic/ngx_event_quic.h
--- a/src/event/quic/ngx_event_quic.h Thu May 27 13:29:00 2021 +0300
+++ b/src/event/quic/ngx_event_quic.h Thu May 27 14:41:02 2021 +0300
@@ -88,9 +88,9 @@

void ngx_quic_run(ngx_connection_t *c, ngx_quic_conf_t *conf);
ngx_connection_t *ngx_quic_open_stream(ngx_connection_t *c, ngx_uint_t bidi);
-void ngx_quic_finalize_connection(ngx_connection_t *c, ngx_uint_t err,
+void ngx_quic_finalize_connection(ngx_connection_t *c, ngx_int_t rc, ngx_uint_t err,
const char *reason);
-void ngx_quic_shutdown_connection(ngx_connection_t *c, ngx_uint_t err,
+void ngx_quic_shutdown_connection(ngx_connection_t *c, ngx_int_t rc, ngx_uint_t err,
const char *reason);
ngx_int_t ngx_quic_reset_stream(ngx_connection_t *c, ngx_uint_t err);
uint32_t ngx_quic_version(ngx_connection_t *c);
diff -r e6c26cb4d38b -r cfb1ac5fa0f6 src/event/quic/ngx_event_quic_connection.h
--- a/src/event/quic/ngx_event_quic_connection.h Thu May 27 13:29:00 2021 +0300
+++ b/src/event/quic/ngx_event_quic_connection.h Thu May 27 14:41:02 2021 +0300
@@ -251,7 +251,7 @@
void ngx_quic_discard_ctx(ngx_connection_t *c,
enum ssl_encryption_level_t level);
void ngx_quic_close_connection(ngx_connection_t *c, ngx_int_t rc);
-void ngx_quic_shutdown_quic(ngx_connection_t *c);
+void ngx_quic_shutdown_quic(ngx_connection_t *c, ngx_int_t rc);

#if (NGX_DEBUG)
void ngx_quic_connstate_dbg(ngx_connection_t *c);
diff -r e6c26cb4d38b -r cfb1ac5fa0f6 src/event/quic/ngx_event_quic_streams.c
--- a/src/event/quic/ngx_event_quic_streams.c Thu May 27 13:29:00 2021 +0300
+++ b/src/event/quic/ngx_event_quic_streams.c Thu May 27 14:41:02 2021 +0300
@@ -803,7 +803,7 @@
(void) ngx_quic_output(pc);

if (qc->shutdown) {
- ngx_quic_shutdown_quic(pc);
+ ngx_quic_shutdown_quic(pc, NGX_ERROR);
}
}

diff -r e6c26cb4d38b -r cfb1ac5fa0f6 src/http/v3/ngx_http_v3.c
--- a/src/http/v3/ngx_http_v3.c Thu May 27 13:29:00 2021 +0300
+++ b/src/http/v3/ngx_http_v3.c Thu May 27 14:41:02 2021 +0300
@@ -69,7 +69,7 @@

ngx_log_debug0(NGX_LOG_DEBUG_HTTP, c->log, 0, "http3 keepalive handler");

- ngx_quic_finalize_connection(c, NGX_HTTP_V3_ERR_NO_ERROR,
+ ngx_quic_finalize_connection(c, NGX_OK, NGX_HTTP_V3_ERR_NO_ERROR,
"keepalive timeout");
}

diff -r e6c26cb4d38b -r cfb1ac5fa0f6 src/http/v3/ngx_http_v3.h
--- a/src/http/v3/ngx_http_v3.h Thu May 27 13:29:00 2021 +0300
+++ b/src/http/v3/ngx_http_v3.h Thu May 27 14:41:02 2021 +0300
@@ -89,10 +89,10 @@
module)

#define ngx_http_v3_finalize_connection(c, code, reason) \
- ngx_quic_finalize_connection(c->quic->parent, code, reason)
+ ngx_quic_finalize_connection(c->quic->parent, ((code == NGX_HTTP_V3_ERR_NO_ERROR) ? NGX_OK : NGX_ERROR), code, reason)

#define ngx_http_v3_shutdown_connection(c, code, reason) \
- ngx_quic_shutdown_connection(c->quic->parent, code, reason)
+ ngx_quic_shutdown_connection(c->quic->parent, ((code == NGX_HTTP_V3_ERR_NO_ERROR) ? NGX_OK : NGX_ERROR), code, reason)


typedef struct {

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

[PATCH] [nginx-quic] fix error code when reached maximum number of requests or timeout

Andrey Kolyshkin 91 May 27, 2021 08:18AM

Re: [PATCH] [nginx-quic] fix error code when reached maximum number of requests or timeout

Sergey Kandaurov 21 May 27, 2021 09:00AM



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

Online Users

Guests: 75
Record Number of Users: 6 on February 13, 2018
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready