Mercurial > hg > nginx
annotate src/http/v3/ngx_http_v3_streams.c @ 8902:925572184d4a quic
HTTP/3: adjusted QUIC connection finalization.
When an HTTP/3 function returns an error in context of a QUIC stream, it's
this function's responsibility now to finalize the entire QUIC connection
with the right code, if required. Previously, QUIC connection finalization
could be done both outside and inside such functions. The new rule follows
a similar rule for logging, leads to cleaner code, and allows to provide more
details about the error.
While here, a few error cases are no longer treated as fatal and QUIC connection
is no longer finalized in these cases. A few other cases now lead to
stream reset instead of connection finalization.
author | Roman Arutyunyan <arut@nginx.com> |
---|---|
date | Mon, 18 Oct 2021 15:22:33 +0300 |
parents | 72b304f6207c |
children | 0d3bf08eaac0 |
rev | line source |
---|---|
8215 | 1 |
2 /* | |
3 * Copyright (C) Roman Arutyunyan | |
4 * Copyright (C) Nginx, Inc. | |
5 */ | |
6 | |
7 | |
8 #include <ngx_config.h> | |
9 #include <ngx_core.h> | |
10 #include <ngx_http.h> | |
11 | |
12 | |
13 typedef struct { | |
8772
345370fdd32d
HTTP/3: moved parsing uni stream type to ngx_http_v3_parse.c.
Roman Arutyunyan <arut@nginx.com>
parents:
8771
diff
changeset
|
14 ngx_http_v3_parse_uni_t parse; |
8283
dadbc66e9fca
Simplifed handling HTTP/3 streams.
Roman Arutyunyan <arut@nginx.com>
parents:
8281
diff
changeset
|
15 ngx_int_t index; |
8215 | 16 } ngx_http_v3_uni_stream_t; |
17 | |
18 | |
8497 | 19 typedef struct { |
20 ngx_queue_t queue; | |
21 uint64_t id; | |
22 ngx_connection_t *connection; | |
23 ngx_uint_t *npushing; | |
24 } ngx_http_v3_push_t; | |
25 | |
26 | |
8215 | 27 static void ngx_http_v3_close_uni_stream(ngx_connection_t *c); |
8226
268f4389130d
Refactored HTTP/3 parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8215
diff
changeset
|
28 static void ngx_http_v3_uni_read_handler(ngx_event_t *rev); |
8281
618a65de08b3
When closing a QUIC connection, wait for all streams to finish.
Roman Arutyunyan <arut@nginx.com>
parents:
8228
diff
changeset
|
29 static void ngx_http_v3_dummy_write_handler(ngx_event_t *wev); |
8497 | 30 static void ngx_http_v3_push_cleanup(void *data); |
8283
dadbc66e9fca
Simplifed handling HTTP/3 streams.
Roman Arutyunyan <arut@nginx.com>
parents:
8281
diff
changeset
|
31 static ngx_connection_t *ngx_http_v3_get_uni_stream(ngx_connection_t *c, |
8215 | 32 ngx_uint_t type); |
8725
98c4020f1c9a
HTTP/3: keepalive timeout.
Roman Arutyunyan <arut@nginx.com>
parents:
8724
diff
changeset
|
33 |
98c4020f1c9a
HTTP/3: keepalive timeout.
Roman Arutyunyan <arut@nginx.com>
parents:
8724
diff
changeset
|
34 |
8679
e1eb7f4ca9f1
HTTP/3: refactored request parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8630
diff
changeset
|
35 void |
e1eb7f4ca9f1
HTTP/3: refactored request parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8630
diff
changeset
|
36 ngx_http_v3_init_uni_stream(ngx_connection_t *c) |
e1eb7f4ca9f1
HTTP/3: refactored request parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8630
diff
changeset
|
37 { |
8824
054f9be0aaf9
HTTP/3: http3_max_uni_streams directive.
Roman Arutyunyan <arut@nginx.com>
parents:
8821
diff
changeset
|
38 uint64_t n; |
054f9be0aaf9
HTTP/3: http3_max_uni_streams directive.
Roman Arutyunyan <arut@nginx.com>
parents:
8821
diff
changeset
|
39 ngx_http_v3_srv_conf_t *h3scf; |
8679
e1eb7f4ca9f1
HTTP/3: refactored request parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8630
diff
changeset
|
40 ngx_http_v3_uni_stream_t *us; |
e1eb7f4ca9f1
HTTP/3: refactored request parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8630
diff
changeset
|
41 |
e1eb7f4ca9f1
HTTP/3: refactored request parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8630
diff
changeset
|
42 ngx_log_debug0(NGX_LOG_DEBUG_HTTP, c->log, 0, "http3 init uni stream"); |
8215 | 43 |
8824
054f9be0aaf9
HTTP/3: http3_max_uni_streams directive.
Roman Arutyunyan <arut@nginx.com>
parents:
8821
diff
changeset
|
44 h3scf = ngx_http_v3_get_module_srv_conf(c, ngx_http_v3_module); |
054f9be0aaf9
HTTP/3: http3_max_uni_streams directive.
Roman Arutyunyan <arut@nginx.com>
parents:
8821
diff
changeset
|
45 |
054f9be0aaf9
HTTP/3: http3_max_uni_streams directive.
Roman Arutyunyan <arut@nginx.com>
parents:
8821
diff
changeset
|
46 n = c->quic->id >> 2; |
054f9be0aaf9
HTTP/3: http3_max_uni_streams directive.
Roman Arutyunyan <arut@nginx.com>
parents:
8821
diff
changeset
|
47 |
054f9be0aaf9
HTTP/3: http3_max_uni_streams directive.
Roman Arutyunyan <arut@nginx.com>
parents:
8821
diff
changeset
|
48 if (n >= h3scf->max_uni_streams) { |
054f9be0aaf9
HTTP/3: http3_max_uni_streams directive.
Roman Arutyunyan <arut@nginx.com>
parents:
8821
diff
changeset
|
49 ngx_http_v3_finalize_connection(c, |
054f9be0aaf9
HTTP/3: http3_max_uni_streams directive.
Roman Arutyunyan <arut@nginx.com>
parents:
8821
diff
changeset
|
50 NGX_HTTP_V3_ERR_STREAM_CREATION_ERROR, |
054f9be0aaf9
HTTP/3: http3_max_uni_streams directive.
Roman Arutyunyan <arut@nginx.com>
parents:
8821
diff
changeset
|
51 "reached maximum number of uni streams"); |
054f9be0aaf9
HTTP/3: http3_max_uni_streams directive.
Roman Arutyunyan <arut@nginx.com>
parents:
8821
diff
changeset
|
52 ngx_http_close_connection(c); |
054f9be0aaf9
HTTP/3: http3_max_uni_streams directive.
Roman Arutyunyan <arut@nginx.com>
parents:
8821
diff
changeset
|
53 return; |
054f9be0aaf9
HTTP/3: http3_max_uni_streams directive.
Roman Arutyunyan <arut@nginx.com>
parents:
8821
diff
changeset
|
54 } |
054f9be0aaf9
HTTP/3: http3_max_uni_streams directive.
Roman Arutyunyan <arut@nginx.com>
parents:
8821
diff
changeset
|
55 |
8724
fc64ab301bad
QUIC: connection shutdown.
Roman Arutyunyan <arut@nginx.com>
parents:
8723
diff
changeset
|
56 c->quic->cancelable = 1; |
fc64ab301bad
QUIC: connection shutdown.
Roman Arutyunyan <arut@nginx.com>
parents:
8723
diff
changeset
|
57 |
8215 | 58 us = ngx_pcalloc(c->pool, sizeof(ngx_http_v3_uni_stream_t)); |
59 if (us == NULL) { | |
8679
e1eb7f4ca9f1
HTTP/3: refactored request parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8630
diff
changeset
|
60 ngx_http_close_connection(c); |
e1eb7f4ca9f1
HTTP/3: refactored request parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8630
diff
changeset
|
61 return; |
8215 | 62 } |
63 | |
8283
dadbc66e9fca
Simplifed handling HTTP/3 streams.
Roman Arutyunyan <arut@nginx.com>
parents:
8281
diff
changeset
|
64 us->index = -1; |
8215 | 65 |
66 c->data = us; | |
67 | |
8772
345370fdd32d
HTTP/3: moved parsing uni stream type to ngx_http_v3_parse.c.
Roman Arutyunyan <arut@nginx.com>
parents:
8771
diff
changeset
|
68 c->read->handler = ngx_http_v3_uni_read_handler; |
8281
618a65de08b3
When closing a QUIC connection, wait for all streams to finish.
Roman Arutyunyan <arut@nginx.com>
parents:
8228
diff
changeset
|
69 c->write->handler = ngx_http_v3_dummy_write_handler; |
618a65de08b3
When closing a QUIC connection, wait for all streams to finish.
Roman Arutyunyan <arut@nginx.com>
parents:
8228
diff
changeset
|
70 |
8772
345370fdd32d
HTTP/3: moved parsing uni stream type to ngx_http_v3_parse.c.
Roman Arutyunyan <arut@nginx.com>
parents:
8771
diff
changeset
|
71 ngx_http_v3_uni_read_handler(c->read); |
8215 | 72 } |
73 | |
74 | |
75 static void | |
76 ngx_http_v3_close_uni_stream(ngx_connection_t *c) | |
77 { | |
8283
dadbc66e9fca
Simplifed handling HTTP/3 streams.
Roman Arutyunyan <arut@nginx.com>
parents:
8281
diff
changeset
|
78 ngx_pool_t *pool; |
8770
67f0eb150047
HTTP/3: renamed ngx_http_v3_connection_t to ngx_http_v3_session_t.
Roman Arutyunyan <arut@nginx.com>
parents:
8769
diff
changeset
|
79 ngx_http_v3_session_t *h3c; |
8283
dadbc66e9fca
Simplifed handling HTTP/3 streams.
Roman Arutyunyan <arut@nginx.com>
parents:
8281
diff
changeset
|
80 ngx_http_v3_uni_stream_t *us; |
dadbc66e9fca
Simplifed handling HTTP/3 streams.
Roman Arutyunyan <arut@nginx.com>
parents:
8281
diff
changeset
|
81 |
dadbc66e9fca
Simplifed handling HTTP/3 streams.
Roman Arutyunyan <arut@nginx.com>
parents:
8281
diff
changeset
|
82 us = c->data; |
8768
40d710a66aef
HTTP/3: ngx_http_v3_get_session() macro.
Roman Arutyunyan <arut@nginx.com>
parents:
8767
diff
changeset
|
83 h3c = ngx_http_v3_get_session(c); |
8283
dadbc66e9fca
Simplifed handling HTTP/3 streams.
Roman Arutyunyan <arut@nginx.com>
parents:
8281
diff
changeset
|
84 |
dadbc66e9fca
Simplifed handling HTTP/3 streams.
Roman Arutyunyan <arut@nginx.com>
parents:
8281
diff
changeset
|
85 ngx_log_debug0(NGX_LOG_DEBUG_HTTP, c->log, 0, "http3 close stream"); |
dadbc66e9fca
Simplifed handling HTTP/3 streams.
Roman Arutyunyan <arut@nginx.com>
parents:
8281
diff
changeset
|
86 |
dadbc66e9fca
Simplifed handling HTTP/3 streams.
Roman Arutyunyan <arut@nginx.com>
parents:
8281
diff
changeset
|
87 if (us->index >= 0) { |
dadbc66e9fca
Simplifed handling HTTP/3 streams.
Roman Arutyunyan <arut@nginx.com>
parents:
8281
diff
changeset
|
88 h3c->known_streams[us->index] = NULL; |
dadbc66e9fca
Simplifed handling HTTP/3 streams.
Roman Arutyunyan <arut@nginx.com>
parents:
8281
diff
changeset
|
89 } |
8215 | 90 |
91 c->destroyed = 1; | |
92 | |
93 pool = c->pool; | |
94 | |
95 ngx_close_connection(c); | |
96 | |
97 ngx_destroy_pool(pool); | |
98 } | |
99 | |
100 | |
8772
345370fdd32d
HTTP/3: moved parsing uni stream type to ngx_http_v3_parse.c.
Roman Arutyunyan <arut@nginx.com>
parents:
8771
diff
changeset
|
101 ngx_int_t |
345370fdd32d
HTTP/3: moved parsing uni stream type to ngx_http_v3_parse.c.
Roman Arutyunyan <arut@nginx.com>
parents:
8771
diff
changeset
|
102 ngx_http_v3_register_uni_stream(ngx_connection_t *c, uint64_t type) |
8215 | 103 { |
8772
345370fdd32d
HTTP/3: moved parsing uni stream type to ngx_http_v3_parse.c.
Roman Arutyunyan <arut@nginx.com>
parents:
8771
diff
changeset
|
104 ngx_int_t index; |
8770
67f0eb150047
HTTP/3: renamed ngx_http_v3_connection_t to ngx_http_v3_session_t.
Roman Arutyunyan <arut@nginx.com>
parents:
8769
diff
changeset
|
105 ngx_http_v3_session_t *h3c; |
8283
dadbc66e9fca
Simplifed handling HTTP/3 streams.
Roman Arutyunyan <arut@nginx.com>
parents:
8281
diff
changeset
|
106 ngx_http_v3_uni_stream_t *us; |
8215 | 107 |
8821
d80365ca678d
HTTP/3: require mandatory uni streams before additional ones.
Roman Arutyunyan <arut@nginx.com>
parents:
8807
diff
changeset
|
108 h3c = ngx_http_v3_get_session(c); |
d80365ca678d
HTTP/3: require mandatory uni streams before additional ones.
Roman Arutyunyan <arut@nginx.com>
parents:
8807
diff
changeset
|
109 |
8772
345370fdd32d
HTTP/3: moved parsing uni stream type to ngx_http_v3_parse.c.
Roman Arutyunyan <arut@nginx.com>
parents:
8771
diff
changeset
|
110 switch (type) { |
345370fdd32d
HTTP/3: moved parsing uni stream type to ngx_http_v3_parse.c.
Roman Arutyunyan <arut@nginx.com>
parents:
8771
diff
changeset
|
111 |
345370fdd32d
HTTP/3: moved parsing uni stream type to ngx_http_v3_parse.c.
Roman Arutyunyan <arut@nginx.com>
parents:
8771
diff
changeset
|
112 case NGX_HTTP_V3_STREAM_ENCODER: |
345370fdd32d
HTTP/3: moved parsing uni stream type to ngx_http_v3_parse.c.
Roman Arutyunyan <arut@nginx.com>
parents:
8771
diff
changeset
|
113 |
345370fdd32d
HTTP/3: moved parsing uni stream type to ngx_http_v3_parse.c.
Roman Arutyunyan <arut@nginx.com>
parents:
8771
diff
changeset
|
114 ngx_log_debug0(NGX_LOG_DEBUG_HTTP, c->log, 0, |
345370fdd32d
HTTP/3: moved parsing uni stream type to ngx_http_v3_parse.c.
Roman Arutyunyan <arut@nginx.com>
parents:
8771
diff
changeset
|
115 "http3 encoder stream"); |
345370fdd32d
HTTP/3: moved parsing uni stream type to ngx_http_v3_parse.c.
Roman Arutyunyan <arut@nginx.com>
parents:
8771
diff
changeset
|
116 index = NGX_HTTP_V3_STREAM_CLIENT_ENCODER; |
345370fdd32d
HTTP/3: moved parsing uni stream type to ngx_http_v3_parse.c.
Roman Arutyunyan <arut@nginx.com>
parents:
8771
diff
changeset
|
117 break; |
8215 | 118 |
8772
345370fdd32d
HTTP/3: moved parsing uni stream type to ngx_http_v3_parse.c.
Roman Arutyunyan <arut@nginx.com>
parents:
8771
diff
changeset
|
119 case NGX_HTTP_V3_STREAM_DECODER: |
8215 | 120 |
8772
345370fdd32d
HTTP/3: moved parsing uni stream type to ngx_http_v3_parse.c.
Roman Arutyunyan <arut@nginx.com>
parents:
8771
diff
changeset
|
121 ngx_log_debug0(NGX_LOG_DEBUG_HTTP, c->log, 0, |
345370fdd32d
HTTP/3: moved parsing uni stream type to ngx_http_v3_parse.c.
Roman Arutyunyan <arut@nginx.com>
parents:
8771
diff
changeset
|
122 "http3 decoder stream"); |
345370fdd32d
HTTP/3: moved parsing uni stream type to ngx_http_v3_parse.c.
Roman Arutyunyan <arut@nginx.com>
parents:
8771
diff
changeset
|
123 index = NGX_HTTP_V3_STREAM_CLIENT_DECODER; |
345370fdd32d
HTTP/3: moved parsing uni stream type to ngx_http_v3_parse.c.
Roman Arutyunyan <arut@nginx.com>
parents:
8771
diff
changeset
|
124 break; |
8215 | 125 |
8772
345370fdd32d
HTTP/3: moved parsing uni stream type to ngx_http_v3_parse.c.
Roman Arutyunyan <arut@nginx.com>
parents:
8771
diff
changeset
|
126 case NGX_HTTP_V3_STREAM_CONTROL: |
8215 | 127 |
8772
345370fdd32d
HTTP/3: moved parsing uni stream type to ngx_http_v3_parse.c.
Roman Arutyunyan <arut@nginx.com>
parents:
8771
diff
changeset
|
128 ngx_log_debug0(NGX_LOG_DEBUG_HTTP, c->log, 0, |
345370fdd32d
HTTP/3: moved parsing uni stream type to ngx_http_v3_parse.c.
Roman Arutyunyan <arut@nginx.com>
parents:
8771
diff
changeset
|
129 "http3 control stream"); |
345370fdd32d
HTTP/3: moved parsing uni stream type to ngx_http_v3_parse.c.
Roman Arutyunyan <arut@nginx.com>
parents:
8771
diff
changeset
|
130 index = NGX_HTTP_V3_STREAM_CLIENT_CONTROL; |
345370fdd32d
HTTP/3: moved parsing uni stream type to ngx_http_v3_parse.c.
Roman Arutyunyan <arut@nginx.com>
parents:
8771
diff
changeset
|
131 |
345370fdd32d
HTTP/3: moved parsing uni stream type to ngx_http_v3_parse.c.
Roman Arutyunyan <arut@nginx.com>
parents:
8771
diff
changeset
|
132 break; |
345370fdd32d
HTTP/3: moved parsing uni stream type to ngx_http_v3_parse.c.
Roman Arutyunyan <arut@nginx.com>
parents:
8771
diff
changeset
|
133 |
345370fdd32d
HTTP/3: moved parsing uni stream type to ngx_http_v3_parse.c.
Roman Arutyunyan <arut@nginx.com>
parents:
8771
diff
changeset
|
134 default: |
8460
72f9ff4e0a88
HTTP/3: close QUIC connection with HTTP/QPACK errors when needed.
Roman Arutyunyan <arut@nginx.com>
parents:
8456
diff
changeset
|
135 |
8772
345370fdd32d
HTTP/3: moved parsing uni stream type to ngx_http_v3_parse.c.
Roman Arutyunyan <arut@nginx.com>
parents:
8771
diff
changeset
|
136 ngx_log_debug1(NGX_LOG_DEBUG_HTTP, c->log, 0, |
345370fdd32d
HTTP/3: moved parsing uni stream type to ngx_http_v3_parse.c.
Roman Arutyunyan <arut@nginx.com>
parents:
8771
diff
changeset
|
137 "http3 stream 0x%02xL", type); |
8821
d80365ca678d
HTTP/3: require mandatory uni streams before additional ones.
Roman Arutyunyan <arut@nginx.com>
parents:
8807
diff
changeset
|
138 |
d80365ca678d
HTTP/3: require mandatory uni streams before additional ones.
Roman Arutyunyan <arut@nginx.com>
parents:
8807
diff
changeset
|
139 if (h3c->known_streams[NGX_HTTP_V3_STREAM_CLIENT_ENCODER] == NULL |
d80365ca678d
HTTP/3: require mandatory uni streams before additional ones.
Roman Arutyunyan <arut@nginx.com>
parents:
8807
diff
changeset
|
140 || h3c->known_streams[NGX_HTTP_V3_STREAM_CLIENT_DECODER] == NULL |
d80365ca678d
HTTP/3: require mandatory uni streams before additional ones.
Roman Arutyunyan <arut@nginx.com>
parents:
8807
diff
changeset
|
141 || h3c->known_streams[NGX_HTTP_V3_STREAM_CLIENT_CONTROL] == NULL) |
d80365ca678d
HTTP/3: require mandatory uni streams before additional ones.
Roman Arutyunyan <arut@nginx.com>
parents:
8807
diff
changeset
|
142 { |
d80365ca678d
HTTP/3: require mandatory uni streams before additional ones.
Roman Arutyunyan <arut@nginx.com>
parents:
8807
diff
changeset
|
143 ngx_log_error(NGX_LOG_INFO, c->log, 0, "missing mandatory stream"); |
d80365ca678d
HTTP/3: require mandatory uni streams before additional ones.
Roman Arutyunyan <arut@nginx.com>
parents:
8807
diff
changeset
|
144 return NGX_HTTP_V3_ERR_STREAM_CREATION_ERROR; |
d80365ca678d
HTTP/3: require mandatory uni streams before additional ones.
Roman Arutyunyan <arut@nginx.com>
parents:
8807
diff
changeset
|
145 } |
d80365ca678d
HTTP/3: require mandatory uni streams before additional ones.
Roman Arutyunyan <arut@nginx.com>
parents:
8807
diff
changeset
|
146 |
8772
345370fdd32d
HTTP/3: moved parsing uni stream type to ngx_http_v3_parse.c.
Roman Arutyunyan <arut@nginx.com>
parents:
8771
diff
changeset
|
147 index = -1; |
345370fdd32d
HTTP/3: moved parsing uni stream type to ngx_http_v3_parse.c.
Roman Arutyunyan <arut@nginx.com>
parents:
8771
diff
changeset
|
148 } |
8215 | 149 |
8772
345370fdd32d
HTTP/3: moved parsing uni stream type to ngx_http_v3_parse.c.
Roman Arutyunyan <arut@nginx.com>
parents:
8771
diff
changeset
|
150 if (index >= 0) { |
345370fdd32d
HTTP/3: moved parsing uni stream type to ngx_http_v3_parse.c.
Roman Arutyunyan <arut@nginx.com>
parents:
8771
diff
changeset
|
151 if (h3c->known_streams[index]) { |
345370fdd32d
HTTP/3: moved parsing uni stream type to ngx_http_v3_parse.c.
Roman Arutyunyan <arut@nginx.com>
parents:
8771
diff
changeset
|
152 ngx_log_error(NGX_LOG_INFO, c->log, 0, "stream exists"); |
345370fdd32d
HTTP/3: moved parsing uni stream type to ngx_http_v3_parse.c.
Roman Arutyunyan <arut@nginx.com>
parents:
8771
diff
changeset
|
153 return NGX_HTTP_V3_ERR_STREAM_CREATION_ERROR; |
8215 | 154 } |
155 | |
8772
345370fdd32d
HTTP/3: moved parsing uni stream type to ngx_http_v3_parse.c.
Roman Arutyunyan <arut@nginx.com>
parents:
8771
diff
changeset
|
156 h3c->known_streams[index] = c; |
8226
268f4389130d
Refactored HTTP/3 parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8215
diff
changeset
|
157 |
8772
345370fdd32d
HTTP/3: moved parsing uni stream type to ngx_http_v3_parse.c.
Roman Arutyunyan <arut@nginx.com>
parents:
8771
diff
changeset
|
158 us = c->data; |
345370fdd32d
HTTP/3: moved parsing uni stream type to ngx_http_v3_parse.c.
Roman Arutyunyan <arut@nginx.com>
parents:
8771
diff
changeset
|
159 us->index = index; |
8215 | 160 } |
161 | |
8772
345370fdd32d
HTTP/3: moved parsing uni stream type to ngx_http_v3_parse.c.
Roman Arutyunyan <arut@nginx.com>
parents:
8771
diff
changeset
|
162 return NGX_OK; |
8215 | 163 } |
164 | |
165 | |
166 static void | |
8226
268f4389130d
Refactored HTTP/3 parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8215
diff
changeset
|
167 ngx_http_v3_uni_read_handler(ngx_event_t *rev) |
8215 | 168 { |
8226
268f4389130d
Refactored HTTP/3 parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8215
diff
changeset
|
169 u_char buf[128]; |
8215 | 170 ssize_t n; |
8838
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8824
diff
changeset
|
171 ngx_buf_t b; |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8824
diff
changeset
|
172 ngx_int_t rc; |
8226
268f4389130d
Refactored HTTP/3 parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8215
diff
changeset
|
173 ngx_connection_t *c; |
8881
72b304f6207c
HTTP/3: traffic-based flood detection.
Roman Arutyunyan <arut@nginx.com>
parents:
8879
diff
changeset
|
174 ngx_http_v3_session_t *h3c; |
8283
dadbc66e9fca
Simplifed handling HTTP/3 streams.
Roman Arutyunyan <arut@nginx.com>
parents:
8281
diff
changeset
|
175 ngx_http_v3_uni_stream_t *us; |
8215 | 176 |
177 c = rev->data; | |
8283
dadbc66e9fca
Simplifed handling HTTP/3 streams.
Roman Arutyunyan <arut@nginx.com>
parents:
8281
diff
changeset
|
178 us = c->data; |
8215 | 179 |
8226
268f4389130d
Refactored HTTP/3 parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8215
diff
changeset
|
180 ngx_log_debug0(NGX_LOG_DEBUG_HTTP, c->log, 0, "http3 read handler"); |
8215 | 181 |
8838
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8824
diff
changeset
|
182 ngx_memzero(&b, sizeof(ngx_buf_t)); |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8824
diff
changeset
|
183 |
8215 | 184 while (rev->ready) { |
185 | |
8226
268f4389130d
Refactored HTTP/3 parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8215
diff
changeset
|
186 n = c->recv(c, buf, sizeof(buf)); |
8215 | 187 |
8460
72f9ff4e0a88
HTTP/3: close QUIC connection with HTTP/QPACK errors when needed.
Roman Arutyunyan <arut@nginx.com>
parents:
8456
diff
changeset
|
188 if (n == NGX_ERROR) { |
72f9ff4e0a88
HTTP/3: close QUIC connection with HTTP/QPACK errors when needed.
Roman Arutyunyan <arut@nginx.com>
parents:
8456
diff
changeset
|
189 rc = NGX_HTTP_V3_ERR_INTERNAL_ERROR; |
8215 | 190 goto failed; |
191 } | |
192 | |
8460
72f9ff4e0a88
HTTP/3: close QUIC connection with HTTP/QPACK errors when needed.
Roman Arutyunyan <arut@nginx.com>
parents:
8456
diff
changeset
|
193 if (n == 0) { |
72f9ff4e0a88
HTTP/3: close QUIC connection with HTTP/QPACK errors when needed.
Roman Arutyunyan <arut@nginx.com>
parents:
8456
diff
changeset
|
194 if (us->index >= 0) { |
72f9ff4e0a88
HTTP/3: close QUIC connection with HTTP/QPACK errors when needed.
Roman Arutyunyan <arut@nginx.com>
parents:
8456
diff
changeset
|
195 rc = NGX_HTTP_V3_ERR_CLOSED_CRITICAL_STREAM; |
72f9ff4e0a88
HTTP/3: close QUIC connection with HTTP/QPACK errors when needed.
Roman Arutyunyan <arut@nginx.com>
parents:
8456
diff
changeset
|
196 goto failed; |
72f9ff4e0a88
HTTP/3: close QUIC connection with HTTP/QPACK errors when needed.
Roman Arutyunyan <arut@nginx.com>
parents:
8456
diff
changeset
|
197 } |
72f9ff4e0a88
HTTP/3: close QUIC connection with HTTP/QPACK errors when needed.
Roman Arutyunyan <arut@nginx.com>
parents:
8456
diff
changeset
|
198 |
72f9ff4e0a88
HTTP/3: close QUIC connection with HTTP/QPACK errors when needed.
Roman Arutyunyan <arut@nginx.com>
parents:
8456
diff
changeset
|
199 ngx_log_debug0(NGX_LOG_DEBUG_HTTP, c->log, 0, "http3 read eof"); |
72f9ff4e0a88
HTTP/3: close QUIC connection with HTTP/QPACK errors when needed.
Roman Arutyunyan <arut@nginx.com>
parents:
8456
diff
changeset
|
200 ngx_http_v3_close_uni_stream(c); |
72f9ff4e0a88
HTTP/3: close QUIC connection with HTTP/QPACK errors when needed.
Roman Arutyunyan <arut@nginx.com>
parents:
8456
diff
changeset
|
201 return; |
72f9ff4e0a88
HTTP/3: close QUIC connection with HTTP/QPACK errors when needed.
Roman Arutyunyan <arut@nginx.com>
parents:
8456
diff
changeset
|
202 } |
72f9ff4e0a88
HTTP/3: close QUIC connection with HTTP/QPACK errors when needed.
Roman Arutyunyan <arut@nginx.com>
parents:
8456
diff
changeset
|
203 |
8226
268f4389130d
Refactored HTTP/3 parser.
Roman Arutyunyan <arut@nginx.com>
parents:
8215
diff
changeset
|
204 if (n == NGX_AGAIN) { |
8215 | 205 break; |
206 } | |
207 | |
8838
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8824
diff
changeset
|
208 b.pos = buf; |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8824
diff
changeset
|
209 b.last = buf + n; |
8215 | 210 |
8881
72b304f6207c
HTTP/3: traffic-based flood detection.
Roman Arutyunyan <arut@nginx.com>
parents:
8879
diff
changeset
|
211 h3c = ngx_http_v3_get_session(c); |
72b304f6207c
HTTP/3: traffic-based flood detection.
Roman Arutyunyan <arut@nginx.com>
parents:
8879
diff
changeset
|
212 h3c->total_bytes += n; |
72b304f6207c
HTTP/3: traffic-based flood detection.
Roman Arutyunyan <arut@nginx.com>
parents:
8879
diff
changeset
|
213 |
72b304f6207c
HTTP/3: traffic-based flood detection.
Roman Arutyunyan <arut@nginx.com>
parents:
8879
diff
changeset
|
214 if (ngx_http_v3_check_flood(c) != NGX_OK) { |
72b304f6207c
HTTP/3: traffic-based flood detection.
Roman Arutyunyan <arut@nginx.com>
parents:
8879
diff
changeset
|
215 ngx_http_v3_close_uni_stream(c); |
72b304f6207c
HTTP/3: traffic-based flood detection.
Roman Arutyunyan <arut@nginx.com>
parents:
8879
diff
changeset
|
216 return; |
72b304f6207c
HTTP/3: traffic-based flood detection.
Roman Arutyunyan <arut@nginx.com>
parents:
8879
diff
changeset
|
217 } |
72b304f6207c
HTTP/3: traffic-based flood detection.
Roman Arutyunyan <arut@nginx.com>
parents:
8879
diff
changeset
|
218 |
8838
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8824
diff
changeset
|
219 rc = ngx_http_v3_parse_uni(c, &us->parse, &b); |
8215 | 220 |
8838
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8824
diff
changeset
|
221 if (rc == NGX_DONE) { |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8824
diff
changeset
|
222 ngx_log_debug0(NGX_LOG_DEBUG_HTTP, c->log, 0, |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8824
diff
changeset
|
223 "http3 read done"); |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8824
diff
changeset
|
224 ngx_http_v3_close_uni_stream(c); |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8824
diff
changeset
|
225 return; |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8824
diff
changeset
|
226 } |
8460
72f9ff4e0a88
HTTP/3: close QUIC connection with HTTP/QPACK errors when needed.
Roman Arutyunyan <arut@nginx.com>
parents:
8456
diff
changeset
|
227 |
8838
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8824
diff
changeset
|
228 if (rc > 0) { |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8824
diff
changeset
|
229 goto failed; |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8824
diff
changeset
|
230 } |
8215 | 231 |
8838
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8824
diff
changeset
|
232 if (rc != NGX_AGAIN) { |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8824
diff
changeset
|
233 rc = NGX_HTTP_V3_ERR_GENERAL_PROTOCOL_ERROR; |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8824
diff
changeset
|
234 goto failed; |
8215 | 235 } |
236 } | |
237 | |
238 if (ngx_handle_read_event(rev, 0) != NGX_OK) { | |
8460
72f9ff4e0a88
HTTP/3: close QUIC connection with HTTP/QPACK errors when needed.
Roman Arutyunyan <arut@nginx.com>
parents:
8456
diff
changeset
|
239 rc = NGX_HTTP_V3_ERR_INTERNAL_ERROR; |
8215 | 240 goto failed; |
241 } | |
242 | |
243 return; | |
244 | |
245 failed: | |
246 | |
8460
72f9ff4e0a88
HTTP/3: close QUIC connection with HTTP/QPACK errors when needed.
Roman Arutyunyan <arut@nginx.com>
parents:
8456
diff
changeset
|
247 ngx_http_v3_finalize_connection(c, rc, "stream error"); |
8215 | 248 ngx_http_v3_close_uni_stream(c); |
249 } | |
250 | |
251 | |
8281
618a65de08b3
When closing a QUIC connection, wait for all streams to finish.
Roman Arutyunyan <arut@nginx.com>
parents:
8228
diff
changeset
|
252 static void |
618a65de08b3
When closing a QUIC connection, wait for all streams to finish.
Roman Arutyunyan <arut@nginx.com>
parents:
8228
diff
changeset
|
253 ngx_http_v3_dummy_write_handler(ngx_event_t *wev) |
618a65de08b3
When closing a QUIC connection, wait for all streams to finish.
Roman Arutyunyan <arut@nginx.com>
parents:
8228
diff
changeset
|
254 { |
618a65de08b3
When closing a QUIC connection, wait for all streams to finish.
Roman Arutyunyan <arut@nginx.com>
parents:
8228
diff
changeset
|
255 ngx_connection_t *c; |
618a65de08b3
When closing a QUIC connection, wait for all streams to finish.
Roman Arutyunyan <arut@nginx.com>
parents:
8228
diff
changeset
|
256 |
618a65de08b3
When closing a QUIC connection, wait for all streams to finish.
Roman Arutyunyan <arut@nginx.com>
parents:
8228
diff
changeset
|
257 c = wev->data; |
618a65de08b3
When closing a QUIC connection, wait for all streams to finish.
Roman Arutyunyan <arut@nginx.com>
parents:
8228
diff
changeset
|
258 |
618a65de08b3
When closing a QUIC connection, wait for all streams to finish.
Roman Arutyunyan <arut@nginx.com>
parents:
8228
diff
changeset
|
259 ngx_log_debug0(NGX_LOG_DEBUG_HTTP, c->log, 0, "http3 dummy write handler"); |
618a65de08b3
When closing a QUIC connection, wait for all streams to finish.
Roman Arutyunyan <arut@nginx.com>
parents:
8228
diff
changeset
|
260 |
618a65de08b3
When closing a QUIC connection, wait for all streams to finish.
Roman Arutyunyan <arut@nginx.com>
parents:
8228
diff
changeset
|
261 if (ngx_handle_write_event(wev, 0) != NGX_OK) { |
8460
72f9ff4e0a88
HTTP/3: close QUIC connection with HTTP/QPACK errors when needed.
Roman Arutyunyan <arut@nginx.com>
parents:
8456
diff
changeset
|
262 ngx_http_v3_finalize_connection(c, NGX_HTTP_V3_ERR_INTERNAL_ERROR, |
72f9ff4e0a88
HTTP/3: close QUIC connection with HTTP/QPACK errors when needed.
Roman Arutyunyan <arut@nginx.com>
parents:
8456
diff
changeset
|
263 NULL); |
8281
618a65de08b3
When closing a QUIC connection, wait for all streams to finish.
Roman Arutyunyan <arut@nginx.com>
parents:
8228
diff
changeset
|
264 ngx_http_v3_close_uni_stream(c); |
618a65de08b3
When closing a QUIC connection, wait for all streams to finish.
Roman Arutyunyan <arut@nginx.com>
parents:
8228
diff
changeset
|
265 } |
618a65de08b3
When closing a QUIC connection, wait for all streams to finish.
Roman Arutyunyan <arut@nginx.com>
parents:
8228
diff
changeset
|
266 } |
618a65de08b3
When closing a QUIC connection, wait for all streams to finish.
Roman Arutyunyan <arut@nginx.com>
parents:
8228
diff
changeset
|
267 |
618a65de08b3
When closing a QUIC connection, wait for all streams to finish.
Roman Arutyunyan <arut@nginx.com>
parents:
8228
diff
changeset
|
268 |
8215 | 269 /* XXX async & buffered stream writes */ |
270 | |
8497 | 271 ngx_connection_t * |
272 ngx_http_v3_create_push_stream(ngx_connection_t *c, uint64_t push_id) | |
273 { | |
8770
67f0eb150047
HTTP/3: renamed ngx_http_v3_connection_t to ngx_http_v3_session_t.
Roman Arutyunyan <arut@nginx.com>
parents:
8769
diff
changeset
|
274 u_char *p, buf[NGX_HTTP_V3_VARLEN_INT_LEN * 2]; |
67f0eb150047
HTTP/3: renamed ngx_http_v3_connection_t to ngx_http_v3_session_t.
Roman Arutyunyan <arut@nginx.com>
parents:
8769
diff
changeset
|
275 size_t n; |
67f0eb150047
HTTP/3: renamed ngx_http_v3_connection_t to ngx_http_v3_session_t.
Roman Arutyunyan <arut@nginx.com>
parents:
8769
diff
changeset
|
276 ngx_connection_t *sc; |
67f0eb150047
HTTP/3: renamed ngx_http_v3_connection_t to ngx_http_v3_session_t.
Roman Arutyunyan <arut@nginx.com>
parents:
8769
diff
changeset
|
277 ngx_pool_cleanup_t *cln; |
67f0eb150047
HTTP/3: renamed ngx_http_v3_connection_t to ngx_http_v3_session_t.
Roman Arutyunyan <arut@nginx.com>
parents:
8769
diff
changeset
|
278 ngx_http_v3_push_t *push; |
67f0eb150047
HTTP/3: renamed ngx_http_v3_connection_t to ngx_http_v3_session_t.
Roman Arutyunyan <arut@nginx.com>
parents:
8769
diff
changeset
|
279 ngx_http_v3_session_t *h3c; |
8497 | 280 |
281 ngx_log_debug1(NGX_LOG_DEBUG_HTTP, c->log, 0, | |
282 "http3 create push stream id:%uL", push_id); | |
283 | |
284 sc = ngx_quic_open_stream(c, 0); | |
285 if (sc == NULL) { | |
8902
925572184d4a
HTTP/3: adjusted QUIC connection finalization.
Roman Arutyunyan <arut@nginx.com>
parents:
8881
diff
changeset
|
286 goto failed; |
8497 | 287 } |
288 | |
289 p = buf; | |
290 p = (u_char *) ngx_http_v3_encode_varlen_int(p, NGX_HTTP_V3_STREAM_PUSH); | |
291 p = (u_char *) ngx_http_v3_encode_varlen_int(p, push_id); | |
292 n = p - buf; | |
293 | |
8881
72b304f6207c
HTTP/3: traffic-based flood detection.
Roman Arutyunyan <arut@nginx.com>
parents:
8879
diff
changeset
|
294 h3c = ngx_http_v3_get_session(c); |
72b304f6207c
HTTP/3: traffic-based flood detection.
Roman Arutyunyan <arut@nginx.com>
parents:
8879
diff
changeset
|
295 h3c->total_bytes += n; |
72b304f6207c
HTTP/3: traffic-based flood detection.
Roman Arutyunyan <arut@nginx.com>
parents:
8879
diff
changeset
|
296 |
8497 | 297 if (sc->send(sc, buf, n) != (ssize_t) n) { |
298 goto failed; | |
299 } | |
300 | |
301 cln = ngx_pool_cleanup_add(sc->pool, sizeof(ngx_http_v3_push_t)); | |
302 if (cln == NULL) { | |
303 goto failed; | |
304 } | |
305 | |
306 h3c->npushing++; | |
307 | |
308 cln->handler = ngx_http_v3_push_cleanup; | |
309 | |
310 push = cln->data; | |
311 push->id = push_id; | |
312 push->connection = sc; | |
313 push->npushing = &h3c->npushing; | |
314 | |
315 ngx_queue_insert_tail(&h3c->pushing, &push->queue); | |
316 | |
317 return sc; | |
318 | |
319 failed: | |
320 | |
8902
925572184d4a
HTTP/3: adjusted QUIC connection finalization.
Roman Arutyunyan <arut@nginx.com>
parents:
8881
diff
changeset
|
321 ngx_log_error(NGX_LOG_ERR, c->log, 0, "failed to create push stream"); |
925572184d4a
HTTP/3: adjusted QUIC connection finalization.
Roman Arutyunyan <arut@nginx.com>
parents:
8881
diff
changeset
|
322 |
925572184d4a
HTTP/3: adjusted QUIC connection finalization.
Roman Arutyunyan <arut@nginx.com>
parents:
8881
diff
changeset
|
323 ngx_http_v3_finalize_connection(c, NGX_HTTP_V3_ERR_STREAM_CREATION_ERROR, |
925572184d4a
HTTP/3: adjusted QUIC connection finalization.
Roman Arutyunyan <arut@nginx.com>
parents:
8881
diff
changeset
|
324 "failed to create push stream"); |
925572184d4a
HTTP/3: adjusted QUIC connection finalization.
Roman Arutyunyan <arut@nginx.com>
parents:
8881
diff
changeset
|
325 if (sc) { |
925572184d4a
HTTP/3: adjusted QUIC connection finalization.
Roman Arutyunyan <arut@nginx.com>
parents:
8881
diff
changeset
|
326 ngx_http_v3_close_uni_stream(sc); |
925572184d4a
HTTP/3: adjusted QUIC connection finalization.
Roman Arutyunyan <arut@nginx.com>
parents:
8881
diff
changeset
|
327 } |
8497 | 328 |
329 return NULL; | |
330 } | |
331 | |
332 | |
333 static void | |
334 ngx_http_v3_push_cleanup(void *data) | |
335 { | |
336 ngx_http_v3_push_t *push = data; | |
337 | |
338 ngx_queue_remove(&push->queue); | |
339 (*push->npushing)--; | |
340 } | |
341 | |
342 | |
8215 | 343 static ngx_connection_t * |
8283
dadbc66e9fca
Simplifed handling HTTP/3 streams.
Roman Arutyunyan <arut@nginx.com>
parents:
8281
diff
changeset
|
344 ngx_http_v3_get_uni_stream(ngx_connection_t *c, ngx_uint_t type) |
8215 | 345 { |
346 u_char buf[NGX_HTTP_V3_VARLEN_INT_LEN]; | |
347 size_t n; | |
8283
dadbc66e9fca
Simplifed handling HTTP/3 streams.
Roman Arutyunyan <arut@nginx.com>
parents:
8281
diff
changeset
|
348 ngx_int_t index; |
8215 | 349 ngx_connection_t *sc; |
8770
67f0eb150047
HTTP/3: renamed ngx_http_v3_connection_t to ngx_http_v3_session_t.
Roman Arutyunyan <arut@nginx.com>
parents:
8769
diff
changeset
|
350 ngx_http_v3_session_t *h3c; |
8215 | 351 ngx_http_v3_uni_stream_t *us; |
352 | |
8283
dadbc66e9fca
Simplifed handling HTTP/3 streams.
Roman Arutyunyan <arut@nginx.com>
parents:
8281
diff
changeset
|
353 switch (type) { |
dadbc66e9fca
Simplifed handling HTTP/3 streams.
Roman Arutyunyan <arut@nginx.com>
parents:
8281
diff
changeset
|
354 case NGX_HTTP_V3_STREAM_ENCODER: |
dadbc66e9fca
Simplifed handling HTTP/3 streams.
Roman Arutyunyan <arut@nginx.com>
parents:
8281
diff
changeset
|
355 index = NGX_HTTP_V3_STREAM_SERVER_ENCODER; |
dadbc66e9fca
Simplifed handling HTTP/3 streams.
Roman Arutyunyan <arut@nginx.com>
parents:
8281
diff
changeset
|
356 break; |
dadbc66e9fca
Simplifed handling HTTP/3 streams.
Roman Arutyunyan <arut@nginx.com>
parents:
8281
diff
changeset
|
357 case NGX_HTTP_V3_STREAM_DECODER: |
dadbc66e9fca
Simplifed handling HTTP/3 streams.
Roman Arutyunyan <arut@nginx.com>
parents:
8281
diff
changeset
|
358 index = NGX_HTTP_V3_STREAM_SERVER_DECODER; |
dadbc66e9fca
Simplifed handling HTTP/3 streams.
Roman Arutyunyan <arut@nginx.com>
parents:
8281
diff
changeset
|
359 break; |
dadbc66e9fca
Simplifed handling HTTP/3 streams.
Roman Arutyunyan <arut@nginx.com>
parents:
8281
diff
changeset
|
360 case NGX_HTTP_V3_STREAM_CONTROL: |
dadbc66e9fca
Simplifed handling HTTP/3 streams.
Roman Arutyunyan <arut@nginx.com>
parents:
8281
diff
changeset
|
361 index = NGX_HTTP_V3_STREAM_SERVER_CONTROL; |
dadbc66e9fca
Simplifed handling HTTP/3 streams.
Roman Arutyunyan <arut@nginx.com>
parents:
8281
diff
changeset
|
362 break; |
dadbc66e9fca
Simplifed handling HTTP/3 streams.
Roman Arutyunyan <arut@nginx.com>
parents:
8281
diff
changeset
|
363 default: |
dadbc66e9fca
Simplifed handling HTTP/3 streams.
Roman Arutyunyan <arut@nginx.com>
parents:
8281
diff
changeset
|
364 index = -1; |
dadbc66e9fca
Simplifed handling HTTP/3 streams.
Roman Arutyunyan <arut@nginx.com>
parents:
8281
diff
changeset
|
365 } |
dadbc66e9fca
Simplifed handling HTTP/3 streams.
Roman Arutyunyan <arut@nginx.com>
parents:
8281
diff
changeset
|
366 |
8768
40d710a66aef
HTTP/3: ngx_http_v3_get_session() macro.
Roman Arutyunyan <arut@nginx.com>
parents:
8767
diff
changeset
|
367 h3c = ngx_http_v3_get_session(c); |
8283
dadbc66e9fca
Simplifed handling HTTP/3 streams.
Roman Arutyunyan <arut@nginx.com>
parents:
8281
diff
changeset
|
368 |
dadbc66e9fca
Simplifed handling HTTP/3 streams.
Roman Arutyunyan <arut@nginx.com>
parents:
8281
diff
changeset
|
369 if (index >= 0) { |
dadbc66e9fca
Simplifed handling HTTP/3 streams.
Roman Arutyunyan <arut@nginx.com>
parents:
8281
diff
changeset
|
370 if (h3c->known_streams[index]) { |
dadbc66e9fca
Simplifed handling HTTP/3 streams.
Roman Arutyunyan <arut@nginx.com>
parents:
8281
diff
changeset
|
371 return h3c->known_streams[index]; |
dadbc66e9fca
Simplifed handling HTTP/3 streams.
Roman Arutyunyan <arut@nginx.com>
parents:
8281
diff
changeset
|
372 } |
dadbc66e9fca
Simplifed handling HTTP/3 streams.
Roman Arutyunyan <arut@nginx.com>
parents:
8281
diff
changeset
|
373 } |
dadbc66e9fca
Simplifed handling HTTP/3 streams.
Roman Arutyunyan <arut@nginx.com>
parents:
8281
diff
changeset
|
374 |
8495
455a8536eaa7
QUIC: limited the number of server-initiated streams.
Roman Arutyunyan <arut@nginx.com>
parents:
8492
diff
changeset
|
375 sc = ngx_quic_open_stream(c, 0); |
8215 | 376 if (sc == NULL) { |
8902
925572184d4a
HTTP/3: adjusted QUIC connection finalization.
Roman Arutyunyan <arut@nginx.com>
parents:
8881
diff
changeset
|
377 goto failed; |
8215 | 378 } |
379 | |
8724
fc64ab301bad
QUIC: connection shutdown.
Roman Arutyunyan <arut@nginx.com>
parents:
8723
diff
changeset
|
380 sc->quic->cancelable = 1; |
fc64ab301bad
QUIC: connection shutdown.
Roman Arutyunyan <arut@nginx.com>
parents:
8723
diff
changeset
|
381 |
8215 | 382 ngx_log_debug1(NGX_LOG_DEBUG_HTTP, c->log, 0, |
383 "http3 create uni stream, type:%ui", type); | |
384 | |
385 us = ngx_pcalloc(sc->pool, sizeof(ngx_http_v3_uni_stream_t)); | |
386 if (us == NULL) { | |
387 goto failed; | |
388 } | |
389 | |
8283
dadbc66e9fca
Simplifed handling HTTP/3 streams.
Roman Arutyunyan <arut@nginx.com>
parents:
8281
diff
changeset
|
390 us->index = index; |
dadbc66e9fca
Simplifed handling HTTP/3 streams.
Roman Arutyunyan <arut@nginx.com>
parents:
8281
diff
changeset
|
391 |
8215 | 392 sc->data = us; |
393 | |
8281
618a65de08b3
When closing a QUIC connection, wait for all streams to finish.
Roman Arutyunyan <arut@nginx.com>
parents:
8228
diff
changeset
|
394 sc->read->handler = ngx_http_v3_uni_read_handler; |
618a65de08b3
When closing a QUIC connection, wait for all streams to finish.
Roman Arutyunyan <arut@nginx.com>
parents:
8228
diff
changeset
|
395 sc->write->handler = ngx_http_v3_dummy_write_handler; |
618a65de08b3
When closing a QUIC connection, wait for all streams to finish.
Roman Arutyunyan <arut@nginx.com>
parents:
8228
diff
changeset
|
396 |
8403
c101438c69a4
HTTP/3: prevent array access by negative index for unknown streams.
Roman Arutyunyan <arut@nginx.com>
parents:
8362
diff
changeset
|
397 if (index >= 0) { |
c101438c69a4
HTTP/3: prevent array access by negative index for unknown streams.
Roman Arutyunyan <arut@nginx.com>
parents:
8362
diff
changeset
|
398 h3c->known_streams[index] = sc; |
c101438c69a4
HTTP/3: prevent array access by negative index for unknown streams.
Roman Arutyunyan <arut@nginx.com>
parents:
8362
diff
changeset
|
399 } |
8215 | 400 |
401 n = (u_char *) ngx_http_v3_encode_varlen_int(buf, type) - buf; | |
402 | |
8881
72b304f6207c
HTTP/3: traffic-based flood detection.
Roman Arutyunyan <arut@nginx.com>
parents:
8879
diff
changeset
|
403 h3c = ngx_http_v3_get_session(c); |
72b304f6207c
HTTP/3: traffic-based flood detection.
Roman Arutyunyan <arut@nginx.com>
parents:
8879
diff
changeset
|
404 h3c->total_bytes += n; |
72b304f6207c
HTTP/3: traffic-based flood detection.
Roman Arutyunyan <arut@nginx.com>
parents:
8879
diff
changeset
|
405 |
8215 | 406 if (sc->send(sc, buf, n) != (ssize_t) n) { |
407 goto failed; | |
408 } | |
409 | |
410 return sc; | |
411 | |
412 failed: | |
413 | |
8902
925572184d4a
HTTP/3: adjusted QUIC connection finalization.
Roman Arutyunyan <arut@nginx.com>
parents:
8881
diff
changeset
|
414 ngx_log_error(NGX_LOG_ERR, c->log, 0, "failed to create server stream"); |
925572184d4a
HTTP/3: adjusted QUIC connection finalization.
Roman Arutyunyan <arut@nginx.com>
parents:
8881
diff
changeset
|
415 |
925572184d4a
HTTP/3: adjusted QUIC connection finalization.
Roman Arutyunyan <arut@nginx.com>
parents:
8881
diff
changeset
|
416 ngx_http_v3_finalize_connection(c, NGX_HTTP_V3_ERR_STREAM_CREATION_ERROR, |
925572184d4a
HTTP/3: adjusted QUIC connection finalization.
Roman Arutyunyan <arut@nginx.com>
parents:
8881
diff
changeset
|
417 "failed to create server stream"); |
925572184d4a
HTTP/3: adjusted QUIC connection finalization.
Roman Arutyunyan <arut@nginx.com>
parents:
8881
diff
changeset
|
418 if (sc) { |
925572184d4a
HTTP/3: adjusted QUIC connection finalization.
Roman Arutyunyan <arut@nginx.com>
parents:
8881
diff
changeset
|
419 ngx_http_v3_close_uni_stream(sc); |
925572184d4a
HTTP/3: adjusted QUIC connection finalization.
Roman Arutyunyan <arut@nginx.com>
parents:
8881
diff
changeset
|
420 } |
8215 | 421 |
422 return NULL; | |
423 } | |
424 | |
425 | |
8774
f4d3f5d93a82
HTTP/3: moved session initialization to a separate file.
Roman Arutyunyan <arut@nginx.com>
parents:
8772
diff
changeset
|
426 ngx_int_t |
8456
c9538aef3211
HTTP/3: refactored dynamic table implementation.
Roman Arutyunyan <arut@nginx.com>
parents:
8403
diff
changeset
|
427 ngx_http_v3_send_settings(ngx_connection_t *c) |
c9538aef3211
HTTP/3: refactored dynamic table implementation.
Roman Arutyunyan <arut@nginx.com>
parents:
8403
diff
changeset
|
428 { |
8769
9ec3e71f8a61
HTTP/3: reference h3c directly from ngx_http_connection_t.
Roman Arutyunyan <arut@nginx.com>
parents:
8768
diff
changeset
|
429 u_char *p, buf[NGX_HTTP_V3_VARLEN_INT_LEN * 6]; |
9ec3e71f8a61
HTTP/3: reference h3c directly from ngx_http_connection_t.
Roman Arutyunyan <arut@nginx.com>
parents:
8768
diff
changeset
|
430 size_t n; |
9ec3e71f8a61
HTTP/3: reference h3c directly from ngx_http_connection_t.
Roman Arutyunyan <arut@nginx.com>
parents:
8768
diff
changeset
|
431 ngx_connection_t *cc; |
8881
72b304f6207c
HTTP/3: traffic-based flood detection.
Roman Arutyunyan <arut@nginx.com>
parents:
8879
diff
changeset
|
432 ngx_http_v3_session_t *h3c; |
8769
9ec3e71f8a61
HTTP/3: reference h3c directly from ngx_http_connection_t.
Roman Arutyunyan <arut@nginx.com>
parents:
8768
diff
changeset
|
433 ngx_http_v3_srv_conf_t *h3scf; |
8495
455a8536eaa7
QUIC: limited the number of server-initiated streams.
Roman Arutyunyan <arut@nginx.com>
parents:
8492
diff
changeset
|
434 |
8456
c9538aef3211
HTTP/3: refactored dynamic table implementation.
Roman Arutyunyan <arut@nginx.com>
parents:
8403
diff
changeset
|
435 ngx_log_debug0(NGX_LOG_DEBUG_HTTP, c->log, 0, "http3 send settings"); |
c9538aef3211
HTTP/3: refactored dynamic table implementation.
Roman Arutyunyan <arut@nginx.com>
parents:
8403
diff
changeset
|
436 |
c9538aef3211
HTTP/3: refactored dynamic table implementation.
Roman Arutyunyan <arut@nginx.com>
parents:
8403
diff
changeset
|
437 cc = ngx_http_v3_get_uni_stream(c, NGX_HTTP_V3_STREAM_CONTROL); |
c9538aef3211
HTTP/3: refactored dynamic table implementation.
Roman Arutyunyan <arut@nginx.com>
parents:
8403
diff
changeset
|
438 if (cc == NULL) { |
8902
925572184d4a
HTTP/3: adjusted QUIC connection finalization.
Roman Arutyunyan <arut@nginx.com>
parents:
8881
diff
changeset
|
439 return NGX_ERROR; |
8456
c9538aef3211
HTTP/3: refactored dynamic table implementation.
Roman Arutyunyan <arut@nginx.com>
parents:
8403
diff
changeset
|
440 } |
c9538aef3211
HTTP/3: refactored dynamic table implementation.
Roman Arutyunyan <arut@nginx.com>
parents:
8403
diff
changeset
|
441 |
8769
9ec3e71f8a61
HTTP/3: reference h3c directly from ngx_http_connection_t.
Roman Arutyunyan <arut@nginx.com>
parents:
8768
diff
changeset
|
442 h3scf = ngx_http_v3_get_module_srv_conf(c, ngx_http_v3_module); |
8456
c9538aef3211
HTTP/3: refactored dynamic table implementation.
Roman Arutyunyan <arut@nginx.com>
parents:
8403
diff
changeset
|
443 |
c9538aef3211
HTTP/3: refactored dynamic table implementation.
Roman Arutyunyan <arut@nginx.com>
parents:
8403
diff
changeset
|
444 n = ngx_http_v3_encode_varlen_int(NULL, |
c9538aef3211
HTTP/3: refactored dynamic table implementation.
Roman Arutyunyan <arut@nginx.com>
parents:
8403
diff
changeset
|
445 NGX_HTTP_V3_PARAM_MAX_TABLE_CAPACITY); |
8492
65c1fc5fae15
HTTP/3: renamed server configuration variables from v3cf to h3scf.
Roman Arutyunyan <arut@nginx.com>
parents:
8481
diff
changeset
|
446 n += ngx_http_v3_encode_varlen_int(NULL, h3scf->max_table_capacity); |
8456
c9538aef3211
HTTP/3: refactored dynamic table implementation.
Roman Arutyunyan <arut@nginx.com>
parents:
8403
diff
changeset
|
447 n += ngx_http_v3_encode_varlen_int(NULL, NGX_HTTP_V3_PARAM_BLOCKED_STREAMS); |
8492
65c1fc5fae15
HTTP/3: renamed server configuration variables from v3cf to h3scf.
Roman Arutyunyan <arut@nginx.com>
parents:
8481
diff
changeset
|
448 n += ngx_http_v3_encode_varlen_int(NULL, h3scf->max_blocked_streams); |
8456
c9538aef3211
HTTP/3: refactored dynamic table implementation.
Roman Arutyunyan <arut@nginx.com>
parents:
8403
diff
changeset
|
449 |
c9538aef3211
HTTP/3: refactored dynamic table implementation.
Roman Arutyunyan <arut@nginx.com>
parents:
8403
diff
changeset
|
450 p = (u_char *) ngx_http_v3_encode_varlen_int(buf, |
c9538aef3211
HTTP/3: refactored dynamic table implementation.
Roman Arutyunyan <arut@nginx.com>
parents:
8403
diff
changeset
|
451 NGX_HTTP_V3_FRAME_SETTINGS); |
c9538aef3211
HTTP/3: refactored dynamic table implementation.
Roman Arutyunyan <arut@nginx.com>
parents:
8403
diff
changeset
|
452 p = (u_char *) ngx_http_v3_encode_varlen_int(p, n); |
c9538aef3211
HTTP/3: refactored dynamic table implementation.
Roman Arutyunyan <arut@nginx.com>
parents:
8403
diff
changeset
|
453 p = (u_char *) ngx_http_v3_encode_varlen_int(p, |
c9538aef3211
HTTP/3: refactored dynamic table implementation.
Roman Arutyunyan <arut@nginx.com>
parents:
8403
diff
changeset
|
454 NGX_HTTP_V3_PARAM_MAX_TABLE_CAPACITY); |
8492
65c1fc5fae15
HTTP/3: renamed server configuration variables from v3cf to h3scf.
Roman Arutyunyan <arut@nginx.com>
parents:
8481
diff
changeset
|
455 p = (u_char *) ngx_http_v3_encode_varlen_int(p, h3scf->max_table_capacity); |
8456
c9538aef3211
HTTP/3: refactored dynamic table implementation.
Roman Arutyunyan <arut@nginx.com>
parents:
8403
diff
changeset
|
456 p = (u_char *) ngx_http_v3_encode_varlen_int(p, |
c9538aef3211
HTTP/3: refactored dynamic table implementation.
Roman Arutyunyan <arut@nginx.com>
parents:
8403
diff
changeset
|
457 NGX_HTTP_V3_PARAM_BLOCKED_STREAMS); |
8492
65c1fc5fae15
HTTP/3: renamed server configuration variables from v3cf to h3scf.
Roman Arutyunyan <arut@nginx.com>
parents:
8481
diff
changeset
|
458 p = (u_char *) ngx_http_v3_encode_varlen_int(p, h3scf->max_blocked_streams); |
8456
c9538aef3211
HTTP/3: refactored dynamic table implementation.
Roman Arutyunyan <arut@nginx.com>
parents:
8403
diff
changeset
|
459 n = p - buf; |
c9538aef3211
HTTP/3: refactored dynamic table implementation.
Roman Arutyunyan <arut@nginx.com>
parents:
8403
diff
changeset
|
460 |
8881
72b304f6207c
HTTP/3: traffic-based flood detection.
Roman Arutyunyan <arut@nginx.com>
parents:
8879
diff
changeset
|
461 h3c = ngx_http_v3_get_session(c); |
72b304f6207c
HTTP/3: traffic-based flood detection.
Roman Arutyunyan <arut@nginx.com>
parents:
8879
diff
changeset
|
462 h3c->total_bytes += n; |
72b304f6207c
HTTP/3: traffic-based flood detection.
Roman Arutyunyan <arut@nginx.com>
parents:
8879
diff
changeset
|
463 |
8456
c9538aef3211
HTTP/3: refactored dynamic table implementation.
Roman Arutyunyan <arut@nginx.com>
parents:
8403
diff
changeset
|
464 if (cc->send(cc, buf, n) != (ssize_t) n) { |
c9538aef3211
HTTP/3: refactored dynamic table implementation.
Roman Arutyunyan <arut@nginx.com>
parents:
8403
diff
changeset
|
465 goto failed; |
c9538aef3211
HTTP/3: refactored dynamic table implementation.
Roman Arutyunyan <arut@nginx.com>
parents:
8403
diff
changeset
|
466 } |
c9538aef3211
HTTP/3: refactored dynamic table implementation.
Roman Arutyunyan <arut@nginx.com>
parents:
8403
diff
changeset
|
467 |
c9538aef3211
HTTP/3: refactored dynamic table implementation.
Roman Arutyunyan <arut@nginx.com>
parents:
8403
diff
changeset
|
468 return NGX_OK; |
c9538aef3211
HTTP/3: refactored dynamic table implementation.
Roman Arutyunyan <arut@nginx.com>
parents:
8403
diff
changeset
|
469 |
c9538aef3211
HTTP/3: refactored dynamic table implementation.
Roman Arutyunyan <arut@nginx.com>
parents:
8403
diff
changeset
|
470 failed: |
c9538aef3211
HTTP/3: refactored dynamic table implementation.
Roman Arutyunyan <arut@nginx.com>
parents:
8403
diff
changeset
|
471 |
8902
925572184d4a
HTTP/3: adjusted QUIC connection finalization.
Roman Arutyunyan <arut@nginx.com>
parents:
8881
diff
changeset
|
472 ngx_log_error(NGX_LOG_ERR, c->log, 0, "failed to send settings"); |
925572184d4a
HTTP/3: adjusted QUIC connection finalization.
Roman Arutyunyan <arut@nginx.com>
parents:
8881
diff
changeset
|
473 |
925572184d4a
HTTP/3: adjusted QUIC connection finalization.
Roman Arutyunyan <arut@nginx.com>
parents:
8881
diff
changeset
|
474 ngx_http_v3_finalize_connection(c, NGX_HTTP_V3_ERR_EXCESSIVE_LOAD, |
925572184d4a
HTTP/3: adjusted QUIC connection finalization.
Roman Arutyunyan <arut@nginx.com>
parents:
8881
diff
changeset
|
475 "failed to send settings"); |
8456
c9538aef3211
HTTP/3: refactored dynamic table implementation.
Roman Arutyunyan <arut@nginx.com>
parents:
8403
diff
changeset
|
476 ngx_http_v3_close_uni_stream(cc); |
c9538aef3211
HTTP/3: refactored dynamic table implementation.
Roman Arutyunyan <arut@nginx.com>
parents:
8403
diff
changeset
|
477 |
c9538aef3211
HTTP/3: refactored dynamic table implementation.
Roman Arutyunyan <arut@nginx.com>
parents:
8403
diff
changeset
|
478 return NGX_ERROR; |
c9538aef3211
HTTP/3: refactored dynamic table implementation.
Roman Arutyunyan <arut@nginx.com>
parents:
8403
diff
changeset
|
479 } |
c9538aef3211
HTTP/3: refactored dynamic table implementation.
Roman Arutyunyan <arut@nginx.com>
parents:
8403
diff
changeset
|
480 |
c9538aef3211
HTTP/3: refactored dynamic table implementation.
Roman Arutyunyan <arut@nginx.com>
parents:
8403
diff
changeset
|
481 |
c9538aef3211
HTTP/3: refactored dynamic table implementation.
Roman Arutyunyan <arut@nginx.com>
parents:
8403
diff
changeset
|
482 ngx_int_t |
8723
265062a99043
HTTP/3: send GOAWAY when last request is accepted.
Roman Arutyunyan <arut@nginx.com>
parents:
8719
diff
changeset
|
483 ngx_http_v3_send_goaway(ngx_connection_t *c, uint64_t id) |
265062a99043
HTTP/3: send GOAWAY when last request is accepted.
Roman Arutyunyan <arut@nginx.com>
parents:
8719
diff
changeset
|
484 { |
8881
72b304f6207c
HTTP/3: traffic-based flood detection.
Roman Arutyunyan <arut@nginx.com>
parents:
8879
diff
changeset
|
485 u_char *p, buf[NGX_HTTP_V3_VARLEN_INT_LEN * 3]; |
72b304f6207c
HTTP/3: traffic-based flood detection.
Roman Arutyunyan <arut@nginx.com>
parents:
8879
diff
changeset
|
486 size_t n; |
72b304f6207c
HTTP/3: traffic-based flood detection.
Roman Arutyunyan <arut@nginx.com>
parents:
8879
diff
changeset
|
487 ngx_connection_t *cc; |
72b304f6207c
HTTP/3: traffic-based flood detection.
Roman Arutyunyan <arut@nginx.com>
parents:
8879
diff
changeset
|
488 ngx_http_v3_session_t *h3c; |
8723
265062a99043
HTTP/3: send GOAWAY when last request is accepted.
Roman Arutyunyan <arut@nginx.com>
parents:
8719
diff
changeset
|
489 |
265062a99043
HTTP/3: send GOAWAY when last request is accepted.
Roman Arutyunyan <arut@nginx.com>
parents:
8719
diff
changeset
|
490 ngx_log_debug1(NGX_LOG_DEBUG_HTTP, c->log, 0, "http3 send goaway %uL", id); |
265062a99043
HTTP/3: send GOAWAY when last request is accepted.
Roman Arutyunyan <arut@nginx.com>
parents:
8719
diff
changeset
|
491 |
265062a99043
HTTP/3: send GOAWAY when last request is accepted.
Roman Arutyunyan <arut@nginx.com>
parents:
8719
diff
changeset
|
492 cc = ngx_http_v3_get_uni_stream(c, NGX_HTTP_V3_STREAM_CONTROL); |
265062a99043
HTTP/3: send GOAWAY when last request is accepted.
Roman Arutyunyan <arut@nginx.com>
parents:
8719
diff
changeset
|
493 if (cc == NULL) { |
8902
925572184d4a
HTTP/3: adjusted QUIC connection finalization.
Roman Arutyunyan <arut@nginx.com>
parents:
8881
diff
changeset
|
494 return NGX_ERROR; |
8723
265062a99043
HTTP/3: send GOAWAY when last request is accepted.
Roman Arutyunyan <arut@nginx.com>
parents:
8719
diff
changeset
|
495 } |
265062a99043
HTTP/3: send GOAWAY when last request is accepted.
Roman Arutyunyan <arut@nginx.com>
parents:
8719
diff
changeset
|
496 |
265062a99043
HTTP/3: send GOAWAY when last request is accepted.
Roman Arutyunyan <arut@nginx.com>
parents:
8719
diff
changeset
|
497 n = ngx_http_v3_encode_varlen_int(NULL, id); |
265062a99043
HTTP/3: send GOAWAY when last request is accepted.
Roman Arutyunyan <arut@nginx.com>
parents:
8719
diff
changeset
|
498 p = (u_char *) ngx_http_v3_encode_varlen_int(buf, NGX_HTTP_V3_FRAME_GOAWAY); |
265062a99043
HTTP/3: send GOAWAY when last request is accepted.
Roman Arutyunyan <arut@nginx.com>
parents:
8719
diff
changeset
|
499 p = (u_char *) ngx_http_v3_encode_varlen_int(p, n); |
265062a99043
HTTP/3: send GOAWAY when last request is accepted.
Roman Arutyunyan <arut@nginx.com>
parents:
8719
diff
changeset
|
500 p = (u_char *) ngx_http_v3_encode_varlen_int(p, id); |
265062a99043
HTTP/3: send GOAWAY when last request is accepted.
Roman Arutyunyan <arut@nginx.com>
parents:
8719
diff
changeset
|
501 n = p - buf; |
265062a99043
HTTP/3: send GOAWAY when last request is accepted.
Roman Arutyunyan <arut@nginx.com>
parents:
8719
diff
changeset
|
502 |
8881
72b304f6207c
HTTP/3: traffic-based flood detection.
Roman Arutyunyan <arut@nginx.com>
parents:
8879
diff
changeset
|
503 h3c = ngx_http_v3_get_session(c); |
72b304f6207c
HTTP/3: traffic-based flood detection.
Roman Arutyunyan <arut@nginx.com>
parents:
8879
diff
changeset
|
504 h3c->total_bytes += n; |
72b304f6207c
HTTP/3: traffic-based flood detection.
Roman Arutyunyan <arut@nginx.com>
parents:
8879
diff
changeset
|
505 |
8723
265062a99043
HTTP/3: send GOAWAY when last request is accepted.
Roman Arutyunyan <arut@nginx.com>
parents:
8719
diff
changeset
|
506 if (cc->send(cc, buf, n) != (ssize_t) n) { |
265062a99043
HTTP/3: send GOAWAY when last request is accepted.
Roman Arutyunyan <arut@nginx.com>
parents:
8719
diff
changeset
|
507 goto failed; |
265062a99043
HTTP/3: send GOAWAY when last request is accepted.
Roman Arutyunyan <arut@nginx.com>
parents:
8719
diff
changeset
|
508 } |
265062a99043
HTTP/3: send GOAWAY when last request is accepted.
Roman Arutyunyan <arut@nginx.com>
parents:
8719
diff
changeset
|
509 |
265062a99043
HTTP/3: send GOAWAY when last request is accepted.
Roman Arutyunyan <arut@nginx.com>
parents:
8719
diff
changeset
|
510 return NGX_OK; |
265062a99043
HTTP/3: send GOAWAY when last request is accepted.
Roman Arutyunyan <arut@nginx.com>
parents:
8719
diff
changeset
|
511 |
265062a99043
HTTP/3: send GOAWAY when last request is accepted.
Roman Arutyunyan <arut@nginx.com>
parents:
8719
diff
changeset
|
512 failed: |
265062a99043
HTTP/3: send GOAWAY when last request is accepted.
Roman Arutyunyan <arut@nginx.com>
parents:
8719
diff
changeset
|
513 |
8902
925572184d4a
HTTP/3: adjusted QUIC connection finalization.
Roman Arutyunyan <arut@nginx.com>
parents:
8881
diff
changeset
|
514 ngx_log_error(NGX_LOG_ERR, c->log, 0, "failed to send goaway"); |
925572184d4a
HTTP/3: adjusted QUIC connection finalization.
Roman Arutyunyan <arut@nginx.com>
parents:
8881
diff
changeset
|
515 |
925572184d4a
HTTP/3: adjusted QUIC connection finalization.
Roman Arutyunyan <arut@nginx.com>
parents:
8881
diff
changeset
|
516 ngx_http_v3_finalize_connection(c, NGX_HTTP_V3_ERR_EXCESSIVE_LOAD, |
925572184d4a
HTTP/3: adjusted QUIC connection finalization.
Roman Arutyunyan <arut@nginx.com>
parents:
8881
diff
changeset
|
517 "failed to send goaway"); |
8723
265062a99043
HTTP/3: send GOAWAY when last request is accepted.
Roman Arutyunyan <arut@nginx.com>
parents:
8719
diff
changeset
|
518 ngx_http_v3_close_uni_stream(cc); |
265062a99043
HTTP/3: send GOAWAY when last request is accepted.
Roman Arutyunyan <arut@nginx.com>
parents:
8719
diff
changeset
|
519 |
265062a99043
HTTP/3: send GOAWAY when last request is accepted.
Roman Arutyunyan <arut@nginx.com>
parents:
8719
diff
changeset
|
520 return NGX_ERROR; |
265062a99043
HTTP/3: send GOAWAY when last request is accepted.
Roman Arutyunyan <arut@nginx.com>
parents:
8719
diff
changeset
|
521 } |
265062a99043
HTTP/3: send GOAWAY when last request is accepted.
Roman Arutyunyan <arut@nginx.com>
parents:
8719
diff
changeset
|
522 |
265062a99043
HTTP/3: send GOAWAY when last request is accepted.
Roman Arutyunyan <arut@nginx.com>
parents:
8719
diff
changeset
|
523 |
265062a99043
HTTP/3: send GOAWAY when last request is accepted.
Roman Arutyunyan <arut@nginx.com>
parents:
8719
diff
changeset
|
524 ngx_int_t |
8807
0ac25efb2da3
HTTP/3: quic-qpack term updates.
Sergey Kandaurov <pluknet@nginx.com>
parents:
8796
diff
changeset
|
525 ngx_http_v3_send_ack_section(ngx_connection_t *c, ngx_uint_t stream_id) |
8215 | 526 { |
8881
72b304f6207c
HTTP/3: traffic-based flood detection.
Roman Arutyunyan <arut@nginx.com>
parents:
8879
diff
changeset
|
527 u_char buf[NGX_HTTP_V3_PREFIX_INT_LEN]; |
72b304f6207c
HTTP/3: traffic-based flood detection.
Roman Arutyunyan <arut@nginx.com>
parents:
8879
diff
changeset
|
528 size_t n; |
72b304f6207c
HTTP/3: traffic-based flood detection.
Roman Arutyunyan <arut@nginx.com>
parents:
8879
diff
changeset
|
529 ngx_connection_t *dc; |
72b304f6207c
HTTP/3: traffic-based flood detection.
Roman Arutyunyan <arut@nginx.com>
parents:
8879
diff
changeset
|
530 ngx_http_v3_session_t *h3c; |
8215 | 531 |
532 ngx_log_debug1(NGX_LOG_DEBUG_HTTP, c->log, 0, | |
8902
925572184d4a
HTTP/3: adjusted QUIC connection finalization.
Roman Arutyunyan <arut@nginx.com>
parents:
8881
diff
changeset
|
533 "http3 send section acknowledgement %ui", stream_id); |
8215 | 534 |
8283
dadbc66e9fca
Simplifed handling HTTP/3 streams.
Roman Arutyunyan <arut@nginx.com>
parents:
8281
diff
changeset
|
535 dc = ngx_http_v3_get_uni_stream(c, NGX_HTTP_V3_STREAM_DECODER); |
8215 | 536 if (dc == NULL) { |
537 return NGX_ERROR; | |
538 } | |
539 | |
540 buf[0] = 0x80; | |
541 n = (u_char *) ngx_http_v3_encode_prefix_int(buf, stream_id, 7) - buf; | |
542 | |
8881
72b304f6207c
HTTP/3: traffic-based flood detection.
Roman Arutyunyan <arut@nginx.com>
parents:
8879
diff
changeset
|
543 h3c = ngx_http_v3_get_session(c); |
72b304f6207c
HTTP/3: traffic-based flood detection.
Roman Arutyunyan <arut@nginx.com>
parents:
8879
diff
changeset
|
544 h3c->total_bytes += n; |
72b304f6207c
HTTP/3: traffic-based flood detection.
Roman Arutyunyan <arut@nginx.com>
parents:
8879
diff
changeset
|
545 |
8215 | 546 if (dc->send(dc, buf, n) != (ssize_t) n) { |
8902
925572184d4a
HTTP/3: adjusted QUIC connection finalization.
Roman Arutyunyan <arut@nginx.com>
parents:
8881
diff
changeset
|
547 goto failed; |
8215 | 548 } |
549 | |
550 return NGX_OK; | |
8902
925572184d4a
HTTP/3: adjusted QUIC connection finalization.
Roman Arutyunyan <arut@nginx.com>
parents:
8881
diff
changeset
|
551 |
925572184d4a
HTTP/3: adjusted QUIC connection finalization.
Roman Arutyunyan <arut@nginx.com>
parents:
8881
diff
changeset
|
552 failed: |
925572184d4a
HTTP/3: adjusted QUIC connection finalization.
Roman Arutyunyan <arut@nginx.com>
parents:
8881
diff
changeset
|
553 |
925572184d4a
HTTP/3: adjusted QUIC connection finalization.
Roman Arutyunyan <arut@nginx.com>
parents:
8881
diff
changeset
|
554 ngx_log_error(NGX_LOG_ERR, c->log, 0, |
925572184d4a
HTTP/3: adjusted QUIC connection finalization.
Roman Arutyunyan <arut@nginx.com>
parents:
8881
diff
changeset
|
555 "failed to send section acknowledgement"); |
925572184d4a
HTTP/3: adjusted QUIC connection finalization.
Roman Arutyunyan <arut@nginx.com>
parents:
8881
diff
changeset
|
556 |
925572184d4a
HTTP/3: adjusted QUIC connection finalization.
Roman Arutyunyan <arut@nginx.com>
parents:
8881
diff
changeset
|
557 ngx_http_v3_finalize_connection(c, NGX_HTTP_V3_ERR_EXCESSIVE_LOAD, |
925572184d4a
HTTP/3: adjusted QUIC connection finalization.
Roman Arutyunyan <arut@nginx.com>
parents:
8881
diff
changeset
|
558 "failed to send section acknowledgement"); |
925572184d4a
HTTP/3: adjusted QUIC connection finalization.
Roman Arutyunyan <arut@nginx.com>
parents:
8881
diff
changeset
|
559 ngx_http_v3_close_uni_stream(dc); |
925572184d4a
HTTP/3: adjusted QUIC connection finalization.
Roman Arutyunyan <arut@nginx.com>
parents:
8881
diff
changeset
|
560 |
925572184d4a
HTTP/3: adjusted QUIC connection finalization.
Roman Arutyunyan <arut@nginx.com>
parents:
8881
diff
changeset
|
561 return NGX_ERROR; |
8215 | 562 } |
563 | |
564 | |
565 ngx_int_t | |
8771
0981329169ea
HTTP/3: renamed ngx_http_v3_client_XXX() functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8770
diff
changeset
|
566 ngx_http_v3_send_cancel_stream(ngx_connection_t *c, ngx_uint_t stream_id) |
8215 | 567 { |
8881
72b304f6207c
HTTP/3: traffic-based flood detection.
Roman Arutyunyan <arut@nginx.com>
parents:
8879
diff
changeset
|
568 u_char buf[NGX_HTTP_V3_PREFIX_INT_LEN]; |
72b304f6207c
HTTP/3: traffic-based flood detection.
Roman Arutyunyan <arut@nginx.com>
parents:
8879
diff
changeset
|
569 size_t n; |
72b304f6207c
HTTP/3: traffic-based flood detection.
Roman Arutyunyan <arut@nginx.com>
parents:
8879
diff
changeset
|
570 ngx_connection_t *dc; |
72b304f6207c
HTTP/3: traffic-based flood detection.
Roman Arutyunyan <arut@nginx.com>
parents:
8879
diff
changeset
|
571 ngx_http_v3_session_t *h3c; |
8215 | 572 |
573 ngx_log_debug1(NGX_LOG_DEBUG_HTTP, c->log, 0, | |
8902
925572184d4a
HTTP/3: adjusted QUIC connection finalization.
Roman Arutyunyan <arut@nginx.com>
parents:
8881
diff
changeset
|
574 "http3 send stream cancellation %ui", stream_id); |
8215 | 575 |
8283
dadbc66e9fca
Simplifed handling HTTP/3 streams.
Roman Arutyunyan <arut@nginx.com>
parents:
8281
diff
changeset
|
576 dc = ngx_http_v3_get_uni_stream(c, NGX_HTTP_V3_STREAM_DECODER); |
8215 | 577 if (dc == NULL) { |
578 return NGX_ERROR; | |
579 } | |
580 | |
581 buf[0] = 0x40; | |
582 n = (u_char *) ngx_http_v3_encode_prefix_int(buf, stream_id, 6) - buf; | |
583 | |
8881
72b304f6207c
HTTP/3: traffic-based flood detection.
Roman Arutyunyan <arut@nginx.com>
parents:
8879
diff
changeset
|
584 h3c = ngx_http_v3_get_session(c); |
72b304f6207c
HTTP/3: traffic-based flood detection.
Roman Arutyunyan <arut@nginx.com>
parents:
8879
diff
changeset
|
585 h3c->total_bytes += n; |
72b304f6207c
HTTP/3: traffic-based flood detection.
Roman Arutyunyan <arut@nginx.com>
parents:
8879
diff
changeset
|
586 |
8215 | 587 if (dc->send(dc, buf, n) != (ssize_t) n) { |
8902
925572184d4a
HTTP/3: adjusted QUIC connection finalization.
Roman Arutyunyan <arut@nginx.com>
parents:
8881
diff
changeset
|
588 goto failed; |
8215 | 589 } |
590 | |
591 return NGX_OK; | |
8902
925572184d4a
HTTP/3: adjusted QUIC connection finalization.
Roman Arutyunyan <arut@nginx.com>
parents:
8881
diff
changeset
|
592 |
925572184d4a
HTTP/3: adjusted QUIC connection finalization.
Roman Arutyunyan <arut@nginx.com>
parents:
8881
diff
changeset
|
593 failed: |
925572184d4a
HTTP/3: adjusted QUIC connection finalization.
Roman Arutyunyan <arut@nginx.com>
parents:
8881
diff
changeset
|
594 |
925572184d4a
HTTP/3: adjusted QUIC connection finalization.
Roman Arutyunyan <arut@nginx.com>
parents:
8881
diff
changeset
|
595 ngx_log_error(NGX_LOG_ERR, c->log, 0, "failed to send stream cancellation"); |
925572184d4a
HTTP/3: adjusted QUIC connection finalization.
Roman Arutyunyan <arut@nginx.com>
parents:
8881
diff
changeset
|
596 |
925572184d4a
HTTP/3: adjusted QUIC connection finalization.
Roman Arutyunyan <arut@nginx.com>
parents:
8881
diff
changeset
|
597 ngx_http_v3_finalize_connection(c, NGX_HTTP_V3_ERR_EXCESSIVE_LOAD, |
925572184d4a
HTTP/3: adjusted QUIC connection finalization.
Roman Arutyunyan <arut@nginx.com>
parents:
8881
diff
changeset
|
598 "failed to send stream cancellation"); |
925572184d4a
HTTP/3: adjusted QUIC connection finalization.
Roman Arutyunyan <arut@nginx.com>
parents:
8881
diff
changeset
|
599 ngx_http_v3_close_uni_stream(dc); |
925572184d4a
HTTP/3: adjusted QUIC connection finalization.
Roman Arutyunyan <arut@nginx.com>
parents:
8881
diff
changeset
|
600 |
925572184d4a
HTTP/3: adjusted QUIC connection finalization.
Roman Arutyunyan <arut@nginx.com>
parents:
8881
diff
changeset
|
601 return NGX_ERROR; |
8215 | 602 } |
603 | |
604 | |
605 ngx_int_t | |
8771
0981329169ea
HTTP/3: renamed ngx_http_v3_client_XXX() functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8770
diff
changeset
|
606 ngx_http_v3_send_inc_insert_count(ngx_connection_t *c, ngx_uint_t inc) |
8215 | 607 { |
8881
72b304f6207c
HTTP/3: traffic-based flood detection.
Roman Arutyunyan <arut@nginx.com>
parents:
8879
diff
changeset
|
608 u_char buf[NGX_HTTP_V3_PREFIX_INT_LEN]; |
72b304f6207c
HTTP/3: traffic-based flood detection.
Roman Arutyunyan <arut@nginx.com>
parents:
8879
diff
changeset
|
609 size_t n; |
72b304f6207c
HTTP/3: traffic-based flood detection.
Roman Arutyunyan <arut@nginx.com>
parents:
8879
diff
changeset
|
610 ngx_connection_t *dc; |
72b304f6207c
HTTP/3: traffic-based flood detection.
Roman Arutyunyan <arut@nginx.com>
parents:
8879
diff
changeset
|
611 ngx_http_v3_session_t *h3c; |
8215 | 612 |
613 ngx_log_debug1(NGX_LOG_DEBUG_HTTP, c->log, 0, | |
8902
925572184d4a
HTTP/3: adjusted QUIC connection finalization.
Roman Arutyunyan <arut@nginx.com>
parents:
8881
diff
changeset
|
614 "http3 send insert count increment %ui", inc); |
8215 | 615 |
8283
dadbc66e9fca
Simplifed handling HTTP/3 streams.
Roman Arutyunyan <arut@nginx.com>
parents:
8281
diff
changeset
|
616 dc = ngx_http_v3_get_uni_stream(c, NGX_HTTP_V3_STREAM_DECODER); |
8215 | 617 if (dc == NULL) { |
618 return NGX_ERROR; | |
619 } | |
620 | |
621 buf[0] = 0; | |
622 n = (u_char *) ngx_http_v3_encode_prefix_int(buf, inc, 6) - buf; | |
623 | |
8881
72b304f6207c
HTTP/3: traffic-based flood detection.
Roman Arutyunyan <arut@nginx.com>
parents:
8879
diff
changeset
|
624 h3c = ngx_http_v3_get_session(c); |
72b304f6207c
HTTP/3: traffic-based flood detection.
Roman Arutyunyan <arut@nginx.com>
parents:
8879
diff
changeset
|
625 h3c->total_bytes += n; |
72b304f6207c
HTTP/3: traffic-based flood detection.
Roman Arutyunyan <arut@nginx.com>
parents:
8879
diff
changeset
|
626 |
8215 | 627 if (dc->send(dc, buf, n) != (ssize_t) n) { |
8902
925572184d4a
HTTP/3: adjusted QUIC connection finalization.
Roman Arutyunyan <arut@nginx.com>
parents:
8881
diff
changeset
|
628 goto failed; |
8215 | 629 } |
630 | |
631 return NGX_OK; | |
8902
925572184d4a
HTTP/3: adjusted QUIC connection finalization.
Roman Arutyunyan <arut@nginx.com>
parents:
8881
diff
changeset
|
632 |
925572184d4a
HTTP/3: adjusted QUIC connection finalization.
Roman Arutyunyan <arut@nginx.com>
parents:
8881
diff
changeset
|
633 failed: |
925572184d4a
HTTP/3: adjusted QUIC connection finalization.
Roman Arutyunyan <arut@nginx.com>
parents:
8881
diff
changeset
|
634 |
925572184d4a
HTTP/3: adjusted QUIC connection finalization.
Roman Arutyunyan <arut@nginx.com>
parents:
8881
diff
changeset
|
635 ngx_log_error(NGX_LOG_ERR, c->log, 0, |
925572184d4a
HTTP/3: adjusted QUIC connection finalization.
Roman Arutyunyan <arut@nginx.com>
parents:
8881
diff
changeset
|
636 "failed to send insert count increment"); |
925572184d4a
HTTP/3: adjusted QUIC connection finalization.
Roman Arutyunyan <arut@nginx.com>
parents:
8881
diff
changeset
|
637 |
925572184d4a
HTTP/3: adjusted QUIC connection finalization.
Roman Arutyunyan <arut@nginx.com>
parents:
8881
diff
changeset
|
638 ngx_http_v3_finalize_connection(c, NGX_HTTP_V3_ERR_EXCESSIVE_LOAD, |
925572184d4a
HTTP/3: adjusted QUIC connection finalization.
Roman Arutyunyan <arut@nginx.com>
parents:
8881
diff
changeset
|
639 "failed to send insert count increment"); |
925572184d4a
HTTP/3: adjusted QUIC connection finalization.
Roman Arutyunyan <arut@nginx.com>
parents:
8881
diff
changeset
|
640 ngx_http_v3_close_uni_stream(dc); |
925572184d4a
HTTP/3: adjusted QUIC connection finalization.
Roman Arutyunyan <arut@nginx.com>
parents:
8881
diff
changeset
|
641 |
925572184d4a
HTTP/3: adjusted QUIC connection finalization.
Roman Arutyunyan <arut@nginx.com>
parents:
8881
diff
changeset
|
642 return NGX_ERROR; |
8215 | 643 } |
8497 | 644 |
645 | |
646 ngx_int_t | |
647 ngx_http_v3_set_max_push_id(ngx_connection_t *c, uint64_t max_push_id) | |
648 { | |
8770
67f0eb150047
HTTP/3: renamed ngx_http_v3_connection_t to ngx_http_v3_session_t.
Roman Arutyunyan <arut@nginx.com>
parents:
8769
diff
changeset
|
649 ngx_http_v3_session_t *h3c; |
8497 | 650 |
8768
40d710a66aef
HTTP/3: ngx_http_v3_get_session() macro.
Roman Arutyunyan <arut@nginx.com>
parents:
8767
diff
changeset
|
651 h3c = ngx_http_v3_get_session(c); |
8497 | 652 |
653 ngx_log_debug1(NGX_LOG_DEBUG_HTTP, c->log, 0, | |
654 "http3 MAX_PUSH_ID:%uL", max_push_id); | |
655 | |
8719
5cb5b568282b
HTTP/3: do not push until a MAX_PUSH_ID frame is received.
Sergey Kandaurov <pluknet@nginx.com>
parents:
8679
diff
changeset
|
656 if (h3c->max_push_id != (uint64_t) -1 && max_push_id < h3c->max_push_id) { |
8497 | 657 return NGX_HTTP_V3_ERR_ID_ERROR; |
658 } | |
659 | |
660 h3c->max_push_id = max_push_id; | |
661 | |
662 return NGX_OK; | |
663 } | |
664 | |
665 | |
666 ngx_int_t | |
8796
1fec68e322d0
HTTP/3: client GOAWAY support.
Roman Arutyunyan <arut@nginx.com>
parents:
8774
diff
changeset
|
667 ngx_http_v3_goaway(ngx_connection_t *c, uint64_t push_id) |
1fec68e322d0
HTTP/3: client GOAWAY support.
Roman Arutyunyan <arut@nginx.com>
parents:
8774
diff
changeset
|
668 { |
1fec68e322d0
HTTP/3: client GOAWAY support.
Roman Arutyunyan <arut@nginx.com>
parents:
8774
diff
changeset
|
669 ngx_http_v3_session_t *h3c; |
1fec68e322d0
HTTP/3: client GOAWAY support.
Roman Arutyunyan <arut@nginx.com>
parents:
8774
diff
changeset
|
670 |
1fec68e322d0
HTTP/3: client GOAWAY support.
Roman Arutyunyan <arut@nginx.com>
parents:
8774
diff
changeset
|
671 h3c = ngx_http_v3_get_session(c); |
1fec68e322d0
HTTP/3: client GOAWAY support.
Roman Arutyunyan <arut@nginx.com>
parents:
8774
diff
changeset
|
672 |
1fec68e322d0
HTTP/3: client GOAWAY support.
Roman Arutyunyan <arut@nginx.com>
parents:
8774
diff
changeset
|
673 ngx_log_debug1(NGX_LOG_DEBUG_HTTP, c->log, 0, "http3 GOAWAY:%uL", push_id); |
1fec68e322d0
HTTP/3: client GOAWAY support.
Roman Arutyunyan <arut@nginx.com>
parents:
8774
diff
changeset
|
674 |
1fec68e322d0
HTTP/3: client GOAWAY support.
Roman Arutyunyan <arut@nginx.com>
parents:
8774
diff
changeset
|
675 h3c->goaway_push_id = push_id; |
1fec68e322d0
HTTP/3: client GOAWAY support.
Roman Arutyunyan <arut@nginx.com>
parents:
8774
diff
changeset
|
676 |
1fec68e322d0
HTTP/3: client GOAWAY support.
Roman Arutyunyan <arut@nginx.com>
parents:
8774
diff
changeset
|
677 return NGX_OK; |
1fec68e322d0
HTTP/3: client GOAWAY support.
Roman Arutyunyan <arut@nginx.com>
parents:
8774
diff
changeset
|
678 } |
1fec68e322d0
HTTP/3: client GOAWAY support.
Roman Arutyunyan <arut@nginx.com>
parents:
8774
diff
changeset
|
679 |
1fec68e322d0
HTTP/3: client GOAWAY support.
Roman Arutyunyan <arut@nginx.com>
parents:
8774
diff
changeset
|
680 |
1fec68e322d0
HTTP/3: client GOAWAY support.
Roman Arutyunyan <arut@nginx.com>
parents:
8774
diff
changeset
|
681 ngx_int_t |
8497 | 682 ngx_http_v3_cancel_push(ngx_connection_t *c, uint64_t push_id) |
683 { | |
8770
67f0eb150047
HTTP/3: renamed ngx_http_v3_connection_t to ngx_http_v3_session_t.
Roman Arutyunyan <arut@nginx.com>
parents:
8769
diff
changeset
|
684 ngx_queue_t *q; |
67f0eb150047
HTTP/3: renamed ngx_http_v3_connection_t to ngx_http_v3_session_t.
Roman Arutyunyan <arut@nginx.com>
parents:
8769
diff
changeset
|
685 ngx_http_request_t *r; |
67f0eb150047
HTTP/3: renamed ngx_http_v3_connection_t to ngx_http_v3_session_t.
Roman Arutyunyan <arut@nginx.com>
parents:
8769
diff
changeset
|
686 ngx_http_v3_push_t *push; |
67f0eb150047
HTTP/3: renamed ngx_http_v3_connection_t to ngx_http_v3_session_t.
Roman Arutyunyan <arut@nginx.com>
parents:
8769
diff
changeset
|
687 ngx_http_v3_session_t *h3c; |
8497 | 688 |
8768
40d710a66aef
HTTP/3: ngx_http_v3_get_session() macro.
Roman Arutyunyan <arut@nginx.com>
parents:
8767
diff
changeset
|
689 h3c = ngx_http_v3_get_session(c); |
8497 | 690 |
691 ngx_log_debug1(NGX_LOG_DEBUG_HTTP, c->log, 0, | |
692 "http3 CANCEL_PUSH:%uL", push_id); | |
693 | |
694 if (push_id >= h3c->next_push_id) { | |
695 return NGX_HTTP_V3_ERR_ID_ERROR; | |
696 } | |
697 | |
698 for (q = ngx_queue_head(&h3c->pushing); | |
699 q != ngx_queue_sentinel(&h3c->pushing); | |
700 q = ngx_queue_next(&h3c->pushing)) | |
701 { | |
702 push = (ngx_http_v3_push_t *) q; | |
703 | |
704 if (push->id != push_id) { | |
705 continue; | |
706 } | |
707 | |
708 r = push->connection->data; | |
709 | |
710 ngx_log_debug0(NGX_LOG_DEBUG_HTTP, r->connection->log, 0, | |
711 "http3 cancel push"); | |
712 | |
713 ngx_http_finalize_request(r, NGX_HTTP_CLOSE); | |
714 | |
715 break; | |
716 } | |
717 | |
718 return NGX_OK; | |
719 } | |
8767
33ec97749b5f
HTTP/3: moved Stream Cancellation stub to ngx_http_v3_streams.c.
Roman Arutyunyan <arut@nginx.com>
parents:
8725
diff
changeset
|
720 |
33ec97749b5f
HTTP/3: moved Stream Cancellation stub to ngx_http_v3_streams.c.
Roman Arutyunyan <arut@nginx.com>
parents:
8725
diff
changeset
|
721 |
33ec97749b5f
HTTP/3: moved Stream Cancellation stub to ngx_http_v3_streams.c.
Roman Arutyunyan <arut@nginx.com>
parents:
8725
diff
changeset
|
722 ngx_int_t |
33ec97749b5f
HTTP/3: moved Stream Cancellation stub to ngx_http_v3_streams.c.
Roman Arutyunyan <arut@nginx.com>
parents:
8725
diff
changeset
|
723 ngx_http_v3_cancel_stream(ngx_connection_t *c, ngx_uint_t stream_id) |
33ec97749b5f
HTTP/3: moved Stream Cancellation stub to ngx_http_v3_streams.c.
Roman Arutyunyan <arut@nginx.com>
parents:
8725
diff
changeset
|
724 { |
33ec97749b5f
HTTP/3: moved Stream Cancellation stub to ngx_http_v3_streams.c.
Roman Arutyunyan <arut@nginx.com>
parents:
8725
diff
changeset
|
725 ngx_log_debug1(NGX_LOG_DEBUG_HTTP, c->log, 0, |
33ec97749b5f
HTTP/3: moved Stream Cancellation stub to ngx_http_v3_streams.c.
Roman Arutyunyan <arut@nginx.com>
parents:
8725
diff
changeset
|
726 "http3 cancel stream %ui", stream_id); |
33ec97749b5f
HTTP/3: moved Stream Cancellation stub to ngx_http_v3_streams.c.
Roman Arutyunyan <arut@nginx.com>
parents:
8725
diff
changeset
|
727 |
33ec97749b5f
HTTP/3: moved Stream Cancellation stub to ngx_http_v3_streams.c.
Roman Arutyunyan <arut@nginx.com>
parents:
8725
diff
changeset
|
728 /* we do not use dynamic tables */ |
33ec97749b5f
HTTP/3: moved Stream Cancellation stub to ngx_http_v3_streams.c.
Roman Arutyunyan <arut@nginx.com>
parents:
8725
diff
changeset
|
729 |
33ec97749b5f
HTTP/3: moved Stream Cancellation stub to ngx_http_v3_streams.c.
Roman Arutyunyan <arut@nginx.com>
parents:
8725
diff
changeset
|
730 return NGX_OK; |
33ec97749b5f
HTTP/3: moved Stream Cancellation stub to ngx_http_v3_streams.c.
Roman Arutyunyan <arut@nginx.com>
parents:
8725
diff
changeset
|
731 } |