aboutsummaryrefslogtreecommitdiff
path: root/src/http/v3
diff options
context:
space:
mode:
Diffstat (limited to 'src/http/v3')
-rw-r--r--src/http/v3/ngx_http_v3.h7
-rw-r--r--src/http/v3/ngx_http_v3_module.c16
-rw-r--r--src/http/v3/ngx_http_v3_request.c24
3 files changed, 36 insertions, 11 deletions
diff --git a/src/http/v3/ngx_http_v3.h b/src/http/v3/ngx_http_v3.h
index bee073e1d..f470b327d 100644
--- a/src/http/v3/ngx_http_v3.h
+++ b/src/http/v3/ngx_http_v3.h
@@ -22,8 +22,8 @@
#define NGX_HTTP_V3_ALPN_PROTO "\x02h3"
#define NGX_HTTP_V3_ALPN_DRAFT_FMT "\x05h3-%02uD"
-#define NGX_HTTP_QUIC_ALPN_PROTO "\x0Ahq-interop"
-#define NGX_HTTP_QUIC_ALPN_DRAFT_FMT "\x05hq-%02uD"
+#define NGX_HTTP_V3_HQ_ALPN_PROTO "\x0Ahq-interop"
+#define NGX_HTTP_V3_HQ_ALPN_DRAFT_FMT "\x05hq-%02uD"
#define NGX_HTTP_V3_VARLEN_INT_LEN 4
#define NGX_HTTP_V3_PREFIX_INT_LEN 11
@@ -102,6 +102,9 @@ typedef struct {
ngx_uint_t max_blocked_streams;
ngx_uint_t max_concurrent_pushes;
ngx_uint_t max_uni_streams;
+#if (NGX_HTTP_V3_HQ)
+ ngx_flag_t hq;
+#endif
ngx_quic_conf_t quic;
} ngx_http_v3_srv_conf_t;
diff --git a/src/http/v3/ngx_http_v3_module.c b/src/http/v3/ngx_http_v3_module.c
index 14e24d29a..0b2e59b9a 100644
--- a/src/http/v3/ngx_http_v3_module.c
+++ b/src/http/v3/ngx_http_v3_module.c
@@ -68,6 +68,15 @@ static ngx_command_t ngx_http_v3_commands[] = {
offsetof(ngx_http_v3_srv_conf_t, max_uni_streams),
NULL },
+#if (NGX_HTTP_V3_HQ)
+ { ngx_string("http3_hq"),
+ NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_CONF_FLAG,
+ ngx_conf_set_flag_slot,
+ NGX_HTTP_SRV_CONF_OFFSET,
+ offsetof(ngx_http_v3_srv_conf_t, hq),
+ NULL },
+#endif
+
{ ngx_string("http3_push"),
NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_TAKE1,
ngx_http_v3_push,
@@ -300,6 +309,9 @@ ngx_http_v3_create_srv_conf(ngx_conf_t *cf)
h3scf->max_blocked_streams = NGX_CONF_UNSET_UINT;
h3scf->max_concurrent_pushes = NGX_CONF_UNSET_UINT;
h3scf->max_uni_streams = NGX_CONF_UNSET_UINT;
+#if (NGX_HTTP_V3_HQ)
+ h3scf->hq = NGX_CONF_UNSET;
+#endif
h3scf->quic.tp.max_idle_timeout = NGX_CONF_UNSET_MSEC;
h3scf->quic.tp.max_ack_delay = NGX_CONF_UNSET_MSEC;
@@ -343,6 +355,10 @@ ngx_http_v3_merge_srv_conf(ngx_conf_t *cf, void *parent, void *child)
ngx_conf_merge_uint_value(conf->max_uni_streams,
prev->max_uni_streams, 3);
+#if (NGX_HTTP_V3_HQ)
+ ngx_conf_merge_value(conf->hq, prev->hq, 0);
+#endif
+
ngx_conf_merge_msec_value(conf->quic.tp.max_idle_timeout,
prev->quic.tp.max_idle_timeout, 60000);
diff --git a/src/http/v3/ngx_http_v3_request.c b/src/http/v3/ngx_http_v3_request.c
index a4b570370..7fce688aa 100644
--- a/src/http/v3/ngx_http_v3_request.c
+++ b/src/http/v3/ngx_http_v3_request.c
@@ -10,7 +10,9 @@
#include <ngx_http.h>
+#if (NGX_HTTP_V3_HQ)
static void ngx_http_v3_init_hq_stream(ngx_connection_t *c);
+#endif
static void ngx_http_v3_init_request_stream(ngx_connection_t *c);
static void ngx_http_v3_wait_request_handler(ngx_event_t *rev);
static void ngx_http_v3_cleanup_request(void *data);
@@ -64,11 +66,10 @@ ngx_http_v3_init(ngx_connection_t *c)
hc->ssl = 1;
- if (c->quic == NULL) {
- h3scf = ngx_http_get_module_srv_conf(hc->conf_ctx, ngx_http_v3_module);
+ h3scf = ngx_http_get_module_srv_conf(hc->conf_ctx, ngx_http_v3_module);
+ if (c->quic == NULL) {
ngx_quic_run(c, &h3scf->quic);
-
return;
}
@@ -82,10 +83,12 @@ ngx_http_v3_init(ngx_connection_t *c)
ngx_set_connection_log(c, clcf->error_log);
}
- if (!hc->addr_conf->http3) {
+#if (NGX_HTTP_V3_HQ)
+ if (h3scf->hq) {
ngx_http_v3_init_hq_stream(c);
return;
}
+#endif
if (ngx_http_v3_init_session(c) != NGX_OK) {
ngx_http_close_connection(c);
@@ -101,6 +104,8 @@ ngx_http_v3_init(ngx_connection_t *c)
}
+#if (NGX_HTTP_V3_HQ)
+
static void
ngx_http_v3_init_hq_stream(ngx_connection_t *c)
{
@@ -168,6 +173,8 @@ ngx_http_v3_init_hq_stream(ngx_connection_t *c)
}
}
+#endif
+
static void
ngx_http_v3_init_request_stream(ngx_connection_t *c)
@@ -387,16 +394,15 @@ ngx_http_v3_wait_request_handler(ngx_event_t *rev)
void
ngx_http_v3_reset_connection(ngx_connection_t *c)
{
- ngx_http_connection_t *hc;
ngx_http_v3_srv_conf_t *h3scf;
- hc = ngx_http_quic_get_connection(c);
+ h3scf = ngx_http_v3_get_module_srv_conf(c, ngx_http_v3_module);
- if (!hc->addr_conf->http3) {
+#if (NGX_HTTP_V3_HQ)
+ if (h3scf->hq) {
return;
}
-
- h3scf = ngx_http_v3_get_module_srv_conf(c, ngx_http_v3_module);
+#endif
if (h3scf->max_table_capacity > 0 && !c->read->eof) {
(void) ngx_http_v3_send_cancel_stream(c, c->quic->id);