Mercurial > hg > nginx-quic
annotate src/http/v3/ngx_http_v3_module.c @ 9089:b9230e37b8a1 quic
QUIC: removed "quic_mtu" directive.
The directive used to set the value of the "max_udp_payload_size" transport
parameter. According to RFC 9000, Section 18.2, the value specifies the size
of buffer for reading incoming datagrams:
This limit does act as an additional constraint on datagram size in
the same way as the path MTU, but it is a property of the endpoint
and not the path; see Section 14. It is expected that this is the
space an endpoint dedicates to holding incoming packets.
Current QUIC implementation uses the maximum possible buffer size (65527) for
reading datagrams.
author | Roman Arutyunyan <arut@nginx.com> |
---|---|
date | Thu, 11 May 2023 10:37:51 +0400 |
parents | c851a2ed5ce8 |
children |
rev | line source |
---|---|
7681 | 1 |
2 /* | |
3 * Copyright (C) Nginx, Inc. | |
4 * Copyright (C) Roman Arutyunyan | |
5 */ | |
6 | |
7 | |
8 #include <ngx_config.h> | |
9 #include <ngx_core.h> | |
10 #include <ngx_http.h> | |
11 | |
12 | |
8712
651cc905b7c2
HTTP/3: $http3 variable.
Roman Arutyunyan <arut@nginx.com>
parents:
8711
diff
changeset
|
13 static ngx_int_t ngx_http_v3_variable(ngx_http_request_t *r, |
8710
33226ac61076
HTTP/3: merged ngx_http_quic_module into ngx_http_v3_module.
Roman Arutyunyan <arut@nginx.com>
parents:
8554
diff
changeset
|
14 ngx_http_variable_value_t *v, uintptr_t data); |
33226ac61076
HTTP/3: merged ngx_http_quic_module into ngx_http_v3_module.
Roman Arutyunyan <arut@nginx.com>
parents:
8554
diff
changeset
|
15 static ngx_int_t ngx_http_v3_add_variables(ngx_conf_t *cf); |
8011
e533a352d118
Style: moved function declarations to match usual code style.
Roman Arutyunyan <arut@nginx.com>
parents:
8010
diff
changeset
|
16 static void *ngx_http_v3_create_srv_conf(ngx_conf_t *cf); |
e533a352d118
Style: moved function declarations to match usual code style.
Roman Arutyunyan <arut@nginx.com>
parents:
8010
diff
changeset
|
17 static char *ngx_http_v3_merge_srv_conf(ngx_conf_t *cf, void *parent, |
e533a352d118
Style: moved function declarations to match usual code style.
Roman Arutyunyan <arut@nginx.com>
parents:
8010
diff
changeset
|
18 void *child); |
8710
33226ac61076
HTTP/3: merged ngx_http_quic_module into ngx_http_v3_module.
Roman Arutyunyan <arut@nginx.com>
parents:
8554
diff
changeset
|
19 static char *ngx_http_quic_host_key(ngx_conf_t *cf, ngx_command_t *cmd, |
33226ac61076
HTTP/3: merged ngx_http_quic_module into ngx_http_v3_module.
Roman Arutyunyan <arut@nginx.com>
parents:
8554
diff
changeset
|
20 void *conf); |
8015 | 21 static void *ngx_http_v3_create_loc_conf(ngx_conf_t *cf); |
22 static char *ngx_http_v3_merge_loc_conf(ngx_conf_t *cf, void *parent, | |
23 void *child); | |
24 static char *ngx_http_v3_push(ngx_conf_t *cf, ngx_command_t *cmd, void *conf); | |
8011
e533a352d118
Style: moved function declarations to match usual code style.
Roman Arutyunyan <arut@nginx.com>
parents:
8010
diff
changeset
|
25 |
e533a352d118
Style: moved function declarations to match usual code style.
Roman Arutyunyan <arut@nginx.com>
parents:
8010
diff
changeset
|
26 |
7681 | 27 static ngx_command_t ngx_http_v3_commands[] = { |
7713
e9891e8ee975
Configurable transport parameters.
Vladimir Homutov <vl@nginx.com>
parents:
7681
diff
changeset
|
28 |
9047
c851a2ed5ce8
HTTP/3: "quic" parameter of "listen" directive.
Roman Arutyunyan <arut@nginx.com>
parents:
8990
diff
changeset
|
29 { ngx_string("http3"), |
c851a2ed5ce8
HTTP/3: "quic" parameter of "listen" directive.
Roman Arutyunyan <arut@nginx.com>
parents:
8990
diff
changeset
|
30 NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_CONF_FLAG, |
c851a2ed5ce8
HTTP/3: "quic" parameter of "listen" directive.
Roman Arutyunyan <arut@nginx.com>
parents:
8990
diff
changeset
|
31 ngx_conf_set_flag_slot, |
c851a2ed5ce8
HTTP/3: "quic" parameter of "listen" directive.
Roman Arutyunyan <arut@nginx.com>
parents:
8990
diff
changeset
|
32 NGX_HTTP_SRV_CONF_OFFSET, |
c851a2ed5ce8
HTTP/3: "quic" parameter of "listen" directive.
Roman Arutyunyan <arut@nginx.com>
parents:
8990
diff
changeset
|
33 offsetof(ngx_http_v3_srv_conf_t, enable), |
c851a2ed5ce8
HTTP/3: "quic" parameter of "listen" directive.
Roman Arutyunyan <arut@nginx.com>
parents:
8990
diff
changeset
|
34 NULL }, |
c851a2ed5ce8
HTTP/3: "quic" parameter of "listen" directive.
Roman Arutyunyan <arut@nginx.com>
parents:
8990
diff
changeset
|
35 |
c851a2ed5ce8
HTTP/3: "quic" parameter of "listen" directive.
Roman Arutyunyan <arut@nginx.com>
parents:
8990
diff
changeset
|
36 { ngx_string("http3_hq"), |
c851a2ed5ce8
HTTP/3: "quic" parameter of "listen" directive.
Roman Arutyunyan <arut@nginx.com>
parents:
8990
diff
changeset
|
37 NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_CONF_FLAG, |
c851a2ed5ce8
HTTP/3: "quic" parameter of "listen" directive.
Roman Arutyunyan <arut@nginx.com>
parents:
8990
diff
changeset
|
38 ngx_conf_set_flag_slot, |
c851a2ed5ce8
HTTP/3: "quic" parameter of "listen" directive.
Roman Arutyunyan <arut@nginx.com>
parents:
8990
diff
changeset
|
39 NGX_HTTP_SRV_CONF_OFFSET, |
c851a2ed5ce8
HTTP/3: "quic" parameter of "listen" directive.
Roman Arutyunyan <arut@nginx.com>
parents:
8990
diff
changeset
|
40 offsetof(ngx_http_v3_srv_conf_t, enable_hq), |
c851a2ed5ce8
HTTP/3: "quic" parameter of "listen" directive.
Roman Arutyunyan <arut@nginx.com>
parents:
8990
diff
changeset
|
41 NULL }, |
c851a2ed5ce8
HTTP/3: "quic" parameter of "listen" directive.
Roman Arutyunyan <arut@nginx.com>
parents:
8990
diff
changeset
|
42 |
8015 | 43 { ngx_string("http3_max_concurrent_pushes"), |
44 NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_CONF_TAKE1, | |
45 ngx_conf_set_num_slot, | |
46 NGX_HTTP_SRV_CONF_OFFSET, | |
47 offsetof(ngx_http_v3_srv_conf_t, max_concurrent_pushes), | |
48 NULL }, | |
49 | |
8713
d6ef13c5fd8e
QUIC: simplified configuration.
Vladimir Homutov <vl@nginx.com>
parents:
8712
diff
changeset
|
50 { ngx_string("http3_max_concurrent_streams"), |
8549
054f9be0aaf9
HTTP/3: http3_max_uni_streams directive.
Roman Arutyunyan <arut@nginx.com>
parents:
8489
diff
changeset
|
51 NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_CONF_TAKE1, |
054f9be0aaf9
HTTP/3: http3_max_uni_streams directive.
Roman Arutyunyan <arut@nginx.com>
parents:
8489
diff
changeset
|
52 ngx_conf_set_num_slot, |
054f9be0aaf9
HTTP/3: http3_max_uni_streams directive.
Roman Arutyunyan <arut@nginx.com>
parents:
8489
diff
changeset
|
53 NGX_HTTP_SRV_CONF_OFFSET, |
8713
d6ef13c5fd8e
QUIC: simplified configuration.
Vladimir Homutov <vl@nginx.com>
parents:
8712
diff
changeset
|
54 offsetof(ngx_http_v3_srv_conf_t, max_concurrent_streams), |
8549
054f9be0aaf9
HTTP/3: http3_max_uni_streams directive.
Roman Arutyunyan <arut@nginx.com>
parents:
8489
diff
changeset
|
55 NULL }, |
054f9be0aaf9
HTTP/3: http3_max_uni_streams directive.
Roman Arutyunyan <arut@nginx.com>
parents:
8489
diff
changeset
|
56 |
8015 | 57 { ngx_string("http3_push"), |
58 NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_TAKE1, | |
59 ngx_http_v3_push, | |
60 NGX_HTTP_LOC_CONF_OFFSET, | |
61 0, | |
62 NULL }, | |
63 | |
64 { ngx_string("http3_push_preload"), | |
65 NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_FLAG, | |
66 ngx_conf_set_flag_slot, | |
67 NGX_HTTP_LOC_CONF_OFFSET, | |
68 offsetof(ngx_http_v3_loc_conf_t, push_preload), | |
69 NULL }, | |
70 | |
8713
d6ef13c5fd8e
QUIC: simplified configuration.
Vladimir Homutov <vl@nginx.com>
parents:
8712
diff
changeset
|
71 { ngx_string("http3_stream_buffer_size"), |
8710
33226ac61076
HTTP/3: merged ngx_http_quic_module into ngx_http_v3_module.
Roman Arutyunyan <arut@nginx.com>
parents:
8554
diff
changeset
|
72 NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_CONF_TAKE1, |
33226ac61076
HTTP/3: merged ngx_http_quic_module into ngx_http_v3_module.
Roman Arutyunyan <arut@nginx.com>
parents:
8554
diff
changeset
|
73 ngx_conf_set_size_slot, |
33226ac61076
HTTP/3: merged ngx_http_quic_module into ngx_http_v3_module.
Roman Arutyunyan <arut@nginx.com>
parents:
8554
diff
changeset
|
74 NGX_HTTP_SRV_CONF_OFFSET, |
8713
d6ef13c5fd8e
QUIC: simplified configuration.
Vladimir Homutov <vl@nginx.com>
parents:
8712
diff
changeset
|
75 offsetof(ngx_http_v3_srv_conf_t, quic.stream_buffer_size), |
8710
33226ac61076
HTTP/3: merged ngx_http_quic_module into ngx_http_v3_module.
Roman Arutyunyan <arut@nginx.com>
parents:
8554
diff
changeset
|
76 NULL }, |
33226ac61076
HTTP/3: merged ngx_http_quic_module into ngx_http_v3_module.
Roman Arutyunyan <arut@nginx.com>
parents:
8554
diff
changeset
|
77 |
33226ac61076
HTTP/3: merged ngx_http_quic_module into ngx_http_v3_module.
Roman Arutyunyan <arut@nginx.com>
parents:
8554
diff
changeset
|
78 { ngx_string("quic_retry"), |
33226ac61076
HTTP/3: merged ngx_http_quic_module into ngx_http_v3_module.
Roman Arutyunyan <arut@nginx.com>
parents:
8554
diff
changeset
|
79 NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_CONF_FLAG, |
33226ac61076
HTTP/3: merged ngx_http_quic_module into ngx_http_v3_module.
Roman Arutyunyan <arut@nginx.com>
parents:
8554
diff
changeset
|
80 ngx_conf_set_flag_slot, |
33226ac61076
HTTP/3: merged ngx_http_quic_module into ngx_http_v3_module.
Roman Arutyunyan <arut@nginx.com>
parents:
8554
diff
changeset
|
81 NGX_HTTP_SRV_CONF_OFFSET, |
33226ac61076
HTTP/3: merged ngx_http_quic_module into ngx_http_v3_module.
Roman Arutyunyan <arut@nginx.com>
parents:
8554
diff
changeset
|
82 offsetof(ngx_http_v3_srv_conf_t, quic.retry), |
33226ac61076
HTTP/3: merged ngx_http_quic_module into ngx_http_v3_module.
Roman Arutyunyan <arut@nginx.com>
parents:
8554
diff
changeset
|
83 NULL }, |
33226ac61076
HTTP/3: merged ngx_http_quic_module into ngx_http_v3_module.
Roman Arutyunyan <arut@nginx.com>
parents:
8554
diff
changeset
|
84 |
33226ac61076
HTTP/3: merged ngx_http_quic_module into ngx_http_v3_module.
Roman Arutyunyan <arut@nginx.com>
parents:
8554
diff
changeset
|
85 { ngx_string("quic_gso"), |
33226ac61076
HTTP/3: merged ngx_http_quic_module into ngx_http_v3_module.
Roman Arutyunyan <arut@nginx.com>
parents:
8554
diff
changeset
|
86 NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_CONF_FLAG, |
33226ac61076
HTTP/3: merged ngx_http_quic_module into ngx_http_v3_module.
Roman Arutyunyan <arut@nginx.com>
parents:
8554
diff
changeset
|
87 ngx_conf_set_flag_slot, |
33226ac61076
HTTP/3: merged ngx_http_quic_module into ngx_http_v3_module.
Roman Arutyunyan <arut@nginx.com>
parents:
8554
diff
changeset
|
88 NGX_HTTP_SRV_CONF_OFFSET, |
33226ac61076
HTTP/3: merged ngx_http_quic_module into ngx_http_v3_module.
Roman Arutyunyan <arut@nginx.com>
parents:
8554
diff
changeset
|
89 offsetof(ngx_http_v3_srv_conf_t, quic.gso_enabled), |
33226ac61076
HTTP/3: merged ngx_http_quic_module into ngx_http_v3_module.
Roman Arutyunyan <arut@nginx.com>
parents:
8554
diff
changeset
|
90 NULL }, |
33226ac61076
HTTP/3: merged ngx_http_quic_module into ngx_http_v3_module.
Roman Arutyunyan <arut@nginx.com>
parents:
8554
diff
changeset
|
91 |
33226ac61076
HTTP/3: merged ngx_http_quic_module into ngx_http_v3_module.
Roman Arutyunyan <arut@nginx.com>
parents:
8554
diff
changeset
|
92 { ngx_string("quic_host_key"), |
33226ac61076
HTTP/3: merged ngx_http_quic_module into ngx_http_v3_module.
Roman Arutyunyan <arut@nginx.com>
parents:
8554
diff
changeset
|
93 NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_CONF_TAKE1, |
33226ac61076
HTTP/3: merged ngx_http_quic_module into ngx_http_v3_module.
Roman Arutyunyan <arut@nginx.com>
parents:
8554
diff
changeset
|
94 ngx_http_quic_host_key, |
33226ac61076
HTTP/3: merged ngx_http_quic_module into ngx_http_v3_module.
Roman Arutyunyan <arut@nginx.com>
parents:
8554
diff
changeset
|
95 NGX_HTTP_SRV_CONF_OFFSET, |
33226ac61076
HTTP/3: merged ngx_http_quic_module into ngx_http_v3_module.
Roman Arutyunyan <arut@nginx.com>
parents:
8554
diff
changeset
|
96 0, |
33226ac61076
HTTP/3: merged ngx_http_quic_module into ngx_http_v3_module.
Roman Arutyunyan <arut@nginx.com>
parents:
8554
diff
changeset
|
97 NULL }, |
33226ac61076
HTTP/3: merged ngx_http_quic_module into ngx_http_v3_module.
Roman Arutyunyan <arut@nginx.com>
parents:
8554
diff
changeset
|
98 |
8796
7106a918a277
QUIC: the "quic_active_connection_id_limit" directive.
Vladimir Homutov <vl@nginx.com>
parents:
8713
diff
changeset
|
99 { ngx_string("quic_active_connection_id_limit"), |
7106a918a277
QUIC: the "quic_active_connection_id_limit" directive.
Vladimir Homutov <vl@nginx.com>
parents:
8713
diff
changeset
|
100 NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_CONF_TAKE1, |
7106a918a277
QUIC: the "quic_active_connection_id_limit" directive.
Vladimir Homutov <vl@nginx.com>
parents:
8713
diff
changeset
|
101 ngx_conf_set_num_slot, |
7106a918a277
QUIC: the "quic_active_connection_id_limit" directive.
Vladimir Homutov <vl@nginx.com>
parents:
8713
diff
changeset
|
102 NGX_HTTP_SRV_CONF_OFFSET, |
7106a918a277
QUIC: the "quic_active_connection_id_limit" directive.
Vladimir Homutov <vl@nginx.com>
parents:
8713
diff
changeset
|
103 offsetof(ngx_http_v3_srv_conf_t, quic.active_connection_id_limit), |
7106a918a277
QUIC: the "quic_active_connection_id_limit" directive.
Vladimir Homutov <vl@nginx.com>
parents:
8713
diff
changeset
|
104 NULL }, |
7106a918a277
QUIC: the "quic_active_connection_id_limit" directive.
Vladimir Homutov <vl@nginx.com>
parents:
8713
diff
changeset
|
105 |
7681 | 106 ngx_null_command |
107 }; | |
108 | |
109 | |
110 static ngx_http_module_t ngx_http_v3_module_ctx = { | |
8710
33226ac61076
HTTP/3: merged ngx_http_quic_module into ngx_http_v3_module.
Roman Arutyunyan <arut@nginx.com>
parents:
8554
diff
changeset
|
111 ngx_http_v3_add_variables, /* preconfiguration */ |
7681 | 112 NULL, /* postconfiguration */ |
113 | |
114 NULL, /* create main configuration */ | |
115 NULL, /* init main configuration */ | |
116 | |
7713
e9891e8ee975
Configurable transport parameters.
Vladimir Homutov <vl@nginx.com>
parents:
7681
diff
changeset
|
117 ngx_http_v3_create_srv_conf, /* create server configuration */ |
e9891e8ee975
Configurable transport parameters.
Vladimir Homutov <vl@nginx.com>
parents:
7681
diff
changeset
|
118 ngx_http_v3_merge_srv_conf, /* merge server configuration */ |
7681 | 119 |
8015 | 120 ngx_http_v3_create_loc_conf, /* create location configuration */ |
121 ngx_http_v3_merge_loc_conf /* merge location configuration */ | |
7681 | 122 }; |
123 | |
124 | |
125 ngx_module_t ngx_http_v3_module = { | |
126 NGX_MODULE_V1, | |
127 &ngx_http_v3_module_ctx, /* module context */ | |
128 ngx_http_v3_commands, /* module directives */ | |
129 NGX_HTTP_MODULE, /* module type */ | |
130 NULL, /* init master */ | |
131 NULL, /* init module */ | |
132 NULL, /* init process */ | |
133 NULL, /* init thread */ | |
134 NULL, /* exit thread */ | |
135 NULL, /* exit process */ | |
136 NULL, /* exit master */ | |
137 NGX_MODULE_V1_PADDING | |
138 }; | |
7713
e9891e8ee975
Configurable transport parameters.
Vladimir Homutov <vl@nginx.com>
parents:
7681
diff
changeset
|
139 |
e9891e8ee975
Configurable transport parameters.
Vladimir Homutov <vl@nginx.com>
parents:
7681
diff
changeset
|
140 |
8710
33226ac61076
HTTP/3: merged ngx_http_quic_module into ngx_http_v3_module.
Roman Arutyunyan <arut@nginx.com>
parents:
8554
diff
changeset
|
141 static ngx_http_variable_t ngx_http_v3_vars[] = { |
33226ac61076
HTTP/3: merged ngx_http_quic_module into ngx_http_v3_module.
Roman Arutyunyan <arut@nginx.com>
parents:
8554
diff
changeset
|
142 |
8712
651cc905b7c2
HTTP/3: $http3 variable.
Roman Arutyunyan <arut@nginx.com>
parents:
8711
diff
changeset
|
143 { ngx_string("http3"), NULL, ngx_http_v3_variable, 0, 0, 0 }, |
8710
33226ac61076
HTTP/3: merged ngx_http_quic_module into ngx_http_v3_module.
Roman Arutyunyan <arut@nginx.com>
parents:
8554
diff
changeset
|
144 |
33226ac61076
HTTP/3: merged ngx_http_quic_module into ngx_http_v3_module.
Roman Arutyunyan <arut@nginx.com>
parents:
8554
diff
changeset
|
145 ngx_http_null_variable |
33226ac61076
HTTP/3: merged ngx_http_quic_module into ngx_http_v3_module.
Roman Arutyunyan <arut@nginx.com>
parents:
8554
diff
changeset
|
146 }; |
33226ac61076
HTTP/3: merged ngx_http_quic_module into ngx_http_v3_module.
Roman Arutyunyan <arut@nginx.com>
parents:
8554
diff
changeset
|
147 |
33226ac61076
HTTP/3: merged ngx_http_quic_module into ngx_http_v3_module.
Roman Arutyunyan <arut@nginx.com>
parents:
8554
diff
changeset
|
148 static ngx_str_t ngx_http_quic_salt = ngx_string("ngx_quic"); |
33226ac61076
HTTP/3: merged ngx_http_quic_module into ngx_http_v3_module.
Roman Arutyunyan <arut@nginx.com>
parents:
8554
diff
changeset
|
149 |
33226ac61076
HTTP/3: merged ngx_http_quic_module into ngx_http_v3_module.
Roman Arutyunyan <arut@nginx.com>
parents:
8554
diff
changeset
|
150 |
33226ac61076
HTTP/3: merged ngx_http_quic_module into ngx_http_v3_module.
Roman Arutyunyan <arut@nginx.com>
parents:
8554
diff
changeset
|
151 static ngx_int_t |
8712
651cc905b7c2
HTTP/3: $http3 variable.
Roman Arutyunyan <arut@nginx.com>
parents:
8711
diff
changeset
|
152 ngx_http_v3_variable(ngx_http_request_t *r, |
8710
33226ac61076
HTTP/3: merged ngx_http_quic_module into ngx_http_v3_module.
Roman Arutyunyan <arut@nginx.com>
parents:
8554
diff
changeset
|
153 ngx_http_variable_value_t *v, uintptr_t data) |
33226ac61076
HTTP/3: merged ngx_http_quic_module into ngx_http_v3_module.
Roman Arutyunyan <arut@nginx.com>
parents:
8554
diff
changeset
|
154 { |
9047
c851a2ed5ce8
HTTP/3: "quic" parameter of "listen" directive.
Roman Arutyunyan <arut@nginx.com>
parents:
8990
diff
changeset
|
155 ngx_http_v3_session_t *h3c; |
8710
33226ac61076
HTTP/3: merged ngx_http_quic_module into ngx_http_v3_module.
Roman Arutyunyan <arut@nginx.com>
parents:
8554
diff
changeset
|
156 |
9047
c851a2ed5ce8
HTTP/3: "quic" parameter of "listen" directive.
Roman Arutyunyan <arut@nginx.com>
parents:
8990
diff
changeset
|
157 if (r->connection->quic) { |
c851a2ed5ce8
HTTP/3: "quic" parameter of "listen" directive.
Roman Arutyunyan <arut@nginx.com>
parents:
8990
diff
changeset
|
158 h3c = ngx_http_v3_get_session(r->connection); |
8712
651cc905b7c2
HTTP/3: $http3 variable.
Roman Arutyunyan <arut@nginx.com>
parents:
8711
diff
changeset
|
159 |
9047
c851a2ed5ce8
HTTP/3: "quic" parameter of "listen" directive.
Roman Arutyunyan <arut@nginx.com>
parents:
8990
diff
changeset
|
160 if (h3c->hq) { |
8712
651cc905b7c2
HTTP/3: $http3 variable.
Roman Arutyunyan <arut@nginx.com>
parents:
8711
diff
changeset
|
161 v->len = sizeof("hq") - 1; |
651cc905b7c2
HTTP/3: $http3 variable.
Roman Arutyunyan <arut@nginx.com>
parents:
8711
diff
changeset
|
162 v->valid = 1; |
651cc905b7c2
HTTP/3: $http3 variable.
Roman Arutyunyan <arut@nginx.com>
parents:
8711
diff
changeset
|
163 v->no_cacheable = 0; |
651cc905b7c2
HTTP/3: $http3 variable.
Roman Arutyunyan <arut@nginx.com>
parents:
8711
diff
changeset
|
164 v->not_found = 0; |
651cc905b7c2
HTTP/3: $http3 variable.
Roman Arutyunyan <arut@nginx.com>
parents:
8711
diff
changeset
|
165 v->data = (u_char *) "hq"; |
651cc905b7c2
HTTP/3: $http3 variable.
Roman Arutyunyan <arut@nginx.com>
parents:
8711
diff
changeset
|
166 |
651cc905b7c2
HTTP/3: $http3 variable.
Roman Arutyunyan <arut@nginx.com>
parents:
8711
diff
changeset
|
167 return NGX_OK; |
651cc905b7c2
HTTP/3: $http3 variable.
Roman Arutyunyan <arut@nginx.com>
parents:
8711
diff
changeset
|
168 } |
651cc905b7c2
HTTP/3: $http3 variable.
Roman Arutyunyan <arut@nginx.com>
parents:
8711
diff
changeset
|
169 |
651cc905b7c2
HTTP/3: $http3 variable.
Roman Arutyunyan <arut@nginx.com>
parents:
8711
diff
changeset
|
170 v->len = sizeof("h3") - 1; |
8710
33226ac61076
HTTP/3: merged ngx_http_quic_module into ngx_http_v3_module.
Roman Arutyunyan <arut@nginx.com>
parents:
8554
diff
changeset
|
171 v->valid = 1; |
8712
651cc905b7c2
HTTP/3: $http3 variable.
Roman Arutyunyan <arut@nginx.com>
parents:
8711
diff
changeset
|
172 v->no_cacheable = 0; |
8710
33226ac61076
HTTP/3: merged ngx_http_quic_module into ngx_http_v3_module.
Roman Arutyunyan <arut@nginx.com>
parents:
8554
diff
changeset
|
173 v->not_found = 0; |
8712
651cc905b7c2
HTTP/3: $http3 variable.
Roman Arutyunyan <arut@nginx.com>
parents:
8711
diff
changeset
|
174 v->data = (u_char *) "h3"; |
651cc905b7c2
HTTP/3: $http3 variable.
Roman Arutyunyan <arut@nginx.com>
parents:
8711
diff
changeset
|
175 |
8710
33226ac61076
HTTP/3: merged ngx_http_quic_module into ngx_http_v3_module.
Roman Arutyunyan <arut@nginx.com>
parents:
8554
diff
changeset
|
176 return NGX_OK; |
33226ac61076
HTTP/3: merged ngx_http_quic_module into ngx_http_v3_module.
Roman Arutyunyan <arut@nginx.com>
parents:
8554
diff
changeset
|
177 } |
33226ac61076
HTTP/3: merged ngx_http_quic_module into ngx_http_v3_module.
Roman Arutyunyan <arut@nginx.com>
parents:
8554
diff
changeset
|
178 |
8712
651cc905b7c2
HTTP/3: $http3 variable.
Roman Arutyunyan <arut@nginx.com>
parents:
8711
diff
changeset
|
179 *v = ngx_http_variable_null_value; |
8710
33226ac61076
HTTP/3: merged ngx_http_quic_module into ngx_http_v3_module.
Roman Arutyunyan <arut@nginx.com>
parents:
8554
diff
changeset
|
180 |
33226ac61076
HTTP/3: merged ngx_http_quic_module into ngx_http_v3_module.
Roman Arutyunyan <arut@nginx.com>
parents:
8554
diff
changeset
|
181 return NGX_OK; |
33226ac61076
HTTP/3: merged ngx_http_quic_module into ngx_http_v3_module.
Roman Arutyunyan <arut@nginx.com>
parents:
8554
diff
changeset
|
182 } |
33226ac61076
HTTP/3: merged ngx_http_quic_module into ngx_http_v3_module.
Roman Arutyunyan <arut@nginx.com>
parents:
8554
diff
changeset
|
183 |
33226ac61076
HTTP/3: merged ngx_http_quic_module into ngx_http_v3_module.
Roman Arutyunyan <arut@nginx.com>
parents:
8554
diff
changeset
|
184 |
33226ac61076
HTTP/3: merged ngx_http_quic_module into ngx_http_v3_module.
Roman Arutyunyan <arut@nginx.com>
parents:
8554
diff
changeset
|
185 static ngx_int_t |
33226ac61076
HTTP/3: merged ngx_http_quic_module into ngx_http_v3_module.
Roman Arutyunyan <arut@nginx.com>
parents:
8554
diff
changeset
|
186 ngx_http_v3_add_variables(ngx_conf_t *cf) |
33226ac61076
HTTP/3: merged ngx_http_quic_module into ngx_http_v3_module.
Roman Arutyunyan <arut@nginx.com>
parents:
8554
diff
changeset
|
187 { |
33226ac61076
HTTP/3: merged ngx_http_quic_module into ngx_http_v3_module.
Roman Arutyunyan <arut@nginx.com>
parents:
8554
diff
changeset
|
188 ngx_http_variable_t *var, *v; |
33226ac61076
HTTP/3: merged ngx_http_quic_module into ngx_http_v3_module.
Roman Arutyunyan <arut@nginx.com>
parents:
8554
diff
changeset
|
189 |
33226ac61076
HTTP/3: merged ngx_http_quic_module into ngx_http_v3_module.
Roman Arutyunyan <arut@nginx.com>
parents:
8554
diff
changeset
|
190 for (v = ngx_http_v3_vars; v->name.len; v++) { |
33226ac61076
HTTP/3: merged ngx_http_quic_module into ngx_http_v3_module.
Roman Arutyunyan <arut@nginx.com>
parents:
8554
diff
changeset
|
191 var = ngx_http_add_variable(cf, &v->name, v->flags); |
33226ac61076
HTTP/3: merged ngx_http_quic_module into ngx_http_v3_module.
Roman Arutyunyan <arut@nginx.com>
parents:
8554
diff
changeset
|
192 if (var == NULL) { |
33226ac61076
HTTP/3: merged ngx_http_quic_module into ngx_http_v3_module.
Roman Arutyunyan <arut@nginx.com>
parents:
8554
diff
changeset
|
193 return NGX_ERROR; |
33226ac61076
HTTP/3: merged ngx_http_quic_module into ngx_http_v3_module.
Roman Arutyunyan <arut@nginx.com>
parents:
8554
diff
changeset
|
194 } |
33226ac61076
HTTP/3: merged ngx_http_quic_module into ngx_http_v3_module.
Roman Arutyunyan <arut@nginx.com>
parents:
8554
diff
changeset
|
195 |
33226ac61076
HTTP/3: merged ngx_http_quic_module into ngx_http_v3_module.
Roman Arutyunyan <arut@nginx.com>
parents:
8554
diff
changeset
|
196 var->get_handler = v->get_handler; |
33226ac61076
HTTP/3: merged ngx_http_quic_module into ngx_http_v3_module.
Roman Arutyunyan <arut@nginx.com>
parents:
8554
diff
changeset
|
197 var->data = v->data; |
33226ac61076
HTTP/3: merged ngx_http_quic_module into ngx_http_v3_module.
Roman Arutyunyan <arut@nginx.com>
parents:
8554
diff
changeset
|
198 } |
33226ac61076
HTTP/3: merged ngx_http_quic_module into ngx_http_v3_module.
Roman Arutyunyan <arut@nginx.com>
parents:
8554
diff
changeset
|
199 |
33226ac61076
HTTP/3: merged ngx_http_quic_module into ngx_http_v3_module.
Roman Arutyunyan <arut@nginx.com>
parents:
8554
diff
changeset
|
200 return NGX_OK; |
33226ac61076
HTTP/3: merged ngx_http_quic_module into ngx_http_v3_module.
Roman Arutyunyan <arut@nginx.com>
parents:
8554
diff
changeset
|
201 } |
33226ac61076
HTTP/3: merged ngx_http_quic_module into ngx_http_v3_module.
Roman Arutyunyan <arut@nginx.com>
parents:
8554
diff
changeset
|
202 |
33226ac61076
HTTP/3: merged ngx_http_quic_module into ngx_http_v3_module.
Roman Arutyunyan <arut@nginx.com>
parents:
8554
diff
changeset
|
203 |
7713
e9891e8ee975
Configurable transport parameters.
Vladimir Homutov <vl@nginx.com>
parents:
7681
diff
changeset
|
204 static void * |
e9891e8ee975
Configurable transport parameters.
Vladimir Homutov <vl@nginx.com>
parents:
7681
diff
changeset
|
205 ngx_http_v3_create_srv_conf(ngx_conf_t *cf) |
e9891e8ee975
Configurable transport parameters.
Vladimir Homutov <vl@nginx.com>
parents:
7681
diff
changeset
|
206 { |
8010
65c1fc5fae15
HTTP/3: renamed server configuration variables from v3cf to h3scf.
Roman Arutyunyan <arut@nginx.com>
parents:
7999
diff
changeset
|
207 ngx_http_v3_srv_conf_t *h3scf; |
7713
e9891e8ee975
Configurable transport parameters.
Vladimir Homutov <vl@nginx.com>
parents:
7681
diff
changeset
|
208 |
8010
65c1fc5fae15
HTTP/3: renamed server configuration variables from v3cf to h3scf.
Roman Arutyunyan <arut@nginx.com>
parents:
7999
diff
changeset
|
209 h3scf = ngx_pcalloc(cf->pool, sizeof(ngx_http_v3_srv_conf_t)); |
65c1fc5fae15
HTTP/3: renamed server configuration variables from v3cf to h3scf.
Roman Arutyunyan <arut@nginx.com>
parents:
7999
diff
changeset
|
210 if (h3scf == NULL) { |
7713
e9891e8ee975
Configurable transport parameters.
Vladimir Homutov <vl@nginx.com>
parents:
7681
diff
changeset
|
211 return NULL; |
e9891e8ee975
Configurable transport parameters.
Vladimir Homutov <vl@nginx.com>
parents:
7681
diff
changeset
|
212 } |
e9891e8ee975
Configurable transport parameters.
Vladimir Homutov <vl@nginx.com>
parents:
7681
diff
changeset
|
213 |
8710
33226ac61076
HTTP/3: merged ngx_http_quic_module into ngx_http_v3_module.
Roman Arutyunyan <arut@nginx.com>
parents:
8554
diff
changeset
|
214 /* |
33226ac61076
HTTP/3: merged ngx_http_quic_module into ngx_http_v3_module.
Roman Arutyunyan <arut@nginx.com>
parents:
8554
diff
changeset
|
215 * set by ngx_pcalloc(): |
33226ac61076
HTTP/3: merged ngx_http_quic_module into ngx_http_v3_module.
Roman Arutyunyan <arut@nginx.com>
parents:
8554
diff
changeset
|
216 * |
33226ac61076
HTTP/3: merged ngx_http_quic_module into ngx_http_v3_module.
Roman Arutyunyan <arut@nginx.com>
parents:
8554
diff
changeset
|
217 * h3scf->quic.host_key = { 0, NULL } |
33226ac61076
HTTP/3: merged ngx_http_quic_module into ngx_http_v3_module.
Roman Arutyunyan <arut@nginx.com>
parents:
8554
diff
changeset
|
218 * h3scf->quic.stream_reject_code_uni = 0; |
8713
d6ef13c5fd8e
QUIC: simplified configuration.
Vladimir Homutov <vl@nginx.com>
parents:
8712
diff
changeset
|
219 * h3scf->quic.disable_active_migration = 0; |
d6ef13c5fd8e
QUIC: simplified configuration.
Vladimir Homutov <vl@nginx.com>
parents:
8712
diff
changeset
|
220 * h3scf->quic.timeout = 0; |
d6ef13c5fd8e
QUIC: simplified configuration.
Vladimir Homutov <vl@nginx.com>
parents:
8712
diff
changeset
|
221 * h3scf->max_blocked_streams = 0; |
8710
33226ac61076
HTTP/3: merged ngx_http_quic_module into ngx_http_v3_module.
Roman Arutyunyan <arut@nginx.com>
parents:
8554
diff
changeset
|
222 */ |
9047
c851a2ed5ce8
HTTP/3: "quic" parameter of "listen" directive.
Roman Arutyunyan <arut@nginx.com>
parents:
8990
diff
changeset
|
223 |
c851a2ed5ce8
HTTP/3: "quic" parameter of "listen" directive.
Roman Arutyunyan <arut@nginx.com>
parents:
8990
diff
changeset
|
224 h3scf->enable = NGX_CONF_UNSET; |
c851a2ed5ce8
HTTP/3: "quic" parameter of "listen" directive.
Roman Arutyunyan <arut@nginx.com>
parents:
8990
diff
changeset
|
225 h3scf->enable_hq = NGX_CONF_UNSET; |
8713
d6ef13c5fd8e
QUIC: simplified configuration.
Vladimir Homutov <vl@nginx.com>
parents:
8712
diff
changeset
|
226 h3scf->max_table_capacity = NGX_HTTP_V3_MAX_TABLE_CAPACITY; |
8015 | 227 h3scf->max_concurrent_pushes = NGX_CONF_UNSET_UINT; |
8713
d6ef13c5fd8e
QUIC: simplified configuration.
Vladimir Homutov <vl@nginx.com>
parents:
8712
diff
changeset
|
228 h3scf->max_concurrent_streams = NGX_CONF_UNSET_UINT; |
7949
032cb35ce758
HTTP/3: http3_max_field_size directive to limit string size.
Roman Arutyunyan <arut@nginx.com>
parents:
7912
diff
changeset
|
229 |
8713
d6ef13c5fd8e
QUIC: simplified configuration.
Vladimir Homutov <vl@nginx.com>
parents:
8712
diff
changeset
|
230 h3scf->quic.stream_buffer_size = NGX_CONF_UNSET_SIZE; |
d6ef13c5fd8e
QUIC: simplified configuration.
Vladimir Homutov <vl@nginx.com>
parents:
8712
diff
changeset
|
231 h3scf->quic.max_concurrent_streams_bidi = NGX_CONF_UNSET_UINT; |
d6ef13c5fd8e
QUIC: simplified configuration.
Vladimir Homutov <vl@nginx.com>
parents:
8712
diff
changeset
|
232 h3scf->quic.max_concurrent_streams_uni = NGX_HTTP_V3_MAX_UNI_STREAMS; |
8710
33226ac61076
HTTP/3: merged ngx_http_quic_module into ngx_http_v3_module.
Roman Arutyunyan <arut@nginx.com>
parents:
8554
diff
changeset
|
233 h3scf->quic.retry = NGX_CONF_UNSET; |
33226ac61076
HTTP/3: merged ngx_http_quic_module into ngx_http_v3_module.
Roman Arutyunyan <arut@nginx.com>
parents:
8554
diff
changeset
|
234 h3scf->quic.gso_enabled = NGX_CONF_UNSET; |
33226ac61076
HTTP/3: merged ngx_http_quic_module into ngx_http_v3_module.
Roman Arutyunyan <arut@nginx.com>
parents:
8554
diff
changeset
|
235 h3scf->quic.stream_close_code = NGX_HTTP_V3_ERR_NO_ERROR; |
33226ac61076
HTTP/3: merged ngx_http_quic_module into ngx_http_v3_module.
Roman Arutyunyan <arut@nginx.com>
parents:
8554
diff
changeset
|
236 h3scf->quic.stream_reject_code_bidi = NGX_HTTP_V3_ERR_REQUEST_REJECTED; |
8796
7106a918a277
QUIC: the "quic_active_connection_id_limit" directive.
Vladimir Homutov <vl@nginx.com>
parents:
8713
diff
changeset
|
237 h3scf->quic.active_connection_id_limit = NGX_CONF_UNSET_UINT; |
8710
33226ac61076
HTTP/3: merged ngx_http_quic_module into ngx_http_v3_module.
Roman Arutyunyan <arut@nginx.com>
parents:
8554
diff
changeset
|
238 |
8990
b0c2234aaa9f
QUIC: application init() callback.
Roman Arutyunyan <arut@nginx.com>
parents:
8987
diff
changeset
|
239 h3scf->quic.init = ngx_http_v3_init; |
8987
1192923be0aa
QUIC: idle mode for main connection.
Roman Arutyunyan <arut@nginx.com>
parents:
8796
diff
changeset
|
240 h3scf->quic.shutdown = ngx_http_v3_shutdown; |
1192923be0aa
QUIC: idle mode for main connection.
Roman Arutyunyan <arut@nginx.com>
parents:
8796
diff
changeset
|
241 |
8010
65c1fc5fae15
HTTP/3: renamed server configuration variables from v3cf to h3scf.
Roman Arutyunyan <arut@nginx.com>
parents:
7999
diff
changeset
|
242 return h3scf; |
7713
e9891e8ee975
Configurable transport parameters.
Vladimir Homutov <vl@nginx.com>
parents:
7681
diff
changeset
|
243 } |
e9891e8ee975
Configurable transport parameters.
Vladimir Homutov <vl@nginx.com>
parents:
7681
diff
changeset
|
244 |
e9891e8ee975
Configurable transport parameters.
Vladimir Homutov <vl@nginx.com>
parents:
7681
diff
changeset
|
245 |
e9891e8ee975
Configurable transport parameters.
Vladimir Homutov <vl@nginx.com>
parents:
7681
diff
changeset
|
246 static char * |
e9891e8ee975
Configurable transport parameters.
Vladimir Homutov <vl@nginx.com>
parents:
7681
diff
changeset
|
247 ngx_http_v3_merge_srv_conf(ngx_conf_t *cf, void *parent, void *child) |
e9891e8ee975
Configurable transport parameters.
Vladimir Homutov <vl@nginx.com>
parents:
7681
diff
changeset
|
248 { |
e9891e8ee975
Configurable transport parameters.
Vladimir Homutov <vl@nginx.com>
parents:
7681
diff
changeset
|
249 ngx_http_v3_srv_conf_t *prev = parent; |
e9891e8ee975
Configurable transport parameters.
Vladimir Homutov <vl@nginx.com>
parents:
7681
diff
changeset
|
250 ngx_http_v3_srv_conf_t *conf = child; |
e9891e8ee975
Configurable transport parameters.
Vladimir Homutov <vl@nginx.com>
parents:
7681
diff
changeset
|
251 |
8710
33226ac61076
HTTP/3: merged ngx_http_quic_module into ngx_http_v3_module.
Roman Arutyunyan <arut@nginx.com>
parents:
8554
diff
changeset
|
252 ngx_http_ssl_srv_conf_t *sscf; |
33226ac61076
HTTP/3: merged ngx_http_quic_module into ngx_http_v3_module.
Roman Arutyunyan <arut@nginx.com>
parents:
8554
diff
changeset
|
253 |
9047
c851a2ed5ce8
HTTP/3: "quic" parameter of "listen" directive.
Roman Arutyunyan <arut@nginx.com>
parents:
8990
diff
changeset
|
254 ngx_conf_merge_value(conf->enable, prev->enable, 1); |
c851a2ed5ce8
HTTP/3: "quic" parameter of "listen" directive.
Roman Arutyunyan <arut@nginx.com>
parents:
8990
diff
changeset
|
255 |
c851a2ed5ce8
HTTP/3: "quic" parameter of "listen" directive.
Roman Arutyunyan <arut@nginx.com>
parents:
8990
diff
changeset
|
256 ngx_conf_merge_value(conf->enable_hq, prev->enable_hq, 0); |
c851a2ed5ce8
HTTP/3: "quic" parameter of "listen" directive.
Roman Arutyunyan <arut@nginx.com>
parents:
8990
diff
changeset
|
257 |
8015 | 258 ngx_conf_merge_uint_value(conf->max_concurrent_pushes, |
8554
4f922f611135
HTTP/3: replaced macros with values.
Roman Arutyunyan <arut@nginx.com>
parents:
8549
diff
changeset
|
259 prev->max_concurrent_pushes, 10); |
8015 | 260 |
8713
d6ef13c5fd8e
QUIC: simplified configuration.
Vladimir Homutov <vl@nginx.com>
parents:
8712
diff
changeset
|
261 ngx_conf_merge_uint_value(conf->max_concurrent_streams, |
d6ef13c5fd8e
QUIC: simplified configuration.
Vladimir Homutov <vl@nginx.com>
parents:
8712
diff
changeset
|
262 prev->max_concurrent_streams, 128); |
d6ef13c5fd8e
QUIC: simplified configuration.
Vladimir Homutov <vl@nginx.com>
parents:
8712
diff
changeset
|
263 |
d6ef13c5fd8e
QUIC: simplified configuration.
Vladimir Homutov <vl@nginx.com>
parents:
8712
diff
changeset
|
264 conf->max_blocked_streams = conf->max_concurrent_streams; |
8549
054f9be0aaf9
HTTP/3: http3_max_uni_streams directive.
Roman Arutyunyan <arut@nginx.com>
parents:
8489
diff
changeset
|
265 |
8713
d6ef13c5fd8e
QUIC: simplified configuration.
Vladimir Homutov <vl@nginx.com>
parents:
8712
diff
changeset
|
266 ngx_conf_merge_size_value(conf->quic.stream_buffer_size, |
d6ef13c5fd8e
QUIC: simplified configuration.
Vladimir Homutov <vl@nginx.com>
parents:
8712
diff
changeset
|
267 prev->quic.stream_buffer_size, |
d6ef13c5fd8e
QUIC: simplified configuration.
Vladimir Homutov <vl@nginx.com>
parents:
8712
diff
changeset
|
268 65536); |
8710
33226ac61076
HTTP/3: merged ngx_http_quic_module into ngx_http_v3_module.
Roman Arutyunyan <arut@nginx.com>
parents:
8554
diff
changeset
|
269 |
8713
d6ef13c5fd8e
QUIC: simplified configuration.
Vladimir Homutov <vl@nginx.com>
parents:
8712
diff
changeset
|
270 conf->quic.max_concurrent_streams_bidi = conf->max_concurrent_streams; |
8710
33226ac61076
HTTP/3: merged ngx_http_quic_module into ngx_http_v3_module.
Roman Arutyunyan <arut@nginx.com>
parents:
8554
diff
changeset
|
271 |
33226ac61076
HTTP/3: merged ngx_http_quic_module into ngx_http_v3_module.
Roman Arutyunyan <arut@nginx.com>
parents:
8554
diff
changeset
|
272 ngx_conf_merge_value(conf->quic.retry, prev->quic.retry, 0); |
33226ac61076
HTTP/3: merged ngx_http_quic_module into ngx_http_v3_module.
Roman Arutyunyan <arut@nginx.com>
parents:
8554
diff
changeset
|
273 ngx_conf_merge_value(conf->quic.gso_enabled, prev->quic.gso_enabled, 0); |
33226ac61076
HTTP/3: merged ngx_http_quic_module into ngx_http_v3_module.
Roman Arutyunyan <arut@nginx.com>
parents:
8554
diff
changeset
|
274 |
33226ac61076
HTTP/3: merged ngx_http_quic_module into ngx_http_v3_module.
Roman Arutyunyan <arut@nginx.com>
parents:
8554
diff
changeset
|
275 ngx_conf_merge_str_value(conf->quic.host_key, prev->quic.host_key, ""); |
33226ac61076
HTTP/3: merged ngx_http_quic_module into ngx_http_v3_module.
Roman Arutyunyan <arut@nginx.com>
parents:
8554
diff
changeset
|
276 |
8796
7106a918a277
QUIC: the "quic_active_connection_id_limit" directive.
Vladimir Homutov <vl@nginx.com>
parents:
8713
diff
changeset
|
277 ngx_conf_merge_uint_value(conf->quic.active_connection_id_limit, |
7106a918a277
QUIC: the "quic_active_connection_id_limit" directive.
Vladimir Homutov <vl@nginx.com>
parents:
8713
diff
changeset
|
278 prev->quic.active_connection_id_limit, |
7106a918a277
QUIC: the "quic_active_connection_id_limit" directive.
Vladimir Homutov <vl@nginx.com>
parents:
8713
diff
changeset
|
279 2); |
7106a918a277
QUIC: the "quic_active_connection_id_limit" directive.
Vladimir Homutov <vl@nginx.com>
parents:
8713
diff
changeset
|
280 |
8710
33226ac61076
HTTP/3: merged ngx_http_quic_module into ngx_http_v3_module.
Roman Arutyunyan <arut@nginx.com>
parents:
8554
diff
changeset
|
281 if (conf->quic.host_key.len == 0) { |
33226ac61076
HTTP/3: merged ngx_http_quic_module into ngx_http_v3_module.
Roman Arutyunyan <arut@nginx.com>
parents:
8554
diff
changeset
|
282 |
33226ac61076
HTTP/3: merged ngx_http_quic_module into ngx_http_v3_module.
Roman Arutyunyan <arut@nginx.com>
parents:
8554
diff
changeset
|
283 conf->quic.host_key.len = NGX_QUIC_DEFAULT_HOST_KEY_LEN; |
33226ac61076
HTTP/3: merged ngx_http_quic_module into ngx_http_v3_module.
Roman Arutyunyan <arut@nginx.com>
parents:
8554
diff
changeset
|
284 conf->quic.host_key.data = ngx_palloc(cf->pool, |
33226ac61076
HTTP/3: merged ngx_http_quic_module into ngx_http_v3_module.
Roman Arutyunyan <arut@nginx.com>
parents:
8554
diff
changeset
|
285 conf->quic.host_key.len); |
33226ac61076
HTTP/3: merged ngx_http_quic_module into ngx_http_v3_module.
Roman Arutyunyan <arut@nginx.com>
parents:
8554
diff
changeset
|
286 if (conf->quic.host_key.data == NULL) { |
33226ac61076
HTTP/3: merged ngx_http_quic_module into ngx_http_v3_module.
Roman Arutyunyan <arut@nginx.com>
parents:
8554
diff
changeset
|
287 return NGX_CONF_ERROR; |
33226ac61076
HTTP/3: merged ngx_http_quic_module into ngx_http_v3_module.
Roman Arutyunyan <arut@nginx.com>
parents:
8554
diff
changeset
|
288 } |
33226ac61076
HTTP/3: merged ngx_http_quic_module into ngx_http_v3_module.
Roman Arutyunyan <arut@nginx.com>
parents:
8554
diff
changeset
|
289 |
33226ac61076
HTTP/3: merged ngx_http_quic_module into ngx_http_v3_module.
Roman Arutyunyan <arut@nginx.com>
parents:
8554
diff
changeset
|
290 if (RAND_bytes(conf->quic.host_key.data, NGX_QUIC_DEFAULT_HOST_KEY_LEN) |
33226ac61076
HTTP/3: merged ngx_http_quic_module into ngx_http_v3_module.
Roman Arutyunyan <arut@nginx.com>
parents:
8554
diff
changeset
|
291 <= 0) |
33226ac61076
HTTP/3: merged ngx_http_quic_module into ngx_http_v3_module.
Roman Arutyunyan <arut@nginx.com>
parents:
8554
diff
changeset
|
292 { |
33226ac61076
HTTP/3: merged ngx_http_quic_module into ngx_http_v3_module.
Roman Arutyunyan <arut@nginx.com>
parents:
8554
diff
changeset
|
293 return NGX_CONF_ERROR; |
33226ac61076
HTTP/3: merged ngx_http_quic_module into ngx_http_v3_module.
Roman Arutyunyan <arut@nginx.com>
parents:
8554
diff
changeset
|
294 } |
33226ac61076
HTTP/3: merged ngx_http_quic_module into ngx_http_v3_module.
Roman Arutyunyan <arut@nginx.com>
parents:
8554
diff
changeset
|
295 } |
33226ac61076
HTTP/3: merged ngx_http_quic_module into ngx_http_v3_module.
Roman Arutyunyan <arut@nginx.com>
parents:
8554
diff
changeset
|
296 |
33226ac61076
HTTP/3: merged ngx_http_quic_module into ngx_http_v3_module.
Roman Arutyunyan <arut@nginx.com>
parents:
8554
diff
changeset
|
297 if (ngx_quic_derive_key(cf->log, "av_token_key", |
33226ac61076
HTTP/3: merged ngx_http_quic_module into ngx_http_v3_module.
Roman Arutyunyan <arut@nginx.com>
parents:
8554
diff
changeset
|
298 &conf->quic.host_key, &ngx_http_quic_salt, |
33226ac61076
HTTP/3: merged ngx_http_quic_module into ngx_http_v3_module.
Roman Arutyunyan <arut@nginx.com>
parents:
8554
diff
changeset
|
299 conf->quic.av_token_key, NGX_QUIC_AV_KEY_LEN) |
33226ac61076
HTTP/3: merged ngx_http_quic_module into ngx_http_v3_module.
Roman Arutyunyan <arut@nginx.com>
parents:
8554
diff
changeset
|
300 != NGX_OK) |
33226ac61076
HTTP/3: merged ngx_http_quic_module into ngx_http_v3_module.
Roman Arutyunyan <arut@nginx.com>
parents:
8554
diff
changeset
|
301 { |
33226ac61076
HTTP/3: merged ngx_http_quic_module into ngx_http_v3_module.
Roman Arutyunyan <arut@nginx.com>
parents:
8554
diff
changeset
|
302 return NGX_CONF_ERROR; |
33226ac61076
HTTP/3: merged ngx_http_quic_module into ngx_http_v3_module.
Roman Arutyunyan <arut@nginx.com>
parents:
8554
diff
changeset
|
303 } |
33226ac61076
HTTP/3: merged ngx_http_quic_module into ngx_http_v3_module.
Roman Arutyunyan <arut@nginx.com>
parents:
8554
diff
changeset
|
304 |
33226ac61076
HTTP/3: merged ngx_http_quic_module into ngx_http_v3_module.
Roman Arutyunyan <arut@nginx.com>
parents:
8554
diff
changeset
|
305 if (ngx_quic_derive_key(cf->log, "sr_token_key", |
33226ac61076
HTTP/3: merged ngx_http_quic_module into ngx_http_v3_module.
Roman Arutyunyan <arut@nginx.com>
parents:
8554
diff
changeset
|
306 &conf->quic.host_key, &ngx_http_quic_salt, |
33226ac61076
HTTP/3: merged ngx_http_quic_module into ngx_http_v3_module.
Roman Arutyunyan <arut@nginx.com>
parents:
8554
diff
changeset
|
307 conf->quic.sr_token_key, NGX_QUIC_SR_KEY_LEN) |
33226ac61076
HTTP/3: merged ngx_http_quic_module into ngx_http_v3_module.
Roman Arutyunyan <arut@nginx.com>
parents:
8554
diff
changeset
|
308 != NGX_OK) |
33226ac61076
HTTP/3: merged ngx_http_quic_module into ngx_http_v3_module.
Roman Arutyunyan <arut@nginx.com>
parents:
8554
diff
changeset
|
309 { |
33226ac61076
HTTP/3: merged ngx_http_quic_module into ngx_http_v3_module.
Roman Arutyunyan <arut@nginx.com>
parents:
8554
diff
changeset
|
310 return NGX_CONF_ERROR; |
33226ac61076
HTTP/3: merged ngx_http_quic_module into ngx_http_v3_module.
Roman Arutyunyan <arut@nginx.com>
parents:
8554
diff
changeset
|
311 } |
33226ac61076
HTTP/3: merged ngx_http_quic_module into ngx_http_v3_module.
Roman Arutyunyan <arut@nginx.com>
parents:
8554
diff
changeset
|
312 |
33226ac61076
HTTP/3: merged ngx_http_quic_module into ngx_http_v3_module.
Roman Arutyunyan <arut@nginx.com>
parents:
8554
diff
changeset
|
313 sscf = ngx_http_conf_get_module_srv_conf(cf, ngx_http_ssl_module); |
33226ac61076
HTTP/3: merged ngx_http_quic_module into ngx_http_v3_module.
Roman Arutyunyan <arut@nginx.com>
parents:
8554
diff
changeset
|
314 conf->quic.ssl = &sscf->ssl; |
33226ac61076
HTTP/3: merged ngx_http_quic_module into ngx_http_v3_module.
Roman Arutyunyan <arut@nginx.com>
parents:
8554
diff
changeset
|
315 |
8015 | 316 return NGX_CONF_OK; |
317 } | |
318 | |
319 | |
8710
33226ac61076
HTTP/3: merged ngx_http_quic_module into ngx_http_v3_module.
Roman Arutyunyan <arut@nginx.com>
parents:
8554
diff
changeset
|
320 static char * |
33226ac61076
HTTP/3: merged ngx_http_quic_module into ngx_http_v3_module.
Roman Arutyunyan <arut@nginx.com>
parents:
8554
diff
changeset
|
321 ngx_http_quic_host_key(ngx_conf_t *cf, ngx_command_t *cmd, void *conf) |
33226ac61076
HTTP/3: merged ngx_http_quic_module into ngx_http_v3_module.
Roman Arutyunyan <arut@nginx.com>
parents:
8554
diff
changeset
|
322 { |
33226ac61076
HTTP/3: merged ngx_http_quic_module into ngx_http_v3_module.
Roman Arutyunyan <arut@nginx.com>
parents:
8554
diff
changeset
|
323 ngx_http_v3_srv_conf_t *h3scf = conf; |
33226ac61076
HTTP/3: merged ngx_http_quic_module into ngx_http_v3_module.
Roman Arutyunyan <arut@nginx.com>
parents:
8554
diff
changeset
|
324 |
33226ac61076
HTTP/3: merged ngx_http_quic_module into ngx_http_v3_module.
Roman Arutyunyan <arut@nginx.com>
parents:
8554
diff
changeset
|
325 u_char *buf; |
33226ac61076
HTTP/3: merged ngx_http_quic_module into ngx_http_v3_module.
Roman Arutyunyan <arut@nginx.com>
parents:
8554
diff
changeset
|
326 size_t size; |
33226ac61076
HTTP/3: merged ngx_http_quic_module into ngx_http_v3_module.
Roman Arutyunyan <arut@nginx.com>
parents:
8554
diff
changeset
|
327 ssize_t n; |
33226ac61076
HTTP/3: merged ngx_http_quic_module into ngx_http_v3_module.
Roman Arutyunyan <arut@nginx.com>
parents:
8554
diff
changeset
|
328 ngx_str_t *value; |
33226ac61076
HTTP/3: merged ngx_http_quic_module into ngx_http_v3_module.
Roman Arutyunyan <arut@nginx.com>
parents:
8554
diff
changeset
|
329 ngx_file_t file; |
33226ac61076
HTTP/3: merged ngx_http_quic_module into ngx_http_v3_module.
Roman Arutyunyan <arut@nginx.com>
parents:
8554
diff
changeset
|
330 ngx_file_info_t fi; |
33226ac61076
HTTP/3: merged ngx_http_quic_module into ngx_http_v3_module.
Roman Arutyunyan <arut@nginx.com>
parents:
8554
diff
changeset
|
331 ngx_quic_conf_t *qcf; |
33226ac61076
HTTP/3: merged ngx_http_quic_module into ngx_http_v3_module.
Roman Arutyunyan <arut@nginx.com>
parents:
8554
diff
changeset
|
332 |
33226ac61076
HTTP/3: merged ngx_http_quic_module into ngx_http_v3_module.
Roman Arutyunyan <arut@nginx.com>
parents:
8554
diff
changeset
|
333 qcf = &h3scf->quic; |
33226ac61076
HTTP/3: merged ngx_http_quic_module into ngx_http_v3_module.
Roman Arutyunyan <arut@nginx.com>
parents:
8554
diff
changeset
|
334 |
33226ac61076
HTTP/3: merged ngx_http_quic_module into ngx_http_v3_module.
Roman Arutyunyan <arut@nginx.com>
parents:
8554
diff
changeset
|
335 if (qcf->host_key.len) { |
33226ac61076
HTTP/3: merged ngx_http_quic_module into ngx_http_v3_module.
Roman Arutyunyan <arut@nginx.com>
parents:
8554
diff
changeset
|
336 return "is duplicate"; |
33226ac61076
HTTP/3: merged ngx_http_quic_module into ngx_http_v3_module.
Roman Arutyunyan <arut@nginx.com>
parents:
8554
diff
changeset
|
337 } |
33226ac61076
HTTP/3: merged ngx_http_quic_module into ngx_http_v3_module.
Roman Arutyunyan <arut@nginx.com>
parents:
8554
diff
changeset
|
338 |
33226ac61076
HTTP/3: merged ngx_http_quic_module into ngx_http_v3_module.
Roman Arutyunyan <arut@nginx.com>
parents:
8554
diff
changeset
|
339 buf = NULL; |
33226ac61076
HTTP/3: merged ngx_http_quic_module into ngx_http_v3_module.
Roman Arutyunyan <arut@nginx.com>
parents:
8554
diff
changeset
|
340 #if (NGX_SUPPRESS_WARN) |
33226ac61076
HTTP/3: merged ngx_http_quic_module into ngx_http_v3_module.
Roman Arutyunyan <arut@nginx.com>
parents:
8554
diff
changeset
|
341 size = 0; |
33226ac61076
HTTP/3: merged ngx_http_quic_module into ngx_http_v3_module.
Roman Arutyunyan <arut@nginx.com>
parents:
8554
diff
changeset
|
342 #endif |
33226ac61076
HTTP/3: merged ngx_http_quic_module into ngx_http_v3_module.
Roman Arutyunyan <arut@nginx.com>
parents:
8554
diff
changeset
|
343 |
33226ac61076
HTTP/3: merged ngx_http_quic_module into ngx_http_v3_module.
Roman Arutyunyan <arut@nginx.com>
parents:
8554
diff
changeset
|
344 value = cf->args->elts; |
33226ac61076
HTTP/3: merged ngx_http_quic_module into ngx_http_v3_module.
Roman Arutyunyan <arut@nginx.com>
parents:
8554
diff
changeset
|
345 |
33226ac61076
HTTP/3: merged ngx_http_quic_module into ngx_http_v3_module.
Roman Arutyunyan <arut@nginx.com>
parents:
8554
diff
changeset
|
346 if (ngx_conf_full_name(cf->cycle, &value[1], 1) != NGX_OK) { |
33226ac61076
HTTP/3: merged ngx_http_quic_module into ngx_http_v3_module.
Roman Arutyunyan <arut@nginx.com>
parents:
8554
diff
changeset
|
347 return NGX_CONF_ERROR; |
33226ac61076
HTTP/3: merged ngx_http_quic_module into ngx_http_v3_module.
Roman Arutyunyan <arut@nginx.com>
parents:
8554
diff
changeset
|
348 } |
33226ac61076
HTTP/3: merged ngx_http_quic_module into ngx_http_v3_module.
Roman Arutyunyan <arut@nginx.com>
parents:
8554
diff
changeset
|
349 |
33226ac61076
HTTP/3: merged ngx_http_quic_module into ngx_http_v3_module.
Roman Arutyunyan <arut@nginx.com>
parents:
8554
diff
changeset
|
350 ngx_memzero(&file, sizeof(ngx_file_t)); |
33226ac61076
HTTP/3: merged ngx_http_quic_module into ngx_http_v3_module.
Roman Arutyunyan <arut@nginx.com>
parents:
8554
diff
changeset
|
351 file.name = value[1]; |
33226ac61076
HTTP/3: merged ngx_http_quic_module into ngx_http_v3_module.
Roman Arutyunyan <arut@nginx.com>
parents:
8554
diff
changeset
|
352 file.log = cf->log; |
33226ac61076
HTTP/3: merged ngx_http_quic_module into ngx_http_v3_module.
Roman Arutyunyan <arut@nginx.com>
parents:
8554
diff
changeset
|
353 |
33226ac61076
HTTP/3: merged ngx_http_quic_module into ngx_http_v3_module.
Roman Arutyunyan <arut@nginx.com>
parents:
8554
diff
changeset
|
354 file.fd = ngx_open_file(file.name.data, NGX_FILE_RDONLY, NGX_FILE_OPEN, 0); |
33226ac61076
HTTP/3: merged ngx_http_quic_module into ngx_http_v3_module.
Roman Arutyunyan <arut@nginx.com>
parents:
8554
diff
changeset
|
355 |
33226ac61076
HTTP/3: merged ngx_http_quic_module into ngx_http_v3_module.
Roman Arutyunyan <arut@nginx.com>
parents:
8554
diff
changeset
|
356 if (file.fd == NGX_INVALID_FILE) { |
33226ac61076
HTTP/3: merged ngx_http_quic_module into ngx_http_v3_module.
Roman Arutyunyan <arut@nginx.com>
parents:
8554
diff
changeset
|
357 ngx_conf_log_error(NGX_LOG_EMERG, cf, ngx_errno, |
33226ac61076
HTTP/3: merged ngx_http_quic_module into ngx_http_v3_module.
Roman Arutyunyan <arut@nginx.com>
parents:
8554
diff
changeset
|
358 ngx_open_file_n " \"%V\" failed", &file.name); |
33226ac61076
HTTP/3: merged ngx_http_quic_module into ngx_http_v3_module.
Roman Arutyunyan <arut@nginx.com>
parents:
8554
diff
changeset
|
359 return NGX_CONF_ERROR; |
33226ac61076
HTTP/3: merged ngx_http_quic_module into ngx_http_v3_module.
Roman Arutyunyan <arut@nginx.com>
parents:
8554
diff
changeset
|
360 } |
33226ac61076
HTTP/3: merged ngx_http_quic_module into ngx_http_v3_module.
Roman Arutyunyan <arut@nginx.com>
parents:
8554
diff
changeset
|
361 |
33226ac61076
HTTP/3: merged ngx_http_quic_module into ngx_http_v3_module.
Roman Arutyunyan <arut@nginx.com>
parents:
8554
diff
changeset
|
362 if (ngx_fd_info(file.fd, &fi) == NGX_FILE_ERROR) { |
33226ac61076
HTTP/3: merged ngx_http_quic_module into ngx_http_v3_module.
Roman Arutyunyan <arut@nginx.com>
parents:
8554
diff
changeset
|
363 ngx_conf_log_error(NGX_LOG_CRIT, cf, ngx_errno, |
33226ac61076
HTTP/3: merged ngx_http_quic_module into ngx_http_v3_module.
Roman Arutyunyan <arut@nginx.com>
parents:
8554
diff
changeset
|
364 ngx_fd_info_n " \"%V\" failed", &file.name); |
33226ac61076
HTTP/3: merged ngx_http_quic_module into ngx_http_v3_module.
Roman Arutyunyan <arut@nginx.com>
parents:
8554
diff
changeset
|
365 goto failed; |
33226ac61076
HTTP/3: merged ngx_http_quic_module into ngx_http_v3_module.
Roman Arutyunyan <arut@nginx.com>
parents:
8554
diff
changeset
|
366 } |
33226ac61076
HTTP/3: merged ngx_http_quic_module into ngx_http_v3_module.
Roman Arutyunyan <arut@nginx.com>
parents:
8554
diff
changeset
|
367 |
33226ac61076
HTTP/3: merged ngx_http_quic_module into ngx_http_v3_module.
Roman Arutyunyan <arut@nginx.com>
parents:
8554
diff
changeset
|
368 size = ngx_file_size(&fi); |
33226ac61076
HTTP/3: merged ngx_http_quic_module into ngx_http_v3_module.
Roman Arutyunyan <arut@nginx.com>
parents:
8554
diff
changeset
|
369 |
33226ac61076
HTTP/3: merged ngx_http_quic_module into ngx_http_v3_module.
Roman Arutyunyan <arut@nginx.com>
parents:
8554
diff
changeset
|
370 if (size == 0) { |
33226ac61076
HTTP/3: merged ngx_http_quic_module into ngx_http_v3_module.
Roman Arutyunyan <arut@nginx.com>
parents:
8554
diff
changeset
|
371 ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, |
33226ac61076
HTTP/3: merged ngx_http_quic_module into ngx_http_v3_module.
Roman Arutyunyan <arut@nginx.com>
parents:
8554
diff
changeset
|
372 "\"%V\" zero key size", &file.name); |
33226ac61076
HTTP/3: merged ngx_http_quic_module into ngx_http_v3_module.
Roman Arutyunyan <arut@nginx.com>
parents:
8554
diff
changeset
|
373 goto failed; |
33226ac61076
HTTP/3: merged ngx_http_quic_module into ngx_http_v3_module.
Roman Arutyunyan <arut@nginx.com>
parents:
8554
diff
changeset
|
374 } |
33226ac61076
HTTP/3: merged ngx_http_quic_module into ngx_http_v3_module.
Roman Arutyunyan <arut@nginx.com>
parents:
8554
diff
changeset
|
375 |
33226ac61076
HTTP/3: merged ngx_http_quic_module into ngx_http_v3_module.
Roman Arutyunyan <arut@nginx.com>
parents:
8554
diff
changeset
|
376 buf = ngx_pnalloc(cf->pool, size); |
33226ac61076
HTTP/3: merged ngx_http_quic_module into ngx_http_v3_module.
Roman Arutyunyan <arut@nginx.com>
parents:
8554
diff
changeset
|
377 if (buf == NULL) { |
33226ac61076
HTTP/3: merged ngx_http_quic_module into ngx_http_v3_module.
Roman Arutyunyan <arut@nginx.com>
parents:
8554
diff
changeset
|
378 goto failed; |
33226ac61076
HTTP/3: merged ngx_http_quic_module into ngx_http_v3_module.
Roman Arutyunyan <arut@nginx.com>
parents:
8554
diff
changeset
|
379 } |
33226ac61076
HTTP/3: merged ngx_http_quic_module into ngx_http_v3_module.
Roman Arutyunyan <arut@nginx.com>
parents:
8554
diff
changeset
|
380 |
33226ac61076
HTTP/3: merged ngx_http_quic_module into ngx_http_v3_module.
Roman Arutyunyan <arut@nginx.com>
parents:
8554
diff
changeset
|
381 n = ngx_read_file(&file, buf, size, 0); |
33226ac61076
HTTP/3: merged ngx_http_quic_module into ngx_http_v3_module.
Roman Arutyunyan <arut@nginx.com>
parents:
8554
diff
changeset
|
382 |
33226ac61076
HTTP/3: merged ngx_http_quic_module into ngx_http_v3_module.
Roman Arutyunyan <arut@nginx.com>
parents:
8554
diff
changeset
|
383 if (n == NGX_ERROR) { |
33226ac61076
HTTP/3: merged ngx_http_quic_module into ngx_http_v3_module.
Roman Arutyunyan <arut@nginx.com>
parents:
8554
diff
changeset
|
384 ngx_conf_log_error(NGX_LOG_CRIT, cf, ngx_errno, |
33226ac61076
HTTP/3: merged ngx_http_quic_module into ngx_http_v3_module.
Roman Arutyunyan <arut@nginx.com>
parents:
8554
diff
changeset
|
385 ngx_read_file_n " \"%V\" failed", &file.name); |
33226ac61076
HTTP/3: merged ngx_http_quic_module into ngx_http_v3_module.
Roman Arutyunyan <arut@nginx.com>
parents:
8554
diff
changeset
|
386 goto failed; |
33226ac61076
HTTP/3: merged ngx_http_quic_module into ngx_http_v3_module.
Roman Arutyunyan <arut@nginx.com>
parents:
8554
diff
changeset
|
387 } |
33226ac61076
HTTP/3: merged ngx_http_quic_module into ngx_http_v3_module.
Roman Arutyunyan <arut@nginx.com>
parents:
8554
diff
changeset
|
388 |
33226ac61076
HTTP/3: merged ngx_http_quic_module into ngx_http_v3_module.
Roman Arutyunyan <arut@nginx.com>
parents:
8554
diff
changeset
|
389 if ((size_t) n != size) { |
33226ac61076
HTTP/3: merged ngx_http_quic_module into ngx_http_v3_module.
Roman Arutyunyan <arut@nginx.com>
parents:
8554
diff
changeset
|
390 ngx_conf_log_error(NGX_LOG_CRIT, cf, 0, |
33226ac61076
HTTP/3: merged ngx_http_quic_module into ngx_http_v3_module.
Roman Arutyunyan <arut@nginx.com>
parents:
8554
diff
changeset
|
391 ngx_read_file_n " \"%V\" returned only " |
33226ac61076
HTTP/3: merged ngx_http_quic_module into ngx_http_v3_module.
Roman Arutyunyan <arut@nginx.com>
parents:
8554
diff
changeset
|
392 "%z bytes instead of %uz", &file.name, n, size); |
33226ac61076
HTTP/3: merged ngx_http_quic_module into ngx_http_v3_module.
Roman Arutyunyan <arut@nginx.com>
parents:
8554
diff
changeset
|
393 goto failed; |
33226ac61076
HTTP/3: merged ngx_http_quic_module into ngx_http_v3_module.
Roman Arutyunyan <arut@nginx.com>
parents:
8554
diff
changeset
|
394 } |
33226ac61076
HTTP/3: merged ngx_http_quic_module into ngx_http_v3_module.
Roman Arutyunyan <arut@nginx.com>
parents:
8554
diff
changeset
|
395 |
33226ac61076
HTTP/3: merged ngx_http_quic_module into ngx_http_v3_module.
Roman Arutyunyan <arut@nginx.com>
parents:
8554
diff
changeset
|
396 qcf->host_key.data = buf; |
33226ac61076
HTTP/3: merged ngx_http_quic_module into ngx_http_v3_module.
Roman Arutyunyan <arut@nginx.com>
parents:
8554
diff
changeset
|
397 qcf->host_key.len = n; |
33226ac61076
HTTP/3: merged ngx_http_quic_module into ngx_http_v3_module.
Roman Arutyunyan <arut@nginx.com>
parents:
8554
diff
changeset
|
398 |
33226ac61076
HTTP/3: merged ngx_http_quic_module into ngx_http_v3_module.
Roman Arutyunyan <arut@nginx.com>
parents:
8554
diff
changeset
|
399 if (ngx_close_file(file.fd) == NGX_FILE_ERROR) { |
33226ac61076
HTTP/3: merged ngx_http_quic_module into ngx_http_v3_module.
Roman Arutyunyan <arut@nginx.com>
parents:
8554
diff
changeset
|
400 ngx_log_error(NGX_LOG_ALERT, cf->log, ngx_errno, |
33226ac61076
HTTP/3: merged ngx_http_quic_module into ngx_http_v3_module.
Roman Arutyunyan <arut@nginx.com>
parents:
8554
diff
changeset
|
401 ngx_close_file_n " \"%V\" failed", &file.name); |
33226ac61076
HTTP/3: merged ngx_http_quic_module into ngx_http_v3_module.
Roman Arutyunyan <arut@nginx.com>
parents:
8554
diff
changeset
|
402 } |
33226ac61076
HTTP/3: merged ngx_http_quic_module into ngx_http_v3_module.
Roman Arutyunyan <arut@nginx.com>
parents:
8554
diff
changeset
|
403 |
33226ac61076
HTTP/3: merged ngx_http_quic_module into ngx_http_v3_module.
Roman Arutyunyan <arut@nginx.com>
parents:
8554
diff
changeset
|
404 return NGX_CONF_OK; |
33226ac61076
HTTP/3: merged ngx_http_quic_module into ngx_http_v3_module.
Roman Arutyunyan <arut@nginx.com>
parents:
8554
diff
changeset
|
405 |
33226ac61076
HTTP/3: merged ngx_http_quic_module into ngx_http_v3_module.
Roman Arutyunyan <arut@nginx.com>
parents:
8554
diff
changeset
|
406 failed: |
33226ac61076
HTTP/3: merged ngx_http_quic_module into ngx_http_v3_module.
Roman Arutyunyan <arut@nginx.com>
parents:
8554
diff
changeset
|
407 |
33226ac61076
HTTP/3: merged ngx_http_quic_module into ngx_http_v3_module.
Roman Arutyunyan <arut@nginx.com>
parents:
8554
diff
changeset
|
408 if (ngx_close_file(file.fd) == NGX_FILE_ERROR) { |
33226ac61076
HTTP/3: merged ngx_http_quic_module into ngx_http_v3_module.
Roman Arutyunyan <arut@nginx.com>
parents:
8554
diff
changeset
|
409 ngx_log_error(NGX_LOG_ALERT, cf->log, ngx_errno, |
33226ac61076
HTTP/3: merged ngx_http_quic_module into ngx_http_v3_module.
Roman Arutyunyan <arut@nginx.com>
parents:
8554
diff
changeset
|
410 ngx_close_file_n " \"%V\" failed", &file.name); |
33226ac61076
HTTP/3: merged ngx_http_quic_module into ngx_http_v3_module.
Roman Arutyunyan <arut@nginx.com>
parents:
8554
diff
changeset
|
411 } |
33226ac61076
HTTP/3: merged ngx_http_quic_module into ngx_http_v3_module.
Roman Arutyunyan <arut@nginx.com>
parents:
8554
diff
changeset
|
412 |
33226ac61076
HTTP/3: merged ngx_http_quic_module into ngx_http_v3_module.
Roman Arutyunyan <arut@nginx.com>
parents:
8554
diff
changeset
|
413 if (buf) { |
33226ac61076
HTTP/3: merged ngx_http_quic_module into ngx_http_v3_module.
Roman Arutyunyan <arut@nginx.com>
parents:
8554
diff
changeset
|
414 ngx_explicit_memzero(buf, size); |
33226ac61076
HTTP/3: merged ngx_http_quic_module into ngx_http_v3_module.
Roman Arutyunyan <arut@nginx.com>
parents:
8554
diff
changeset
|
415 } |
33226ac61076
HTTP/3: merged ngx_http_quic_module into ngx_http_v3_module.
Roman Arutyunyan <arut@nginx.com>
parents:
8554
diff
changeset
|
416 |
33226ac61076
HTTP/3: merged ngx_http_quic_module into ngx_http_v3_module.
Roman Arutyunyan <arut@nginx.com>
parents:
8554
diff
changeset
|
417 return NGX_CONF_ERROR; |
33226ac61076
HTTP/3: merged ngx_http_quic_module into ngx_http_v3_module.
Roman Arutyunyan <arut@nginx.com>
parents:
8554
diff
changeset
|
418 } |
33226ac61076
HTTP/3: merged ngx_http_quic_module into ngx_http_v3_module.
Roman Arutyunyan <arut@nginx.com>
parents:
8554
diff
changeset
|
419 |
33226ac61076
HTTP/3: merged ngx_http_quic_module into ngx_http_v3_module.
Roman Arutyunyan <arut@nginx.com>
parents:
8554
diff
changeset
|
420 |
8015 | 421 static void * |
422 ngx_http_v3_create_loc_conf(ngx_conf_t *cf) | |
423 { | |
424 ngx_http_v3_loc_conf_t *h3lcf; | |
425 | |
426 h3lcf = ngx_pcalloc(cf->pool, sizeof(ngx_http_v3_loc_conf_t)); | |
427 if (h3lcf == NULL) { | |
428 return NULL; | |
429 } | |
430 | |
431 /* | |
432 * set by ngx_pcalloc(): | |
433 * | |
434 * h3lcf->pushes = NULL; | |
435 */ | |
436 | |
437 h3lcf->push_preload = NGX_CONF_UNSET; | |
438 h3lcf->push = NGX_CONF_UNSET; | |
439 | |
440 return h3lcf; | |
441 } | |
442 | |
443 | |
444 static char * | |
445 ngx_http_v3_merge_loc_conf(ngx_conf_t *cf, void *parent, void *child) | |
446 { | |
447 ngx_http_v3_loc_conf_t *prev = parent; | |
448 ngx_http_v3_loc_conf_t *conf = child; | |
449 | |
450 ngx_conf_merge_value(conf->push, prev->push, 1); | |
451 | |
452 if (conf->push && conf->pushes == NULL) { | |
453 conf->pushes = prev->pushes; | |
454 } | |
455 | |
456 ngx_conf_merge_value(conf->push_preload, prev->push_preload, 0); | |
457 | |
7830
036164360fa9
HTTP/3: directives with limited values converted to post handler.
Sergey Kandaurov <pluknet@nginx.com>
parents:
7829
diff
changeset
|
458 return NGX_CONF_OK; |
036164360fa9
HTTP/3: directives with limited values converted to post handler.
Sergey Kandaurov <pluknet@nginx.com>
parents:
7829
diff
changeset
|
459 } |
8015 | 460 |
461 | |
462 static char * | |
463 ngx_http_v3_push(ngx_conf_t *cf, ngx_command_t *cmd, void *conf) | |
464 { | |
465 ngx_http_v3_loc_conf_t *h3lcf = conf; | |
466 | |
467 ngx_str_t *value; | |
468 ngx_http_complex_value_t *cv; | |
469 ngx_http_compile_complex_value_t ccv; | |
470 | |
471 value = cf->args->elts; | |
472 | |
473 if (ngx_strcmp(value[1].data, "off") == 0) { | |
474 | |
475 if (h3lcf->pushes) { | |
476 return "\"off\" parameter cannot be used with URI"; | |
477 } | |
478 | |
479 if (h3lcf->push == 0) { | |
480 return "is duplicate"; | |
481 } | |
482 | |
483 h3lcf->push = 0; | |
484 return NGX_CONF_OK; | |
485 } | |
486 | |
487 if (h3lcf->push == 0) { | |
488 return "URI cannot be used with \"off\" parameter"; | |
489 } | |
490 | |
491 h3lcf->push = 1; | |
492 | |
493 if (h3lcf->pushes == NULL) { | |
494 h3lcf->pushes = ngx_array_create(cf->pool, 1, | |
495 sizeof(ngx_http_complex_value_t)); | |
496 if (h3lcf->pushes == NULL) { | |
497 return NGX_CONF_ERROR; | |
498 } | |
499 } | |
500 | |
501 cv = ngx_array_push(h3lcf->pushes); | |
502 if (cv == NULL) { | |
503 return NGX_CONF_ERROR; | |
504 } | |
505 | |
506 ngx_memzero(&ccv, sizeof(ngx_http_compile_complex_value_t)); | |
507 | |
508 ccv.cf = cf; | |
509 ccv.value = &value[1]; | |
510 ccv.complex_value = cv; | |
511 | |
512 if (ngx_http_compile_complex_value(&ccv) != NGX_OK) { | |
513 return NGX_CONF_ERROR; | |
514 } | |
515 | |
516 return NGX_CONF_OK; | |
517 } |