aboutsummaryrefslogtreecommitdiff
path: root/src/http/v3/ngx_http_v3_module.c
diff options
context:
space:
mode:
authorRoman Arutyunyan <arut@nginx.com>2023-02-27 14:00:56 +0400
committerRoman Arutyunyan <arut@nginx.com>2023-02-27 14:00:56 +0400
commit815ef96124176baef4e940c4beaec158305b368a (patch)
treeef62d1240eae60059e678eb5801caeffa8f14bba /src/http/v3/ngx_http_v3_module.c
parenta36ebf7e95baebf445b0973bd270bc009b0b0e9a (diff)
downloadnginx-815ef96124176baef4e940c4beaec158305b368a.tar.gz
nginx-815ef96124176baef4e940c4beaec158305b368a.zip
HTTP/3: "quic" parameter of "listen" directive.
Now "listen" directve has a new "quic" parameter which enables QUIC protocol for the address. Further, to enable HTTP/3, a new directive "http3" is introduced. The hq-interop protocol is enabled by "http3_hq" as before. Now application protocol is chosen by ALPN. Previously used "http3" parameter of "listen" is deprecated.
Diffstat (limited to 'src/http/v3/ngx_http_v3_module.c')
-rw-r--r--src/http/v3/ngx_http_v3_module.c50
1 files changed, 25 insertions, 25 deletions
diff --git a/src/http/v3/ngx_http_v3_module.c b/src/http/v3/ngx_http_v3_module.c
index ed6becf31..02b88b479 100644
--- a/src/http/v3/ngx_http_v3_module.c
+++ b/src/http/v3/ngx_http_v3_module.c
@@ -32,6 +32,20 @@ static ngx_conf_post_t ngx_http_quic_mtu_post =
static ngx_command_t ngx_http_v3_commands[] = {
+ { ngx_string("http3"),
+ 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, enable),
+ NULL },
+
+ { 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, enable_hq),
+ NULL },
+
{ ngx_string("http3_max_concurrent_pushes"),
NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_CONF_TAKE1,
ngx_conf_set_num_slot,
@@ -46,15 +60,6 @@ static ngx_command_t ngx_http_v3_commands[] = {
offsetof(ngx_http_v3_srv_conf_t, max_concurrent_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,
@@ -160,14 +165,12 @@ static ngx_int_t
ngx_http_v3_variable(ngx_http_request_t *r,
ngx_http_variable_value_t *v, uintptr_t data)
{
- if (r->connection->quic) {
-#if (NGX_HTTP_V3_HQ)
+ ngx_http_v3_session_t *h3c;
- ngx_http_v3_srv_conf_t *h3scf;
-
- h3scf = ngx_http_get_module_srv_conf(r, ngx_http_v3_module);
+ if (r->connection->quic) {
+ h3c = ngx_http_v3_get_session(r->connection);
- if (h3scf->hq) {
+ if (h3c->hq) {
v->len = sizeof("hq") - 1;
v->valid = 1;
v->no_cacheable = 0;
@@ -177,8 +180,6 @@ ngx_http_v3_variable(ngx_http_request_t *r,
return NGX_OK;
}
-#endif
-
v->len = sizeof("h3") - 1;
v->valid = 1;
v->no_cacheable = 0;
@@ -232,12 +233,12 @@ ngx_http_v3_create_srv_conf(ngx_conf_t *cf)
* h3scf->quic.timeout = 0;
* h3scf->max_blocked_streams = 0;
*/
+
+ h3scf->enable = NGX_CONF_UNSET;
+ h3scf->enable_hq = NGX_CONF_UNSET;
h3scf->max_table_capacity = NGX_HTTP_V3_MAX_TABLE_CAPACITY;
h3scf->max_concurrent_pushes = NGX_CONF_UNSET_UINT;
h3scf->max_concurrent_streams = NGX_CONF_UNSET_UINT;
-#if (NGX_HTTP_V3_HQ)
- h3scf->hq = NGX_CONF_UNSET;
-#endif
h3scf->quic.mtu = NGX_CONF_UNSET_SIZE;
h3scf->quic.stream_buffer_size = NGX_CONF_UNSET_SIZE;
@@ -264,6 +265,10 @@ ngx_http_v3_merge_srv_conf(ngx_conf_t *cf, void *parent, void *child)
ngx_http_ssl_srv_conf_t *sscf;
+ ngx_conf_merge_value(conf->enable, prev->enable, 1);
+
+ ngx_conf_merge_value(conf->enable_hq, prev->enable_hq, 0);
+
ngx_conf_merge_uint_value(conf->max_concurrent_pushes,
prev->max_concurrent_pushes, 10);
@@ -272,11 +277,6 @@ ngx_http_v3_merge_srv_conf(ngx_conf_t *cf, void *parent, void *child)
conf->max_blocked_streams = conf->max_concurrent_streams;
-#if (NGX_HTTP_V3_HQ)
- ngx_conf_merge_value(conf->hq, prev->hq, 0);
-#endif
-
-
ngx_conf_merge_size_value(conf->quic.mtu, prev->quic.mtu,
NGX_QUIC_MAX_UDP_PAYLOAD_SIZE);