Mercurial > hg > nginx
annotate src/http/v3/ngx_http_v3_parse.h @ 9153:8f7e6d8c061e
QUIC: use last client dcid to receive initial packets.
Previously, original dcid was used to receive initial client packets in case
server initial response was lost. However, last dcid should be used instead.
These two are the same unless retry is used. In case of retry, client resends
initial packet with a new dcid, that is different from the original dcid. If
server response is lost, the client resends this packet again with the same
dcid. This is shown in RFC 9000, 7.3. Authenticating Connection IDs, Figure 8.
The issue manifested itself with creating multiple server sessions in response
to each post-retry client initial packet, if server response is lost.
author | Roman Arutyunyan <arut@nginx.com> |
---|---|
date | Wed, 30 Aug 2023 11:09:21 +0400 |
parents | d6e191a583cc |
children |
rev | line source |
---|---|
8226 | 1 |
2 /* | |
3 * Copyright (C) Roman Arutyunyan | |
4 * Copyright (C) Nginx, Inc. | |
5 */ | |
6 | |
7 | |
8 #ifndef _NGX_HTTP_V3_PARSE_H_INCLUDED_ | |
9 #define _NGX_HTTP_V3_PARSE_H_INCLUDED_ | |
10 | |
11 | |
12 #include <ngx_config.h> | |
13 #include <ngx_core.h> | |
14 #include <ngx_http.h> | |
15 | |
16 | |
17 typedef struct { | |
18 ngx_uint_t state; | |
19 uint64_t value; | |
20 } ngx_http_v3_parse_varlen_int_t; | |
21 | |
22 | |
23 typedef struct { | |
24 ngx_uint_t state; | |
8455
b0e81f49d7c0
HTTP/3: fixed prefixed integer encoding and decoding.
Roman Arutyunyan <arut@nginx.com>
parents:
8295
diff
changeset
|
25 ngx_uint_t shift; |
8226 | 26 uint64_t value; |
27 } ngx_http_v3_parse_prefix_int_t; | |
28 | |
29 | |
30 typedef struct { | |
31 ngx_uint_t state; | |
32 uint64_t id; | |
33 ngx_http_v3_parse_varlen_int_t vlint; | |
34 } ngx_http_v3_parse_settings_t; | |
35 | |
36 | |
37 typedef struct { | |
38 ngx_uint_t state; | |
39 ngx_uint_t insert_count; | |
40 ngx_uint_t delta_base; | |
41 ngx_uint_t sign; | |
42 ngx_uint_t base; | |
43 ngx_http_v3_parse_prefix_int_t pint; | |
8807
0ac25efb2da3
HTTP/3: quic-qpack term updates.
Sergey Kandaurov <pluknet@nginx.com>
parents:
8772
diff
changeset
|
44 } ngx_http_v3_parse_field_section_prefix_t; |
8226 | 45 |
46 | |
47 typedef struct { | |
48 ngx_uint_t state; | |
49 ngx_uint_t length; | |
50 ngx_uint_t huffman; | |
51 ngx_str_t value; | |
52 u_char *last; | |
53 u_char huffstate; | |
54 } ngx_http_v3_parse_literal_t; | |
55 | |
56 | |
57 typedef struct { | |
58 ngx_uint_t state; | |
59 ngx_uint_t index; | |
60 ngx_uint_t base; | |
61 ngx_uint_t dynamic; | |
62 | |
63 ngx_str_t name; | |
64 ngx_str_t value; | |
65 | |
66 ngx_http_v3_parse_prefix_int_t pint; | |
67 ngx_http_v3_parse_literal_t literal; | |
8807
0ac25efb2da3
HTTP/3: quic-qpack term updates.
Sergey Kandaurov <pluknet@nginx.com>
parents:
8772
diff
changeset
|
68 } ngx_http_v3_parse_field_t; |
8226 | 69 |
70 | |
71 typedef struct { | |
72 ngx_uint_t state; | |
8807
0ac25efb2da3
HTTP/3: quic-qpack term updates.
Sergey Kandaurov <pluknet@nginx.com>
parents:
8772
diff
changeset
|
73 ngx_http_v3_parse_field_t field; |
0ac25efb2da3
HTTP/3: quic-qpack term updates.
Sergey Kandaurov <pluknet@nginx.com>
parents:
8772
diff
changeset
|
74 } ngx_http_v3_parse_field_rep_t; |
8226 | 75 |
76 | |
77 typedef struct { | |
78 ngx_uint_t state; | |
8549
d70a38acaea0
HTTP/3: skip unknown frames on request stream.
Roman Arutyunyan <arut@nginx.com>
parents:
8460
diff
changeset
|
79 ngx_uint_t type; |
8226 | 80 ngx_uint_t length; |
81 ngx_http_v3_parse_varlen_int_t vlint; | |
8807
0ac25efb2da3
HTTP/3: quic-qpack term updates.
Sergey Kandaurov <pluknet@nginx.com>
parents:
8772
diff
changeset
|
82 ngx_http_v3_parse_field_section_prefix_t prefix; |
0ac25efb2da3
HTTP/3: quic-qpack term updates.
Sergey Kandaurov <pluknet@nginx.com>
parents:
8772
diff
changeset
|
83 ngx_http_v3_parse_field_rep_t field_rep; |
8226 | 84 } ngx_http_v3_parse_headers_t; |
85 | |
86 | |
87 typedef struct { | |
88 ngx_uint_t state; | |
8807
0ac25efb2da3
HTTP/3: quic-qpack term updates.
Sergey Kandaurov <pluknet@nginx.com>
parents:
8772
diff
changeset
|
89 ngx_http_v3_parse_field_t field; |
8226 | 90 ngx_http_v3_parse_prefix_int_t pint; |
91 } ngx_http_v3_parse_encoder_t; | |
92 | |
93 | |
94 typedef struct { | |
95 ngx_uint_t state; | |
96 ngx_http_v3_parse_prefix_int_t pint; | |
97 } ngx_http_v3_parse_decoder_t; | |
98 | |
99 | |
100 typedef struct { | |
101 ngx_uint_t state; | |
102 ngx_uint_t type; | |
103 ngx_uint_t length; | |
104 ngx_http_v3_parse_varlen_int_t vlint; | |
105 ngx_http_v3_parse_settings_t settings; | |
106 } ngx_http_v3_parse_control_t; | |
107 | |
108 | |
8295
5649079a41f4
Parsing HTTP/3 request body.
Roman Arutyunyan <arut@nginx.com>
parents:
8226
diff
changeset
|
109 typedef struct { |
5649079a41f4
Parsing HTTP/3 request body.
Roman Arutyunyan <arut@nginx.com>
parents:
8226
diff
changeset
|
110 ngx_uint_t state; |
8772
345370fdd32d
HTTP/3: moved parsing uni stream type to ngx_http_v3_parse.c.
Roman Arutyunyan <arut@nginx.com>
parents:
8666
diff
changeset
|
111 ngx_http_v3_parse_varlen_int_t vlint; |
345370fdd32d
HTTP/3: moved parsing uni stream type to ngx_http_v3_parse.c.
Roman Arutyunyan <arut@nginx.com>
parents:
8666
diff
changeset
|
112 union { |
345370fdd32d
HTTP/3: moved parsing uni stream type to ngx_http_v3_parse.c.
Roman Arutyunyan <arut@nginx.com>
parents:
8666
diff
changeset
|
113 ngx_http_v3_parse_encoder_t encoder; |
345370fdd32d
HTTP/3: moved parsing uni stream type to ngx_http_v3_parse.c.
Roman Arutyunyan <arut@nginx.com>
parents:
8666
diff
changeset
|
114 ngx_http_v3_parse_decoder_t decoder; |
345370fdd32d
HTTP/3: moved parsing uni stream type to ngx_http_v3_parse.c.
Roman Arutyunyan <arut@nginx.com>
parents:
8666
diff
changeset
|
115 ngx_http_v3_parse_control_t control; |
345370fdd32d
HTTP/3: moved parsing uni stream type to ngx_http_v3_parse.c.
Roman Arutyunyan <arut@nginx.com>
parents:
8666
diff
changeset
|
116 } u; |
345370fdd32d
HTTP/3: moved parsing uni stream type to ngx_http_v3_parse.c.
Roman Arutyunyan <arut@nginx.com>
parents:
8666
diff
changeset
|
117 } ngx_http_v3_parse_uni_t; |
345370fdd32d
HTTP/3: moved parsing uni stream type to ngx_http_v3_parse.c.
Roman Arutyunyan <arut@nginx.com>
parents:
8666
diff
changeset
|
118 |
345370fdd32d
HTTP/3: moved parsing uni stream type to ngx_http_v3_parse.c.
Roman Arutyunyan <arut@nginx.com>
parents:
8666
diff
changeset
|
119 |
345370fdd32d
HTTP/3: moved parsing uni stream type to ngx_http_v3_parse.c.
Roman Arutyunyan <arut@nginx.com>
parents:
8666
diff
changeset
|
120 typedef struct { |
345370fdd32d
HTTP/3: moved parsing uni stream type to ngx_http_v3_parse.c.
Roman Arutyunyan <arut@nginx.com>
parents:
8666
diff
changeset
|
121 ngx_uint_t state; |
8549
d70a38acaea0
HTTP/3: skip unknown frames on request stream.
Roman Arutyunyan <arut@nginx.com>
parents:
8460
diff
changeset
|
122 ngx_uint_t type; |
8295
5649079a41f4
Parsing HTTP/3 request body.
Roman Arutyunyan <arut@nginx.com>
parents:
8226
diff
changeset
|
123 ngx_uint_t length; |
5649079a41f4
Parsing HTTP/3 request body.
Roman Arutyunyan <arut@nginx.com>
parents:
8226
diff
changeset
|
124 ngx_http_v3_parse_varlen_int_t vlint; |
5649079a41f4
Parsing HTTP/3 request body.
Roman Arutyunyan <arut@nginx.com>
parents:
8226
diff
changeset
|
125 } ngx_http_v3_parse_data_t; |
5649079a41f4
Parsing HTTP/3 request body.
Roman Arutyunyan <arut@nginx.com>
parents:
8226
diff
changeset
|
126 |
5649079a41f4
Parsing HTTP/3 request body.
Roman Arutyunyan <arut@nginx.com>
parents:
8226
diff
changeset
|
127 |
8460
72f9ff4e0a88
HTTP/3: close QUIC connection with HTTP/QPACK errors when needed.
Roman Arutyunyan <arut@nginx.com>
parents:
8455
diff
changeset
|
128 /* |
72f9ff4e0a88
HTTP/3: close QUIC connection with HTTP/QPACK errors when needed.
Roman Arutyunyan <arut@nginx.com>
parents:
8455
diff
changeset
|
129 * Parse functions return codes: |
72f9ff4e0a88
HTTP/3: close QUIC connection with HTTP/QPACK errors when needed.
Roman Arutyunyan <arut@nginx.com>
parents:
8455
diff
changeset
|
130 * NGX_DONE - parsing done |
72f9ff4e0a88
HTTP/3: close QUIC connection with HTTP/QPACK errors when needed.
Roman Arutyunyan <arut@nginx.com>
parents:
8455
diff
changeset
|
131 * NGX_OK - sub-element done |
72f9ff4e0a88
HTTP/3: close QUIC connection with HTTP/QPACK errors when needed.
Roman Arutyunyan <arut@nginx.com>
parents:
8455
diff
changeset
|
132 * NGX_AGAIN - more data expected |
72f9ff4e0a88
HTTP/3: close QUIC connection with HTTP/QPACK errors when needed.
Roman Arutyunyan <arut@nginx.com>
parents:
8455
diff
changeset
|
133 * NGX_BUSY - waiting for external event |
72f9ff4e0a88
HTTP/3: close QUIC connection with HTTP/QPACK errors when needed.
Roman Arutyunyan <arut@nginx.com>
parents:
8455
diff
changeset
|
134 * NGX_ERROR - internal error |
72f9ff4e0a88
HTTP/3: close QUIC connection with HTTP/QPACK errors when needed.
Roman Arutyunyan <arut@nginx.com>
parents:
8455
diff
changeset
|
135 * NGX_HTTP_V3_ERROR_XXX - HTTP/3 or QPACK error |
72f9ff4e0a88
HTTP/3: close QUIC connection with HTTP/QPACK errors when needed.
Roman Arutyunyan <arut@nginx.com>
parents:
8455
diff
changeset
|
136 */ |
72f9ff4e0a88
HTTP/3: close QUIC connection with HTTP/QPACK errors when needed.
Roman Arutyunyan <arut@nginx.com>
parents:
8455
diff
changeset
|
137 |
8226 | 138 ngx_int_t ngx_http_v3_parse_headers(ngx_connection_t *c, |
8838
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8807
diff
changeset
|
139 ngx_http_v3_parse_headers_t *st, ngx_buf_t *b); |
8295
5649079a41f4
Parsing HTTP/3 request body.
Roman Arutyunyan <arut@nginx.com>
parents:
8226
diff
changeset
|
140 ngx_int_t ngx_http_v3_parse_data(ngx_connection_t *c, |
8838
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8807
diff
changeset
|
141 ngx_http_v3_parse_data_t *st, ngx_buf_t *b); |
8772
345370fdd32d
HTTP/3: moved parsing uni stream type to ngx_http_v3_parse.c.
Roman Arutyunyan <arut@nginx.com>
parents:
8666
diff
changeset
|
142 ngx_int_t ngx_http_v3_parse_uni(ngx_connection_t *c, |
8838
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8807
diff
changeset
|
143 ngx_http_v3_parse_uni_t *st, ngx_buf_t *b); |
8666
ab6aaa8e86b0
HTTP/3: staticize internal parsing functions.
Sergey Kandaurov <pluknet@nginx.com>
parents:
8549
diff
changeset
|
144 |
8226 | 145 |
146 #endif /* _NGX_HTTP_V3_PARSE_H_INCLUDED_ */ |