Mercurial > hg > nginx-quic
annotate src/http/v3/ngx_http_v3_parse.c @ 8605:4ca8035c19a4 quic
Merged with the default branch.
author | Sergey Kandaurov <pluknet@nginx.com> |
---|---|
date | Wed, 08 Sep 2021 15:53:00 +0300 |
parents | d6e191a583cc |
children | 5c86189a1c1b |
rev | line source |
---|---|
7692 | 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 | |
8088
234e9d89ff7f
HTTP/3: reject HTTP/2 frames.
Roman Arutyunyan <arut@nginx.com>
parents:
8087
diff
changeset
|
13 #define ngx_http_v3_is_v2_frame(type) \ |
234e9d89ff7f
HTTP/3: reject HTTP/2 frames.
Roman Arutyunyan <arut@nginx.com>
parents:
8087
diff
changeset
|
14 ((type) == 0x02 || (type) == 0x06 || (type) == 0x08 || (type) == 0x09) |
234e9d89ff7f
HTTP/3: reject HTTP/2 frames.
Roman Arutyunyan <arut@nginx.com>
parents:
8087
diff
changeset
|
15 |
234e9d89ff7f
HTTP/3: reject HTTP/2 frames.
Roman Arutyunyan <arut@nginx.com>
parents:
8087
diff
changeset
|
16 |
8563
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
17 static void ngx_http_v3_parse_start_local(ngx_buf_t *b, ngx_buf_t *loc, |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
18 ngx_uint_t n); |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
19 static void ngx_http_v3_parse_end_local(ngx_buf_t *b, ngx_buf_t *loc, |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
20 ngx_uint_t *n); |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
21 static ngx_int_t ngx_http_v3_parse_skip(ngx_buf_t *b, ngx_uint_t *length); |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
22 |
8259
ab6aaa8e86b0
HTTP/3: staticize internal parsing functions.
Sergey Kandaurov <pluknet@nginx.com>
parents:
8233
diff
changeset
|
23 static ngx_int_t ngx_http_v3_parse_varlen_int(ngx_connection_t *c, |
8563
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
24 ngx_http_v3_parse_varlen_int_t *st, ngx_buf_t *b); |
8259
ab6aaa8e86b0
HTTP/3: staticize internal parsing functions.
Sergey Kandaurov <pluknet@nginx.com>
parents:
8233
diff
changeset
|
25 static ngx_int_t ngx_http_v3_parse_prefix_int(ngx_connection_t *c, |
8563
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
26 ngx_http_v3_parse_prefix_int_t *st, ngx_uint_t prefix, ngx_buf_t *b); |
8259
ab6aaa8e86b0
HTTP/3: staticize internal parsing functions.
Sergey Kandaurov <pluknet@nginx.com>
parents:
8233
diff
changeset
|
27 |
8508
0ac25efb2da3
HTTP/3: quic-qpack term updates.
Sergey Kandaurov <pluknet@nginx.com>
parents:
8497
diff
changeset
|
28 static ngx_int_t ngx_http_v3_parse_field_section_prefix(ngx_connection_t *c, |
8563
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
29 ngx_http_v3_parse_field_section_prefix_t *st, ngx_buf_t *b); |
8508
0ac25efb2da3
HTTP/3: quic-qpack term updates.
Sergey Kandaurov <pluknet@nginx.com>
parents:
8497
diff
changeset
|
30 static ngx_int_t ngx_http_v3_parse_field_rep(ngx_connection_t *c, |
8563
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
31 ngx_http_v3_parse_field_rep_t *st, ngx_uint_t base, ngx_buf_t *b); |
8259
ab6aaa8e86b0
HTTP/3: staticize internal parsing functions.
Sergey Kandaurov <pluknet@nginx.com>
parents:
8233
diff
changeset
|
32 static ngx_int_t ngx_http_v3_parse_literal(ngx_connection_t *c, |
8563
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
33 ngx_http_v3_parse_literal_t *st, ngx_buf_t *b); |
8508
0ac25efb2da3
HTTP/3: quic-qpack term updates.
Sergey Kandaurov <pluknet@nginx.com>
parents:
8497
diff
changeset
|
34 static ngx_int_t ngx_http_v3_parse_field_ri(ngx_connection_t *c, |
8563
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
35 ngx_http_v3_parse_field_t *st, ngx_buf_t *b); |
8508
0ac25efb2da3
HTTP/3: quic-qpack term updates.
Sergey Kandaurov <pluknet@nginx.com>
parents:
8497
diff
changeset
|
36 static ngx_int_t ngx_http_v3_parse_field_lri(ngx_connection_t *c, |
8563
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
37 ngx_http_v3_parse_field_t *st, ngx_buf_t *b); |
8508
0ac25efb2da3
HTTP/3: quic-qpack term updates.
Sergey Kandaurov <pluknet@nginx.com>
parents:
8497
diff
changeset
|
38 static ngx_int_t ngx_http_v3_parse_field_l(ngx_connection_t *c, |
8563
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
39 ngx_http_v3_parse_field_t *st, ngx_buf_t *b); |
8508
0ac25efb2da3
HTTP/3: quic-qpack term updates.
Sergey Kandaurov <pluknet@nginx.com>
parents:
8497
diff
changeset
|
40 static ngx_int_t ngx_http_v3_parse_field_pbi(ngx_connection_t *c, |
8563
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
41 ngx_http_v3_parse_field_t *st, ngx_buf_t *b); |
8508
0ac25efb2da3
HTTP/3: quic-qpack term updates.
Sergey Kandaurov <pluknet@nginx.com>
parents:
8497
diff
changeset
|
42 static ngx_int_t ngx_http_v3_parse_field_lpbi(ngx_connection_t *c, |
8563
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
43 ngx_http_v3_parse_field_t *st, ngx_buf_t *b); |
8259
ab6aaa8e86b0
HTTP/3: staticize internal parsing functions.
Sergey Kandaurov <pluknet@nginx.com>
parents:
8233
diff
changeset
|
44 |
8432
345370fdd32d
HTTP/3: moved parsing uni stream type to ngx_http_v3_parse.c.
Roman Arutyunyan <arut@nginx.com>
parents:
8431
diff
changeset
|
45 static ngx_int_t ngx_http_v3_parse_control(ngx_connection_t *c, |
8563
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
46 ngx_http_v3_parse_control_t *st, ngx_buf_t *b); |
8432
345370fdd32d
HTTP/3: moved parsing uni stream type to ngx_http_v3_parse.c.
Roman Arutyunyan <arut@nginx.com>
parents:
8431
diff
changeset
|
47 static ngx_int_t ngx_http_v3_parse_settings(ngx_connection_t *c, |
8563
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
48 ngx_http_v3_parse_settings_t *st, ngx_buf_t *b); |
8432
345370fdd32d
HTTP/3: moved parsing uni stream type to ngx_http_v3_parse.c.
Roman Arutyunyan <arut@nginx.com>
parents:
8431
diff
changeset
|
49 |
345370fdd32d
HTTP/3: moved parsing uni stream type to ngx_http_v3_parse.c.
Roman Arutyunyan <arut@nginx.com>
parents:
8431
diff
changeset
|
50 static ngx_int_t ngx_http_v3_parse_encoder(ngx_connection_t *c, |
8563
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
51 ngx_http_v3_parse_encoder_t *st, ngx_buf_t *b); |
8508
0ac25efb2da3
HTTP/3: quic-qpack term updates.
Sergey Kandaurov <pluknet@nginx.com>
parents:
8497
diff
changeset
|
52 static ngx_int_t ngx_http_v3_parse_field_inr(ngx_connection_t *c, |
8563
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
53 ngx_http_v3_parse_field_t *st, ngx_buf_t *b); |
8508
0ac25efb2da3
HTTP/3: quic-qpack term updates.
Sergey Kandaurov <pluknet@nginx.com>
parents:
8497
diff
changeset
|
54 static ngx_int_t ngx_http_v3_parse_field_iln(ngx_connection_t *c, |
8563
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
55 ngx_http_v3_parse_field_t *st, ngx_buf_t *b); |
8259
ab6aaa8e86b0
HTTP/3: staticize internal parsing functions.
Sergey Kandaurov <pluknet@nginx.com>
parents:
8233
diff
changeset
|
56 |
8432
345370fdd32d
HTTP/3: moved parsing uni stream type to ngx_http_v3_parse.c.
Roman Arutyunyan <arut@nginx.com>
parents:
8431
diff
changeset
|
57 static ngx_int_t ngx_http_v3_parse_decoder(ngx_connection_t *c, |
8563
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
58 ngx_http_v3_parse_decoder_t *st, ngx_buf_t *b); |
8432
345370fdd32d
HTTP/3: moved parsing uni stream type to ngx_http_v3_parse.c.
Roman Arutyunyan <arut@nginx.com>
parents:
8431
diff
changeset
|
59 |
7951
c9538aef3211
HTTP/3: refactored dynamic table implementation.
Roman Arutyunyan <arut@nginx.com>
parents:
7950
diff
changeset
|
60 static ngx_int_t ngx_http_v3_parse_lookup(ngx_connection_t *c, |
c9538aef3211
HTTP/3: refactored dynamic table implementation.
Roman Arutyunyan <arut@nginx.com>
parents:
7950
diff
changeset
|
61 ngx_uint_t dynamic, ngx_uint_t index, ngx_str_t *name, ngx_str_t *value); |
c9538aef3211
HTTP/3: refactored dynamic table implementation.
Roman Arutyunyan <arut@nginx.com>
parents:
7950
diff
changeset
|
62 |
c9538aef3211
HTTP/3: refactored dynamic table implementation.
Roman Arutyunyan <arut@nginx.com>
parents:
7950
diff
changeset
|
63 |
8563
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
64 static void |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
65 ngx_http_v3_parse_start_local(ngx_buf_t *b, ngx_buf_t *loc, ngx_uint_t n) |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
66 { |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
67 *loc = *b; |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
68 |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
69 if ((size_t) (loc->last - loc->pos) > n) { |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
70 loc->last = loc->pos + n; |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
71 } |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
72 } |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
73 |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
74 |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
75 static void |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
76 ngx_http_v3_parse_end_local(ngx_buf_t *b, ngx_buf_t *loc, ngx_uint_t *pn) |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
77 { |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
78 *pn -= loc->pos - b->pos; |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
79 b->pos = loc->pos; |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
80 } |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
81 |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
82 |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
83 static ngx_int_t |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
84 ngx_http_v3_parse_skip(ngx_buf_t *b, ngx_uint_t *length) |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
85 { |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
86 if ((size_t) (b->last - b->pos) < *length) { |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
87 *length -= b->last - b->pos; |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
88 b->pos = b->last; |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
89 return NGX_AGAIN; |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
90 } |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
91 |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
92 b->pos += *length; |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
93 return NGX_DONE; |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
94 } |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
95 |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
96 |
8259
ab6aaa8e86b0
HTTP/3: staticize internal parsing functions.
Sergey Kandaurov <pluknet@nginx.com>
parents:
8233
diff
changeset
|
97 static ngx_int_t |
7692 | 98 ngx_http_v3_parse_varlen_int(ngx_connection_t *c, |
8563
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
99 ngx_http_v3_parse_varlen_int_t *st, ngx_buf_t *b) |
7692 | 100 { |
8563
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
101 u_char ch; |
7692 | 102 enum { |
103 sw_start = 0, | |
104 sw_length_2, | |
105 sw_length_3, | |
106 sw_length_4, | |
107 sw_length_5, | |
108 sw_length_6, | |
109 sw_length_7, | |
110 sw_length_8 | |
111 }; | |
112 | |
8563
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
113 for ( ;; ) { |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
114 |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
115 if (b->pos == b->last) { |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
116 return NGX_AGAIN; |
7692 | 117 } |
118 | |
8563
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
119 ch = *b->pos++; |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
120 |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
121 switch (st->state) { |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
122 |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
123 case sw_start: |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
124 |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
125 st->value = ch; |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
126 if (st->value & 0xc0) { |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
127 st->state = sw_length_2; |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
128 break; |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
129 } |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
130 |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
131 goto done; |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
132 |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
133 case sw_length_2: |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
134 |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
135 st->value = (st->value << 8) + ch; |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
136 if ((st->value & 0xc000) == 0x4000) { |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
137 st->value &= 0x3fff; |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
138 goto done; |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
139 } |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
140 |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
141 st->state = sw_length_3; |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
142 break; |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
143 |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
144 case sw_length_4: |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
145 |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
146 st->value = (st->value << 8) + ch; |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
147 if ((st->value & 0xc0000000) == 0x80000000) { |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
148 st->value &= 0x3fffffff; |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
149 goto done; |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
150 } |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
151 |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
152 st->state = sw_length_5; |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
153 break; |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
154 |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
155 case sw_length_3: |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
156 case sw_length_5: |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
157 case sw_length_6: |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
158 case sw_length_7: |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
159 |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
160 st->value = (st->value << 8) + ch; |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
161 st->state++; |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
162 break; |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
163 |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
164 case sw_length_8: |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
165 |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
166 st->value = (st->value << 8) + ch; |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
167 st->value &= 0x3fffffffffffffff; |
7692 | 168 goto done; |
169 } | |
170 } | |
171 | |
172 done: | |
173 | |
174 ngx_log_debug1(NGX_LOG_DEBUG_HTTP, c->log, 0, | |
175 "http3 parse varlen int %uL", st->value); | |
176 | |
177 st->state = sw_start; | |
178 return NGX_DONE; | |
179 } | |
180 | |
181 | |
8259
ab6aaa8e86b0
HTTP/3: staticize internal parsing functions.
Sergey Kandaurov <pluknet@nginx.com>
parents:
8233
diff
changeset
|
182 static ngx_int_t |
7692 | 183 ngx_http_v3_parse_prefix_int(ngx_connection_t *c, |
8563
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
184 ngx_http_v3_parse_prefix_int_t *st, ngx_uint_t prefix, ngx_buf_t *b) |
7692 | 185 { |
8563
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
186 u_char ch; |
7950
b0e81f49d7c0
HTTP/3: fixed prefixed integer encoding and decoding.
Roman Arutyunyan <arut@nginx.com>
parents:
7949
diff
changeset
|
187 ngx_uint_t mask; |
7692 | 188 enum { |
189 sw_start = 0, | |
190 sw_value | |
191 }; | |
192 | |
8563
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
193 for ( ;; ) { |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
194 |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
195 if (b->pos == b->last) { |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
196 return NGX_AGAIN; |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
197 } |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
198 |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
199 ch = *b->pos++; |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
200 |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
201 switch (st->state) { |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
202 |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
203 case sw_start: |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
204 |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
205 mask = (1 << prefix) - 1; |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
206 st->value = ch & mask; |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
207 |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
208 if (st->value != mask) { |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
209 goto done; |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
210 } |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
211 |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
212 st->shift = 0; |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
213 st->state = sw_value; |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
214 break; |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
215 |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
216 case sw_value: |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
217 |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
218 st->value += (uint64_t) (ch & 0x7f) << st->shift; |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
219 |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
220 if (st->shift == 56 |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
221 && ((ch & 0x80) || (st->value & 0xc000000000000000))) |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
222 { |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
223 ngx_log_error(NGX_LOG_INFO, c->log, 0, |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
224 "client exceeded integer size limit"); |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
225 return NGX_HTTP_V3_ERR_EXCESSIVE_LOAD; |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
226 } |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
227 |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
228 if (ch & 0x80) { |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
229 st->shift += 7; |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
230 break; |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
231 } |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
232 |
7692 | 233 goto done; |
234 } | |
235 } | |
236 | |
237 done: | |
238 | |
239 ngx_log_debug1(NGX_LOG_DEBUG_HTTP, c->log, 0, | |
240 "http3 parse prefix int %uL", st->value); | |
241 | |
242 st->state = sw_start; | |
243 return NGX_DONE; | |
244 } | |
245 | |
246 | |
247 ngx_int_t | |
248 ngx_http_v3_parse_headers(ngx_connection_t *c, ngx_http_v3_parse_headers_t *st, | |
8563
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
249 ngx_buf_t *b) |
7692 | 250 { |
8563
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
251 ngx_buf_t loc; |
7692 | 252 ngx_int_t rc; |
253 enum { | |
254 sw_start = 0, | |
8087
d70a38acaea0
HTTP/3: skip unknown frames on request stream.
Roman Arutyunyan <arut@nginx.com>
parents:
8015
diff
changeset
|
255 sw_type, |
7692 | 256 sw_length, |
8087
d70a38acaea0
HTTP/3: skip unknown frames on request stream.
Roman Arutyunyan <arut@nginx.com>
parents:
8015
diff
changeset
|
257 sw_skip, |
7692 | 258 sw_prefix, |
7951
c9538aef3211
HTTP/3: refactored dynamic table implementation.
Roman Arutyunyan <arut@nginx.com>
parents:
7950
diff
changeset
|
259 sw_verify, |
8508
0ac25efb2da3
HTTP/3: quic-qpack term updates.
Sergey Kandaurov <pluknet@nginx.com>
parents:
8497
diff
changeset
|
260 sw_field_rep, |
7692 | 261 sw_done |
262 }; | |
263 | |
8563
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
264 for ( ;; ) { |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
265 |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
266 switch (st->state) { |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
267 |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
268 case sw_start: |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
269 |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
270 ngx_log_debug0(NGX_LOG_DEBUG_HTTP, c->log, 0, |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
271 "http3 parse headers"); |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
272 |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
273 st->state = sw_type; |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
274 |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
275 /* fall through */ |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
276 |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
277 case sw_type: |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
278 |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
279 rc = ngx_http_v3_parse_varlen_int(c, &st->vlint, b); |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
280 if (rc != NGX_DONE) { |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
281 return rc; |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
282 } |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
283 |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
284 st->type = st->vlint.value; |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
285 |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
286 if (ngx_http_v3_is_v2_frame(st->type) |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
287 || st->type == NGX_HTTP_V3_FRAME_DATA |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
288 || st->type == NGX_HTTP_V3_FRAME_GOAWAY |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
289 || st->type == NGX_HTTP_V3_FRAME_SETTINGS |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
290 || st->type == NGX_HTTP_V3_FRAME_MAX_PUSH_ID |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
291 || st->type == NGX_HTTP_V3_FRAME_CANCEL_PUSH |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
292 || st->type == NGX_HTTP_V3_FRAME_PUSH_PROMISE) |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
293 { |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
294 return NGX_HTTP_V3_ERR_FRAME_UNEXPECTED; |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
295 } |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
296 |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
297 st->state = sw_length; |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
298 break; |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
299 |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
300 case sw_length: |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
301 |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
302 rc = ngx_http_v3_parse_varlen_int(c, &st->vlint, b); |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
303 if (rc != NGX_DONE) { |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
304 return rc; |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
305 } |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
306 |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
307 st->length = st->vlint.value; |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
308 |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
309 ngx_log_debug2(NGX_LOG_DEBUG_HTTP, c->log, 0, |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
310 "http3 parse headers type:%ui, len:%ui", |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
311 st->type, st->length); |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
312 |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
313 if (st->type != NGX_HTTP_V3_FRAME_HEADERS) { |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
314 st->state = st->length > 0 ? sw_skip : sw_type; |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
315 break; |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
316 } |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
317 |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
318 if (st->length == 0) { |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
319 return NGX_HTTP_V3_ERR_FRAME_ERROR; |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
320 } |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
321 |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
322 st->state = sw_prefix; |
8087
d70a38acaea0
HTTP/3: skip unknown frames on request stream.
Roman Arutyunyan <arut@nginx.com>
parents:
8015
diff
changeset
|
323 break; |
8563
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
324 |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
325 case sw_skip: |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
326 |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
327 rc = ngx_http_v3_parse_skip(b, &st->length); |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
328 if (rc != NGX_DONE) { |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
329 return rc; |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
330 } |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
331 |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
332 st->state = sw_type; |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
333 break; |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
334 |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
335 case sw_prefix: |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
336 |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
337 ngx_http_v3_parse_start_local(b, &loc, st->length); |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
338 |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
339 rc = ngx_http_v3_parse_field_section_prefix(c, &st->prefix, &loc); |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
340 |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
341 ngx_http_v3_parse_end_local(b, &loc, &st->length); |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
342 |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
343 if (st->length == 0 && rc == NGX_AGAIN) { |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
344 return NGX_HTTP_V3_ERR_FRAME_ERROR; |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
345 } |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
346 |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
347 if (rc != NGX_DONE) { |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
348 return rc; |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
349 } |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
350 |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
351 st->state = sw_verify; |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
352 break; |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
353 |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
354 case sw_verify: |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
355 |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
356 rc = ngx_http_v3_check_insert_count(c, st->prefix.insert_count); |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
357 if (rc != NGX_OK) { |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
358 return rc; |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
359 } |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
360 |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
361 st->state = sw_field_rep; |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
362 |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
363 /* fall through */ |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
364 |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
365 case sw_field_rep: |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
366 |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
367 ngx_http_v3_parse_start_local(b, &loc, st->length); |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
368 |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
369 rc = ngx_http_v3_parse_field_rep(c, &st->field_rep, st->prefix.base, |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
370 &loc); |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
371 |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
372 ngx_http_v3_parse_end_local(b, &loc, &st->length); |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
373 |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
374 if (st->length == 0 && rc == NGX_AGAIN) { |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
375 return NGX_HTTP_V3_ERR_FRAME_ERROR; |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
376 } |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
377 |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
378 if (rc != NGX_DONE) { |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
379 return rc; |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
380 } |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
381 |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
382 if (st->length == 0) { |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
383 goto done; |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
384 } |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
385 |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
386 return NGX_OK; |
8090
351d62300832
HTTP/3: rearranged length check when parsing header.
Roman Arutyunyan <arut@nginx.com>
parents:
8088
diff
changeset
|
387 } |
7692 | 388 } |
389 | |
390 done: | |
391 | |
392 ngx_log_debug0(NGX_LOG_DEBUG_HTTP, c->log, 0, "http3 parse headers done"); | |
393 | |
7951
c9538aef3211
HTTP/3: refactored dynamic table implementation.
Roman Arutyunyan <arut@nginx.com>
parents:
7950
diff
changeset
|
394 if (st->prefix.insert_count > 0) { |
8508
0ac25efb2da3
HTTP/3: quic-qpack term updates.
Sergey Kandaurov <pluknet@nginx.com>
parents:
8497
diff
changeset
|
395 if (ngx_http_v3_send_ack_section(c, c->quic->id) != NGX_OK) { |
7951
c9538aef3211
HTTP/3: refactored dynamic table implementation.
Roman Arutyunyan <arut@nginx.com>
parents:
7950
diff
changeset
|
396 return NGX_ERROR; |
c9538aef3211
HTTP/3: refactored dynamic table implementation.
Roman Arutyunyan <arut@nginx.com>
parents:
7950
diff
changeset
|
397 } |
c9538aef3211
HTTP/3: refactored dynamic table implementation.
Roman Arutyunyan <arut@nginx.com>
parents:
7950
diff
changeset
|
398 } |
c9538aef3211
HTTP/3: refactored dynamic table implementation.
Roman Arutyunyan <arut@nginx.com>
parents:
7950
diff
changeset
|
399 |
7692 | 400 st->state = sw_start; |
401 return NGX_DONE; | |
402 } | |
403 | |
404 | |
8259
ab6aaa8e86b0
HTTP/3: staticize internal parsing functions.
Sergey Kandaurov <pluknet@nginx.com>
parents:
8233
diff
changeset
|
405 static ngx_int_t |
8508
0ac25efb2da3
HTTP/3: quic-qpack term updates.
Sergey Kandaurov <pluknet@nginx.com>
parents:
8497
diff
changeset
|
406 ngx_http_v3_parse_field_section_prefix(ngx_connection_t *c, |
8563
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
407 ngx_http_v3_parse_field_section_prefix_t *st, ngx_buf_t *b) |
7692 | 408 { |
8563
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
409 u_char ch; |
7955
72f9ff4e0a88
HTTP/3: close QUIC connection with HTTP/QPACK errors when needed.
Roman Arutyunyan <arut@nginx.com>
parents:
7952
diff
changeset
|
410 ngx_int_t rc; |
7692 | 411 enum { |
412 sw_start = 0, | |
413 sw_req_insert_count, | |
414 sw_delta_base, | |
415 sw_read_delta_base | |
416 }; | |
417 | |
8563
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
418 for ( ;; ) { |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
419 |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
420 switch (st->state) { |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
421 |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
422 case sw_start: |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
423 |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
424 ngx_log_debug0(NGX_LOG_DEBUG_HTTP, c->log, 0, |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
425 "http3 parse field section prefix"); |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
426 |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
427 st->state = sw_req_insert_count; |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
428 |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
429 /* fall through */ |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
430 |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
431 case sw_req_insert_count: |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
432 |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
433 rc = ngx_http_v3_parse_prefix_int(c, &st->pint, 8, b); |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
434 if (rc != NGX_DONE) { |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
435 return rc; |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
436 } |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
437 |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
438 st->insert_count = st->pint.value; |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
439 st->state = sw_delta_base; |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
440 break; |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
441 |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
442 case sw_delta_base: |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
443 |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
444 if (b->pos == b->last) { |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
445 return NGX_AGAIN; |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
446 } |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
447 |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
448 ch = *b->pos; |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
449 |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
450 st->sign = (ch & 0x80) ? 1 : 0; |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
451 st->state = sw_read_delta_base; |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
452 |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
453 /* fall through */ |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
454 |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
455 case sw_read_delta_base: |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
456 |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
457 rc = ngx_http_v3_parse_prefix_int(c, &st->pint, 7, b); |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
458 if (rc != NGX_DONE) { |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
459 return rc; |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
460 } |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
461 |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
462 st->delta_base = st->pint.value; |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
463 goto done; |
7692 | 464 } |
465 } | |
466 | |
467 done: | |
468 | |
7955
72f9ff4e0a88
HTTP/3: close QUIC connection with HTTP/QPACK errors when needed.
Roman Arutyunyan <arut@nginx.com>
parents:
7952
diff
changeset
|
469 rc = ngx_http_v3_decode_insert_count(c, &st->insert_count); |
72f9ff4e0a88
HTTP/3: close QUIC connection with HTTP/QPACK errors when needed.
Roman Arutyunyan <arut@nginx.com>
parents:
7952
diff
changeset
|
470 if (rc != NGX_OK) { |
72f9ff4e0a88
HTTP/3: close QUIC connection with HTTP/QPACK errors when needed.
Roman Arutyunyan <arut@nginx.com>
parents:
7952
diff
changeset
|
471 return rc; |
7951
c9538aef3211
HTTP/3: refactored dynamic table implementation.
Roman Arutyunyan <arut@nginx.com>
parents:
7950
diff
changeset
|
472 } |
c9538aef3211
HTTP/3: refactored dynamic table implementation.
Roman Arutyunyan <arut@nginx.com>
parents:
7950
diff
changeset
|
473 |
7692 | 474 if (st->sign) { |
475 st->base = st->insert_count - st->delta_base - 1; | |
476 } else { | |
477 st->base = st->insert_count + st->delta_base; | |
478 } | |
479 | |
480 ngx_log_debug4(NGX_LOG_DEBUG_HTTP, c->log, 0, | |
8508
0ac25efb2da3
HTTP/3: quic-qpack term updates.
Sergey Kandaurov <pluknet@nginx.com>
parents:
8497
diff
changeset
|
481 "http3 parse field section prefix done " |
7996
d2f716e668e8
Fixed format specifiers.
Sergey Kandaurov <pluknet@nginx.com>
parents:
7962
diff
changeset
|
482 "insert_count:%ui, sign:%ui, delta_base:%ui, base:%ui", |
7692 | 483 st->insert_count, st->sign, st->delta_base, st->base); |
484 | |
485 st->state = sw_start; | |
486 return NGX_DONE; | |
487 } | |
488 | |
489 | |
8259
ab6aaa8e86b0
HTTP/3: staticize internal parsing functions.
Sergey Kandaurov <pluknet@nginx.com>
parents:
8233
diff
changeset
|
490 static ngx_int_t |
8508
0ac25efb2da3
HTTP/3: quic-qpack term updates.
Sergey Kandaurov <pluknet@nginx.com>
parents:
8497
diff
changeset
|
491 ngx_http_v3_parse_field_rep(ngx_connection_t *c, |
8563
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
492 ngx_http_v3_parse_field_rep_t *st, ngx_uint_t base, ngx_buf_t *b) |
7692 | 493 { |
8563
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
494 u_char ch; |
7692 | 495 ngx_int_t rc; |
496 enum { | |
497 sw_start = 0, | |
8508
0ac25efb2da3
HTTP/3: quic-qpack term updates.
Sergey Kandaurov <pluknet@nginx.com>
parents:
8497
diff
changeset
|
498 sw_field_ri, |
0ac25efb2da3
HTTP/3: quic-qpack term updates.
Sergey Kandaurov <pluknet@nginx.com>
parents:
8497
diff
changeset
|
499 sw_field_lri, |
0ac25efb2da3
HTTP/3: quic-qpack term updates.
Sergey Kandaurov <pluknet@nginx.com>
parents:
8497
diff
changeset
|
500 sw_field_l, |
0ac25efb2da3
HTTP/3: quic-qpack term updates.
Sergey Kandaurov <pluknet@nginx.com>
parents:
8497
diff
changeset
|
501 sw_field_pbi, |
0ac25efb2da3
HTTP/3: quic-qpack term updates.
Sergey Kandaurov <pluknet@nginx.com>
parents:
8497
diff
changeset
|
502 sw_field_lpbi |
7692 | 503 }; |
504 | |
505 if (st->state == sw_start) { | |
506 | |
507 ngx_log_debug0(NGX_LOG_DEBUG_HTTP, c->log, 0, | |
8508
0ac25efb2da3
HTTP/3: quic-qpack term updates.
Sergey Kandaurov <pluknet@nginx.com>
parents:
8497
diff
changeset
|
508 "http3 parse field representation"); |
7692 | 509 |
8563
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
510 if (b->pos == b->last) { |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
511 return NGX_AGAIN; |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
512 } |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
513 |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
514 ch = *b->pos; |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
515 |
8508
0ac25efb2da3
HTTP/3: quic-qpack term updates.
Sergey Kandaurov <pluknet@nginx.com>
parents:
8497
diff
changeset
|
516 ngx_memzero(&st->field, sizeof(ngx_http_v3_parse_field_t)); |
7692 | 517 |
8508
0ac25efb2da3
HTTP/3: quic-qpack term updates.
Sergey Kandaurov <pluknet@nginx.com>
parents:
8497
diff
changeset
|
518 st->field.base = base; |
7692 | 519 |
520 if (ch & 0x80) { | |
8508
0ac25efb2da3
HTTP/3: quic-qpack term updates.
Sergey Kandaurov <pluknet@nginx.com>
parents:
8497
diff
changeset
|
521 /* Indexed Field Line */ |
7692 | 522 |
8508
0ac25efb2da3
HTTP/3: quic-qpack term updates.
Sergey Kandaurov <pluknet@nginx.com>
parents:
8497
diff
changeset
|
523 st->state = sw_field_ri; |
7692 | 524 |
525 } else if (ch & 0x40) { | |
8508
0ac25efb2da3
HTTP/3: quic-qpack term updates.
Sergey Kandaurov <pluknet@nginx.com>
parents:
8497
diff
changeset
|
526 /* Literal Field Line With Name Reference */ |
7692 | 527 |
8508
0ac25efb2da3
HTTP/3: quic-qpack term updates.
Sergey Kandaurov <pluknet@nginx.com>
parents:
8497
diff
changeset
|
528 st->state = sw_field_lri; |
7692 | 529 |
530 } else if (ch & 0x20) { | |
8508
0ac25efb2da3
HTTP/3: quic-qpack term updates.
Sergey Kandaurov <pluknet@nginx.com>
parents:
8497
diff
changeset
|
531 /* Literal Field Line With Literal Name */ |
7692 | 532 |
8508
0ac25efb2da3
HTTP/3: quic-qpack term updates.
Sergey Kandaurov <pluknet@nginx.com>
parents:
8497
diff
changeset
|
533 st->state = sw_field_l; |
7692 | 534 |
535 } else if (ch & 0x10) { | |
8508
0ac25efb2da3
HTTP/3: quic-qpack term updates.
Sergey Kandaurov <pluknet@nginx.com>
parents:
8497
diff
changeset
|
536 /* Indexed Field Line With Post-Base Index */ |
7692 | 537 |
8508
0ac25efb2da3
HTTP/3: quic-qpack term updates.
Sergey Kandaurov <pluknet@nginx.com>
parents:
8497
diff
changeset
|
538 st->state = sw_field_pbi; |
7692 | 539 |
540 } else { | |
8508
0ac25efb2da3
HTTP/3: quic-qpack term updates.
Sergey Kandaurov <pluknet@nginx.com>
parents:
8497
diff
changeset
|
541 /* Literal Field Line With Post-Base Name Reference */ |
7692 | 542 |
8508
0ac25efb2da3
HTTP/3: quic-qpack term updates.
Sergey Kandaurov <pluknet@nginx.com>
parents:
8497
diff
changeset
|
543 st->state = sw_field_lpbi; |
7692 | 544 } |
545 } | |
546 | |
547 switch (st->state) { | |
548 | |
8508
0ac25efb2da3
HTTP/3: quic-qpack term updates.
Sergey Kandaurov <pluknet@nginx.com>
parents:
8497
diff
changeset
|
549 case sw_field_ri: |
8563
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
550 rc = ngx_http_v3_parse_field_ri(c, &st->field, b); |
7692 | 551 break; |
552 | |
8508
0ac25efb2da3
HTTP/3: quic-qpack term updates.
Sergey Kandaurov <pluknet@nginx.com>
parents:
8497
diff
changeset
|
553 case sw_field_lri: |
8563
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
554 rc = ngx_http_v3_parse_field_lri(c, &st->field, b); |
7692 | 555 break; |
556 | |
8508
0ac25efb2da3
HTTP/3: quic-qpack term updates.
Sergey Kandaurov <pluknet@nginx.com>
parents:
8497
diff
changeset
|
557 case sw_field_l: |
8563
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
558 rc = ngx_http_v3_parse_field_l(c, &st->field, b); |
7692 | 559 break; |
560 | |
8508
0ac25efb2da3
HTTP/3: quic-qpack term updates.
Sergey Kandaurov <pluknet@nginx.com>
parents:
8497
diff
changeset
|
561 case sw_field_pbi: |
8563
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
562 rc = ngx_http_v3_parse_field_pbi(c, &st->field, b); |
7692 | 563 break; |
564 | |
8508
0ac25efb2da3
HTTP/3: quic-qpack term updates.
Sergey Kandaurov <pluknet@nginx.com>
parents:
8497
diff
changeset
|
565 case sw_field_lpbi: |
8563
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
566 rc = ngx_http_v3_parse_field_lpbi(c, &st->field, b); |
7692 | 567 break; |
568 | |
569 default: | |
570 rc = NGX_OK; | |
571 } | |
572 | |
7955
72f9ff4e0a88
HTTP/3: close QUIC connection with HTTP/QPACK errors when needed.
Roman Arutyunyan <arut@nginx.com>
parents:
7952
diff
changeset
|
573 if (rc != NGX_DONE) { |
72f9ff4e0a88
HTTP/3: close QUIC connection with HTTP/QPACK errors when needed.
Roman Arutyunyan <arut@nginx.com>
parents:
7952
diff
changeset
|
574 return rc; |
7692 | 575 } |
576 | |
577 ngx_log_debug0(NGX_LOG_DEBUG_HTTP, c->log, 0, | |
8508
0ac25efb2da3
HTTP/3: quic-qpack term updates.
Sergey Kandaurov <pluknet@nginx.com>
parents:
8497
diff
changeset
|
578 "http3 parse field representation done"); |
7692 | 579 |
580 st->state = sw_start; | |
581 return NGX_DONE; | |
582 } | |
583 | |
584 | |
8259
ab6aaa8e86b0
HTTP/3: staticize internal parsing functions.
Sergey Kandaurov <pluknet@nginx.com>
parents:
8233
diff
changeset
|
585 static ngx_int_t |
7692 | 586 ngx_http_v3_parse_literal(ngx_connection_t *c, ngx_http_v3_parse_literal_t *st, |
8563
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
587 ngx_buf_t *b) |
7692 | 588 { |
8563
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
589 u_char ch; |
8317
ae2e68f206f9
HTTP/3: removed http3_max_field_size.
Roman Arutyunyan <arut@nginx.com>
parents:
8259
diff
changeset
|
590 ngx_uint_t n; |
ae2e68f206f9
HTTP/3: removed http3_max_field_size.
Roman Arutyunyan <arut@nginx.com>
parents:
8259
diff
changeset
|
591 ngx_http_core_srv_conf_t *cscf; |
7692 | 592 enum { |
593 sw_start = 0, | |
594 sw_value | |
595 }; | |
596 | |
8563
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
597 for ( ;; ) { |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
598 |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
599 switch (st->state) { |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
600 |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
601 case sw_start: |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
602 |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
603 ngx_log_debug2(NGX_LOG_DEBUG_HTTP, c->log, 0, |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
604 "http3 parse literal huff:%ui, len:%ui", |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
605 st->huffman, st->length); |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
606 |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
607 n = st->length; |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
608 |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
609 cscf = ngx_http_v3_get_module_srv_conf(c, ngx_http_core_module); |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
610 |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
611 if (n > cscf->large_client_header_buffers.size) { |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
612 ngx_log_error(NGX_LOG_INFO, c->log, 0, |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
613 "client sent too large field line"); |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
614 return NGX_HTTP_V3_ERR_EXCESSIVE_LOAD; |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
615 } |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
616 |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
617 if (st->huffman) { |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
618 n = n * 8 / 5; |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
619 st->huffstate = 0; |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
620 } |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
621 |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
622 st->last = ngx_pnalloc(c->pool, n + 1); |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
623 if (st->last == NULL) { |
7692 | 624 return NGX_ERROR; |
625 } | |
626 | |
8563
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
627 st->value.data = st->last; |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
628 st->state = sw_value; |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
629 |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
630 /* fall through */ |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
631 |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
632 case sw_value: |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
633 |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
634 if (b->pos == b->last) { |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
635 return NGX_AGAIN; |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
636 } |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
637 |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
638 ch = *b->pos++; |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
639 |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
640 if (st->huffman) { |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
641 if (ngx_http_v2_huff_decode(&st->huffstate, &ch, 1, &st->last, |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
642 st->length == 1, c->log) |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
643 != NGX_OK) |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
644 { |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
645 return NGX_ERROR; |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
646 } |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
647 |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
648 } else { |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
649 *st->last++ = ch; |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
650 } |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
651 |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
652 if (--st->length) { |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
653 break; |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
654 } |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
655 |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
656 st->value.len = st->last - st->value.data; |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
657 *st->last = '\0'; |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
658 goto done; |
7692 | 659 } |
660 } | |
661 | |
662 done: | |
663 | |
664 ngx_log_debug1(NGX_LOG_DEBUG_HTTP, c->log, 0, | |
665 "http3 parse literal done \"%V\"", &st->value); | |
666 | |
667 st->state = sw_start; | |
668 return NGX_DONE; | |
669 } | |
670 | |
671 | |
8259
ab6aaa8e86b0
HTTP/3: staticize internal parsing functions.
Sergey Kandaurov <pluknet@nginx.com>
parents:
8233
diff
changeset
|
672 static ngx_int_t |
8508
0ac25efb2da3
HTTP/3: quic-qpack term updates.
Sergey Kandaurov <pluknet@nginx.com>
parents:
8497
diff
changeset
|
673 ngx_http_v3_parse_field_ri(ngx_connection_t *c, ngx_http_v3_parse_field_t *st, |
8563
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
674 ngx_buf_t *b) |
7692 | 675 { |
8563
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
676 u_char ch; |
7955
72f9ff4e0a88
HTTP/3: close QUIC connection with HTTP/QPACK errors when needed.
Roman Arutyunyan <arut@nginx.com>
parents:
7952
diff
changeset
|
677 ngx_int_t rc; |
7692 | 678 enum { |
679 sw_start = 0, | |
680 sw_index | |
681 }; | |
682 | |
8563
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
683 for ( ;; ) { |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
684 |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
685 switch (st->state) { |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
686 |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
687 case sw_start: |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
688 |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
689 ngx_log_debug0(NGX_LOG_DEBUG_HTTP, c->log, 0, |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
690 "http3 parse field ri"); |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
691 |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
692 if (b->pos == b->last) { |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
693 return NGX_AGAIN; |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
694 } |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
695 |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
696 ch = *b->pos; |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
697 |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
698 st->dynamic = (ch & 0x40) ? 0 : 1; |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
699 st->state = sw_index; |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
700 |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
701 /* fall through */ |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
702 |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
703 case sw_index: |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
704 |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
705 rc = ngx_http_v3_parse_prefix_int(c, &st->pint, 6, b); |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
706 if (rc != NGX_DONE) { |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
707 return rc; |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
708 } |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
709 |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
710 st->index = st->pint.value; |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
711 goto done; |
7692 | 712 } |
713 } | |
714 | |
715 done: | |
716 | |
717 ngx_log_debug2(NGX_LOG_DEBUG_HTTP, c->log, 0, | |
8508
0ac25efb2da3
HTTP/3: quic-qpack term updates.
Sergey Kandaurov <pluknet@nginx.com>
parents:
8497
diff
changeset
|
718 "http3 parse field ri done %s%ui]", |
7692 | 719 st->dynamic ? "dynamic[-" : "static[", st->index); |
720 | |
721 if (st->dynamic) { | |
722 st->index = st->base - st->index - 1; | |
723 } | |
724 | |
7955
72f9ff4e0a88
HTTP/3: close QUIC connection with HTTP/QPACK errors when needed.
Roman Arutyunyan <arut@nginx.com>
parents:
7952
diff
changeset
|
725 rc = ngx_http_v3_parse_lookup(c, st->dynamic, st->index, &st->name, |
72f9ff4e0a88
HTTP/3: close QUIC connection with HTTP/QPACK errors when needed.
Roman Arutyunyan <arut@nginx.com>
parents:
7952
diff
changeset
|
726 &st->value); |
72f9ff4e0a88
HTTP/3: close QUIC connection with HTTP/QPACK errors when needed.
Roman Arutyunyan <arut@nginx.com>
parents:
7952
diff
changeset
|
727 if (rc != NGX_OK) { |
72f9ff4e0a88
HTTP/3: close QUIC connection with HTTP/QPACK errors when needed.
Roman Arutyunyan <arut@nginx.com>
parents:
7952
diff
changeset
|
728 return rc; |
7692 | 729 } |
730 | |
731 st->state = sw_start; | |
732 return NGX_DONE; | |
733 } | |
734 | |
735 | |
8259
ab6aaa8e86b0
HTTP/3: staticize internal parsing functions.
Sergey Kandaurov <pluknet@nginx.com>
parents:
8233
diff
changeset
|
736 static ngx_int_t |
8508
0ac25efb2da3
HTTP/3: quic-qpack term updates.
Sergey Kandaurov <pluknet@nginx.com>
parents:
8497
diff
changeset
|
737 ngx_http_v3_parse_field_lri(ngx_connection_t *c, |
8563
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
738 ngx_http_v3_parse_field_t *st, ngx_buf_t *b) |
7692 | 739 { |
8563
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
740 u_char ch; |
7951
c9538aef3211
HTTP/3: refactored dynamic table implementation.
Roman Arutyunyan <arut@nginx.com>
parents:
7950
diff
changeset
|
741 ngx_int_t rc; |
7692 | 742 enum { |
743 sw_start = 0, | |
744 sw_index, | |
745 sw_value_len, | |
746 sw_read_value_len, | |
747 sw_value | |
748 }; | |
749 | |
8563
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
750 for ( ;; ) { |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
751 |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
752 switch (st->state) { |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
753 |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
754 case sw_start: |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
755 |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
756 ngx_log_debug0(NGX_LOG_DEBUG_HTTP, c->log, 0, |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
757 "http3 parse field lri"); |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
758 |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
759 if (b->pos == b->last) { |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
760 return NGX_AGAIN; |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
761 } |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
762 |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
763 ch = *b->pos; |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
764 |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
765 st->dynamic = (ch & 0x10) ? 0 : 1; |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
766 st->state = sw_index; |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
767 |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
768 /* fall through */ |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
769 |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
770 case sw_index: |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
771 |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
772 rc = ngx_http_v3_parse_prefix_int(c, &st->pint, 4, b); |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
773 if (rc != NGX_DONE) { |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
774 return rc; |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
775 } |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
776 |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
777 st->index = st->pint.value; |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
778 st->state = sw_value_len; |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
779 break; |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
780 |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
781 case sw_value_len: |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
782 |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
783 if (b->pos == b->last) { |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
784 return NGX_AGAIN; |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
785 } |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
786 |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
787 ch = *b->pos; |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
788 |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
789 st->literal.huffman = (ch & 0x80) ? 1 : 0; |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
790 st->state = sw_read_value_len; |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
791 |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
792 /* fall through */ |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
793 |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
794 case sw_read_value_len: |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
795 |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
796 rc = ngx_http_v3_parse_prefix_int(c, &st->pint, 7, b); |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
797 if (rc != NGX_DONE) { |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
798 return rc; |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
799 } |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
800 |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
801 st->literal.length = st->pint.value; |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
802 if (st->literal.length == 0) { |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
803 goto done; |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
804 } |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
805 |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
806 st->state = sw_value; |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
807 break; |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
808 |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
809 case sw_value: |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
810 |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
811 rc = ngx_http_v3_parse_literal(c, &st->literal, b); |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
812 if (rc != NGX_DONE) { |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
813 return rc; |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
814 } |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
815 |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
816 st->value = st->literal.value; |
7692 | 817 goto done; |
818 } | |
819 } | |
820 | |
821 done: | |
822 | |
823 ngx_log_debug3(NGX_LOG_DEBUG_HTTP, c->log, 0, | |
8508
0ac25efb2da3
HTTP/3: quic-qpack term updates.
Sergey Kandaurov <pluknet@nginx.com>
parents:
8497
diff
changeset
|
824 "http3 parse field lri done %s%ui] \"%V\"", |
7692 | 825 st->dynamic ? "dynamic[-" : "static[", |
826 st->index, &st->value); | |
827 | |
828 if (st->dynamic) { | |
829 st->index = st->base - st->index - 1; | |
830 } | |
831 | |
7955
72f9ff4e0a88
HTTP/3: close QUIC connection with HTTP/QPACK errors when needed.
Roman Arutyunyan <arut@nginx.com>
parents:
7952
diff
changeset
|
832 rc = ngx_http_v3_parse_lookup(c, st->dynamic, st->index, &st->name, NULL); |
72f9ff4e0a88
HTTP/3: close QUIC connection with HTTP/QPACK errors when needed.
Roman Arutyunyan <arut@nginx.com>
parents:
7952
diff
changeset
|
833 if (rc != NGX_OK) { |
72f9ff4e0a88
HTTP/3: close QUIC connection with HTTP/QPACK errors when needed.
Roman Arutyunyan <arut@nginx.com>
parents:
7952
diff
changeset
|
834 return rc; |
7692 | 835 } |
836 | |
837 st->state = sw_start; | |
838 return NGX_DONE; | |
839 } | |
840 | |
841 | |
8259
ab6aaa8e86b0
HTTP/3: staticize internal parsing functions.
Sergey Kandaurov <pluknet@nginx.com>
parents:
8233
diff
changeset
|
842 static ngx_int_t |
8508
0ac25efb2da3
HTTP/3: quic-qpack term updates.
Sergey Kandaurov <pluknet@nginx.com>
parents:
8497
diff
changeset
|
843 ngx_http_v3_parse_field_l(ngx_connection_t *c, |
8563
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
844 ngx_http_v3_parse_field_t *st, ngx_buf_t *b) |
7692 | 845 { |
8563
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
846 u_char ch; |
7692 | 847 ngx_int_t rc; |
848 enum { | |
849 sw_start = 0, | |
850 sw_name_len, | |
851 sw_name, | |
852 sw_value_len, | |
853 sw_read_value_len, | |
854 sw_value | |
855 }; | |
856 | |
8563
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
857 for ( ;; ) { |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
858 |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
859 switch (st->state) { |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
860 |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
861 case sw_start: |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
862 |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
863 ngx_log_debug0(NGX_LOG_DEBUG_HTTP, c->log, 0, "http3 parse field l"); |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
864 |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
865 if (b->pos == b->last) { |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
866 return NGX_AGAIN; |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
867 } |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
868 |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
869 ch = *b->pos; |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
870 |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
871 st->literal.huffman = (ch & 0x08) ? 1 : 0; |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
872 st->state = sw_name_len; |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
873 |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
874 /* fall through */ |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
875 |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
876 case sw_name_len: |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
877 |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
878 rc = ngx_http_v3_parse_prefix_int(c, &st->pint, 3, b); |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
879 if (rc != NGX_DONE) { |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
880 return rc; |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
881 } |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
882 |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
883 st->literal.length = st->pint.value; |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
884 if (st->literal.length == 0) { |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
885 return NGX_ERROR; |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
886 } |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
887 |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
888 st->state = sw_name; |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
889 break; |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
890 |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
891 case sw_name: |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
892 |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
893 rc = ngx_http_v3_parse_literal(c, &st->literal, b); |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
894 if (rc != NGX_DONE) { |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
895 return rc; |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
896 } |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
897 |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
898 st->name = st->literal.value; |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
899 st->state = sw_value_len; |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
900 break; |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
901 |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
902 case sw_value_len: |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
903 |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
904 if (b->pos == b->last) { |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
905 return NGX_AGAIN; |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
906 } |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
907 |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
908 ch = *b->pos; |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
909 |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
910 st->literal.huffman = (ch & 0x80) ? 1 : 0; |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
911 st->state = sw_read_value_len; |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
912 |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
913 /* fall through */ |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
914 |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
915 case sw_read_value_len: |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
916 |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
917 rc = ngx_http_v3_parse_prefix_int(c, &st->pint, 7, b); |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
918 if (rc != NGX_DONE) { |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
919 return rc; |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
920 } |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
921 |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
922 st->literal.length = st->pint.value; |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
923 if (st->literal.length == 0) { |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
924 goto done; |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
925 } |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
926 |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
927 st->state = sw_value; |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
928 break; |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
929 |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
930 case sw_value: |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
931 |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
932 rc = ngx_http_v3_parse_literal(c, &st->literal, b); |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
933 if (rc != NGX_DONE) { |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
934 return rc; |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
935 } |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
936 |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
937 st->value = st->literal.value; |
7692 | 938 goto done; |
939 } | |
940 } | |
941 | |
942 done: | |
943 | |
944 ngx_log_debug2(NGX_LOG_DEBUG_HTTP, c->log, 0, | |
8508
0ac25efb2da3
HTTP/3: quic-qpack term updates.
Sergey Kandaurov <pluknet@nginx.com>
parents:
8497
diff
changeset
|
945 "http3 parse field l done \"%V\" \"%V\"", |
7692 | 946 &st->name, &st->value); |
947 | |
948 st->state = sw_start; | |
949 return NGX_DONE; | |
950 } | |
951 | |
952 | |
8259
ab6aaa8e86b0
HTTP/3: staticize internal parsing functions.
Sergey Kandaurov <pluknet@nginx.com>
parents:
8233
diff
changeset
|
953 static ngx_int_t |
8508
0ac25efb2da3
HTTP/3: quic-qpack term updates.
Sergey Kandaurov <pluknet@nginx.com>
parents:
8497
diff
changeset
|
954 ngx_http_v3_parse_field_pbi(ngx_connection_t *c, |
8563
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
955 ngx_http_v3_parse_field_t *st, ngx_buf_t *b) |
7692 | 956 { |
7955
72f9ff4e0a88
HTTP/3: close QUIC connection with HTTP/QPACK errors when needed.
Roman Arutyunyan <arut@nginx.com>
parents:
7952
diff
changeset
|
957 ngx_int_t rc; |
7692 | 958 enum { |
959 sw_start = 0, | |
960 sw_index | |
961 }; | |
962 | |
8563
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
963 for ( ;; ) { |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
964 |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
965 switch (st->state) { |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
966 |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
967 case sw_start: |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
968 |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
969 ngx_log_debug0(NGX_LOG_DEBUG_HTTP, c->log, 0, |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
970 "http3 parse field pbi"); |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
971 |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
972 st->state = sw_index; |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
973 |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
974 /* fall through */ |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
975 |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
976 case sw_index: |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
977 |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
978 rc = ngx_http_v3_parse_prefix_int(c, &st->pint, 4, b); |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
979 if (rc != NGX_DONE) { |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
980 return rc; |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
981 } |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
982 |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
983 st->index = st->pint.value; |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
984 goto done; |
7692 | 985 } |
986 } | |
987 | |
988 done: | |
989 | |
990 ngx_log_debug1(NGX_LOG_DEBUG_HTTP, c->log, 0, | |
8508
0ac25efb2da3
HTTP/3: quic-qpack term updates.
Sergey Kandaurov <pluknet@nginx.com>
parents:
8497
diff
changeset
|
991 "http3 parse field pbi done dynamic[+%ui]", st->index); |
7692 | 992 |
7955
72f9ff4e0a88
HTTP/3: close QUIC connection with HTTP/QPACK errors when needed.
Roman Arutyunyan <arut@nginx.com>
parents:
7952
diff
changeset
|
993 rc = ngx_http_v3_parse_lookup(c, 1, st->base + st->index, &st->name, |
72f9ff4e0a88
HTTP/3: close QUIC connection with HTTP/QPACK errors when needed.
Roman Arutyunyan <arut@nginx.com>
parents:
7952
diff
changeset
|
994 &st->value); |
72f9ff4e0a88
HTTP/3: close QUIC connection with HTTP/QPACK errors when needed.
Roman Arutyunyan <arut@nginx.com>
parents:
7952
diff
changeset
|
995 if (rc != NGX_OK) { |
72f9ff4e0a88
HTTP/3: close QUIC connection with HTTP/QPACK errors when needed.
Roman Arutyunyan <arut@nginx.com>
parents:
7952
diff
changeset
|
996 return rc; |
7692 | 997 } |
998 | |
999 st->state = sw_start; | |
1000 return NGX_DONE; | |
1001 } | |
1002 | |
1003 | |
8259
ab6aaa8e86b0
HTTP/3: staticize internal parsing functions.
Sergey Kandaurov <pluknet@nginx.com>
parents:
8233
diff
changeset
|
1004 static ngx_int_t |
8508
0ac25efb2da3
HTTP/3: quic-qpack term updates.
Sergey Kandaurov <pluknet@nginx.com>
parents:
8497
diff
changeset
|
1005 ngx_http_v3_parse_field_lpbi(ngx_connection_t *c, |
8563
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1006 ngx_http_v3_parse_field_t *st, ngx_buf_t *b) |
7692 | 1007 { |
8563
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1008 u_char ch; |
7951
c9538aef3211
HTTP/3: refactored dynamic table implementation.
Roman Arutyunyan <arut@nginx.com>
parents:
7950
diff
changeset
|
1009 ngx_int_t rc; |
7692 | 1010 enum { |
1011 sw_start = 0, | |
1012 sw_index, | |
1013 sw_value_len, | |
1014 sw_read_value_len, | |
1015 sw_value | |
1016 }; | |
1017 | |
8563
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1018 for ( ;; ) { |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1019 |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1020 switch (st->state) { |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1021 |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1022 case sw_start: |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1023 |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1024 ngx_log_debug0(NGX_LOG_DEBUG_HTTP, c->log, 0, |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1025 "http3 parse field lpbi"); |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1026 |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1027 st->state = sw_index; |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1028 |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1029 /* fall through */ |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1030 |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1031 case sw_index: |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1032 |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1033 rc = ngx_http_v3_parse_prefix_int(c, &st->pint, 3, b); |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1034 if (rc != NGX_DONE) { |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1035 return rc; |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1036 } |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1037 |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1038 st->index = st->pint.value; |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1039 st->state = sw_value_len; |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1040 break; |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1041 |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1042 case sw_value_len: |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1043 |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1044 if (b->pos == b->last) { |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1045 return NGX_AGAIN; |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1046 } |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1047 |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1048 ch = *b->pos; |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1049 |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1050 st->literal.huffman = (ch & 0x80) ? 1 : 0; |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1051 st->state = sw_read_value_len; |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1052 |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1053 /* fall through */ |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1054 |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1055 case sw_read_value_len: |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1056 |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1057 rc = ngx_http_v3_parse_prefix_int(c, &st->pint, 7, b); |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1058 if (rc != NGX_DONE) { |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1059 return rc; |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1060 } |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1061 |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1062 st->literal.length = st->pint.value; |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1063 if (st->literal.length == 0) { |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1064 goto done; |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1065 } |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1066 |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1067 st->state = sw_value; |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1068 break; |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1069 |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1070 case sw_value: |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1071 |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1072 rc = ngx_http_v3_parse_literal(c, &st->literal, b); |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1073 if (rc != NGX_DONE) { |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1074 return rc; |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1075 } |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1076 |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1077 st->value = st->literal.value; |
7692 | 1078 goto done; |
1079 } | |
1080 } | |
1081 | |
1082 done: | |
1083 | |
1084 ngx_log_debug2(NGX_LOG_DEBUG_HTTP, c->log, 0, | |
8508
0ac25efb2da3
HTTP/3: quic-qpack term updates.
Sergey Kandaurov <pluknet@nginx.com>
parents:
8497
diff
changeset
|
1085 "http3 parse field lpbi done dynamic[+%ui] \"%V\"", |
7692 | 1086 st->index, &st->value); |
1087 | |
7955
72f9ff4e0a88
HTTP/3: close QUIC connection with HTTP/QPACK errors when needed.
Roman Arutyunyan <arut@nginx.com>
parents:
7952
diff
changeset
|
1088 rc = ngx_http_v3_parse_lookup(c, 1, st->base + st->index, &st->name, NULL); |
72f9ff4e0a88
HTTP/3: close QUIC connection with HTTP/QPACK errors when needed.
Roman Arutyunyan <arut@nginx.com>
parents:
7952
diff
changeset
|
1089 if (rc != NGX_OK) { |
72f9ff4e0a88
HTTP/3: close QUIC connection with HTTP/QPACK errors when needed.
Roman Arutyunyan <arut@nginx.com>
parents:
7952
diff
changeset
|
1090 return rc; |
7692 | 1091 } |
1092 | |
1093 st->state = sw_start; | |
1094 return NGX_DONE; | |
1095 } | |
1096 | |
1097 | |
7951
c9538aef3211
HTTP/3: refactored dynamic table implementation.
Roman Arutyunyan <arut@nginx.com>
parents:
7950
diff
changeset
|
1098 static ngx_int_t |
c9538aef3211
HTTP/3: refactored dynamic table implementation.
Roman Arutyunyan <arut@nginx.com>
parents:
7950
diff
changeset
|
1099 ngx_http_v3_parse_lookup(ngx_connection_t *c, ngx_uint_t dynamic, |
c9538aef3211
HTTP/3: refactored dynamic table implementation.
Roman Arutyunyan <arut@nginx.com>
parents:
7950
diff
changeset
|
1100 ngx_uint_t index, ngx_str_t *name, ngx_str_t *value) |
c9538aef3211
HTTP/3: refactored dynamic table implementation.
Roman Arutyunyan <arut@nginx.com>
parents:
7950
diff
changeset
|
1101 { |
c9538aef3211
HTTP/3: refactored dynamic table implementation.
Roman Arutyunyan <arut@nginx.com>
parents:
7950
diff
changeset
|
1102 u_char *p; |
c9538aef3211
HTTP/3: refactored dynamic table implementation.
Roman Arutyunyan <arut@nginx.com>
parents:
7950
diff
changeset
|
1103 |
c9538aef3211
HTTP/3: refactored dynamic table implementation.
Roman Arutyunyan <arut@nginx.com>
parents:
7950
diff
changeset
|
1104 if (!dynamic) { |
7955
72f9ff4e0a88
HTTP/3: close QUIC connection with HTTP/QPACK errors when needed.
Roman Arutyunyan <arut@nginx.com>
parents:
7952
diff
changeset
|
1105 if (ngx_http_v3_lookup_static(c, index, name, value) != NGX_OK) { |
72f9ff4e0a88
HTTP/3: close QUIC connection with HTTP/QPACK errors when needed.
Roman Arutyunyan <arut@nginx.com>
parents:
7952
diff
changeset
|
1106 return NGX_HTTP_V3_ERR_DECOMPRESSION_FAILED; |
72f9ff4e0a88
HTTP/3: close QUIC connection with HTTP/QPACK errors when needed.
Roman Arutyunyan <arut@nginx.com>
parents:
7952
diff
changeset
|
1107 } |
72f9ff4e0a88
HTTP/3: close QUIC connection with HTTP/QPACK errors when needed.
Roman Arutyunyan <arut@nginx.com>
parents:
7952
diff
changeset
|
1108 |
72f9ff4e0a88
HTTP/3: close QUIC connection with HTTP/QPACK errors when needed.
Roman Arutyunyan <arut@nginx.com>
parents:
7952
diff
changeset
|
1109 return NGX_OK; |
7951
c9538aef3211
HTTP/3: refactored dynamic table implementation.
Roman Arutyunyan <arut@nginx.com>
parents:
7950
diff
changeset
|
1110 } |
c9538aef3211
HTTP/3: refactored dynamic table implementation.
Roman Arutyunyan <arut@nginx.com>
parents:
7950
diff
changeset
|
1111 |
c9538aef3211
HTTP/3: refactored dynamic table implementation.
Roman Arutyunyan <arut@nginx.com>
parents:
7950
diff
changeset
|
1112 if (ngx_http_v3_lookup(c, index, name, value) != NGX_OK) { |
7955
72f9ff4e0a88
HTTP/3: close QUIC connection with HTTP/QPACK errors when needed.
Roman Arutyunyan <arut@nginx.com>
parents:
7952
diff
changeset
|
1113 return NGX_HTTP_V3_ERR_DECOMPRESSION_FAILED; |
7951
c9538aef3211
HTTP/3: refactored dynamic table implementation.
Roman Arutyunyan <arut@nginx.com>
parents:
7950
diff
changeset
|
1114 } |
c9538aef3211
HTTP/3: refactored dynamic table implementation.
Roman Arutyunyan <arut@nginx.com>
parents:
7950
diff
changeset
|
1115 |
c9538aef3211
HTTP/3: refactored dynamic table implementation.
Roman Arutyunyan <arut@nginx.com>
parents:
7950
diff
changeset
|
1116 if (name) { |
c9538aef3211
HTTP/3: refactored dynamic table implementation.
Roman Arutyunyan <arut@nginx.com>
parents:
7950
diff
changeset
|
1117 p = ngx_pnalloc(c->pool, name->len + 1); |
c9538aef3211
HTTP/3: refactored dynamic table implementation.
Roman Arutyunyan <arut@nginx.com>
parents:
7950
diff
changeset
|
1118 if (p == NULL) { |
c9538aef3211
HTTP/3: refactored dynamic table implementation.
Roman Arutyunyan <arut@nginx.com>
parents:
7950
diff
changeset
|
1119 return NGX_ERROR; |
c9538aef3211
HTTP/3: refactored dynamic table implementation.
Roman Arutyunyan <arut@nginx.com>
parents:
7950
diff
changeset
|
1120 } |
c9538aef3211
HTTP/3: refactored dynamic table implementation.
Roman Arutyunyan <arut@nginx.com>
parents:
7950
diff
changeset
|
1121 |
c9538aef3211
HTTP/3: refactored dynamic table implementation.
Roman Arutyunyan <arut@nginx.com>
parents:
7950
diff
changeset
|
1122 ngx_memcpy(p, name->data, name->len); |
c9538aef3211
HTTP/3: refactored dynamic table implementation.
Roman Arutyunyan <arut@nginx.com>
parents:
7950
diff
changeset
|
1123 p[name->len] = '\0'; |
c9538aef3211
HTTP/3: refactored dynamic table implementation.
Roman Arutyunyan <arut@nginx.com>
parents:
7950
diff
changeset
|
1124 name->data = p; |
c9538aef3211
HTTP/3: refactored dynamic table implementation.
Roman Arutyunyan <arut@nginx.com>
parents:
7950
diff
changeset
|
1125 } |
c9538aef3211
HTTP/3: refactored dynamic table implementation.
Roman Arutyunyan <arut@nginx.com>
parents:
7950
diff
changeset
|
1126 |
c9538aef3211
HTTP/3: refactored dynamic table implementation.
Roman Arutyunyan <arut@nginx.com>
parents:
7950
diff
changeset
|
1127 if (value) { |
c9538aef3211
HTTP/3: refactored dynamic table implementation.
Roman Arutyunyan <arut@nginx.com>
parents:
7950
diff
changeset
|
1128 p = ngx_pnalloc(c->pool, value->len + 1); |
c9538aef3211
HTTP/3: refactored dynamic table implementation.
Roman Arutyunyan <arut@nginx.com>
parents:
7950
diff
changeset
|
1129 if (p == NULL) { |
c9538aef3211
HTTP/3: refactored dynamic table implementation.
Roman Arutyunyan <arut@nginx.com>
parents:
7950
diff
changeset
|
1130 return NGX_ERROR; |
c9538aef3211
HTTP/3: refactored dynamic table implementation.
Roman Arutyunyan <arut@nginx.com>
parents:
7950
diff
changeset
|
1131 } |
c9538aef3211
HTTP/3: refactored dynamic table implementation.
Roman Arutyunyan <arut@nginx.com>
parents:
7950
diff
changeset
|
1132 |
c9538aef3211
HTTP/3: refactored dynamic table implementation.
Roman Arutyunyan <arut@nginx.com>
parents:
7950
diff
changeset
|
1133 ngx_memcpy(p, value->data, value->len); |
c9538aef3211
HTTP/3: refactored dynamic table implementation.
Roman Arutyunyan <arut@nginx.com>
parents:
7950
diff
changeset
|
1134 p[value->len] = '\0'; |
c9538aef3211
HTTP/3: refactored dynamic table implementation.
Roman Arutyunyan <arut@nginx.com>
parents:
7950
diff
changeset
|
1135 value->data = p; |
c9538aef3211
HTTP/3: refactored dynamic table implementation.
Roman Arutyunyan <arut@nginx.com>
parents:
7950
diff
changeset
|
1136 } |
c9538aef3211
HTTP/3: refactored dynamic table implementation.
Roman Arutyunyan <arut@nginx.com>
parents:
7950
diff
changeset
|
1137 |
c9538aef3211
HTTP/3: refactored dynamic table implementation.
Roman Arutyunyan <arut@nginx.com>
parents:
7950
diff
changeset
|
1138 return NGX_OK; |
c9538aef3211
HTTP/3: refactored dynamic table implementation.
Roman Arutyunyan <arut@nginx.com>
parents:
7950
diff
changeset
|
1139 } |
c9538aef3211
HTTP/3: refactored dynamic table implementation.
Roman Arutyunyan <arut@nginx.com>
parents:
7950
diff
changeset
|
1140 |
c9538aef3211
HTTP/3: refactored dynamic table implementation.
Roman Arutyunyan <arut@nginx.com>
parents:
7950
diff
changeset
|
1141 |
8432
345370fdd32d
HTTP/3: moved parsing uni stream type to ngx_http_v3_parse.c.
Roman Arutyunyan <arut@nginx.com>
parents:
8431
diff
changeset
|
1142 static ngx_int_t |
345370fdd32d
HTTP/3: moved parsing uni stream type to ngx_http_v3_parse.c.
Roman Arutyunyan <arut@nginx.com>
parents:
8431
diff
changeset
|
1143 ngx_http_v3_parse_control(ngx_connection_t *c, ngx_http_v3_parse_control_t *st, |
8563
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1144 ngx_buf_t *b) |
7692 | 1145 { |
8563
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1146 ngx_buf_t loc; |
7692 | 1147 ngx_int_t rc; |
1148 enum { | |
1149 sw_start = 0, | |
7955
72f9ff4e0a88
HTTP/3: close QUIC connection with HTTP/QPACK errors when needed.
Roman Arutyunyan <arut@nginx.com>
parents:
7952
diff
changeset
|
1150 sw_first_type, |
7692 | 1151 sw_type, |
1152 sw_length, | |
8015 | 1153 sw_cancel_push, |
7692 | 1154 sw_settings, |
1155 sw_max_push_id, | |
8497
1fec68e322d0
HTTP/3: client GOAWAY support.
Roman Arutyunyan <arut@nginx.com>
parents:
8496
diff
changeset
|
1156 sw_goaway, |
7692 | 1157 sw_skip |
1158 }; | |
1159 | |
8563
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1160 for ( ;; ) { |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1161 |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1162 switch (st->state) { |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1163 |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1164 case sw_start: |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1165 |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1166 ngx_log_debug0(NGX_LOG_DEBUG_HTTP, c->log, 0, |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1167 "http3 parse control"); |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1168 |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1169 st->state = sw_first_type; |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1170 |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1171 /* fall through */ |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1172 |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1173 case sw_first_type: |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1174 case sw_type: |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1175 |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1176 rc = ngx_http_v3_parse_varlen_int(c, &st->vlint, b); |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1177 if (rc != NGX_DONE) { |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1178 return rc; |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1179 } |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1180 |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1181 st->type = st->vlint.value; |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1182 |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1183 ngx_log_debug1(NGX_LOG_DEBUG_HTTP, c->log, 0, |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1184 "http3 parse frame type:%ui", st->type); |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1185 |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1186 if (st->state == sw_first_type |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1187 && st->type != NGX_HTTP_V3_FRAME_SETTINGS) |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1188 { |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1189 return NGX_HTTP_V3_ERR_MISSING_SETTINGS; |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1190 } |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1191 |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1192 if (st->state != sw_first_type |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1193 && st->type == NGX_HTTP_V3_FRAME_SETTINGS) |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1194 { |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1195 return NGX_HTTP_V3_ERR_FRAME_UNEXPECTED; |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1196 } |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1197 |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1198 if (ngx_http_v3_is_v2_frame(st->type) |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1199 || st->type == NGX_HTTP_V3_FRAME_DATA |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1200 || st->type == NGX_HTTP_V3_FRAME_HEADERS |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1201 || st->type == NGX_HTTP_V3_FRAME_PUSH_PROMISE) |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1202 { |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1203 return NGX_HTTP_V3_ERR_FRAME_UNEXPECTED; |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1204 } |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1205 |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1206 st->state = sw_length; |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1207 break; |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1208 |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1209 case sw_length: |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1210 |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1211 rc = ngx_http_v3_parse_varlen_int(c, &st->vlint, b); |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1212 if (rc != NGX_DONE) { |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1213 return rc; |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1214 } |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1215 |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1216 ngx_log_debug1(NGX_LOG_DEBUG_HTTP, c->log, 0, |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1217 "http3 parse frame len:%uL", st->vlint.value); |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1218 |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1219 st->length = st->vlint.value; |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1220 if (st->length == 0) { |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1221 st->state = sw_type; |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1222 break; |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1223 } |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1224 |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1225 switch (st->type) { |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1226 |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1227 case NGX_HTTP_V3_FRAME_CANCEL_PUSH: |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1228 st->state = sw_cancel_push; |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1229 break; |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1230 |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1231 case NGX_HTTP_V3_FRAME_SETTINGS: |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1232 st->state = sw_settings; |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1233 break; |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1234 |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1235 case NGX_HTTP_V3_FRAME_MAX_PUSH_ID: |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1236 st->state = sw_max_push_id; |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1237 break; |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1238 |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1239 case NGX_HTTP_V3_FRAME_GOAWAY: |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1240 st->state = sw_goaway; |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1241 break; |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1242 |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1243 default: |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1244 ngx_log_debug0(NGX_LOG_DEBUG_HTTP, c->log, 0, |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1245 "http3 parse skip unknown frame"); |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1246 st->state = sw_skip; |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1247 } |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1248 |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1249 break; |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1250 |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1251 case sw_cancel_push: |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1252 |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1253 ngx_http_v3_parse_start_local(b, &loc, st->length); |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1254 |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1255 rc = ngx_http_v3_parse_varlen_int(c, &st->vlint, &loc); |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1256 |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1257 ngx_http_v3_parse_end_local(b, &loc, &st->length); |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1258 |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1259 if (st->length == 0 && rc == NGX_AGAIN) { |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1260 return NGX_HTTP_V3_ERR_FRAME_ERROR; |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1261 } |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1262 |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1263 if (rc != NGX_DONE) { |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1264 return rc; |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1265 } |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1266 |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1267 rc = ngx_http_v3_cancel_push(c, st->vlint.value); |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1268 if (rc != NGX_OK) { |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1269 return rc; |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1270 } |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1271 |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1272 st->state = sw_type; |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1273 break; |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1274 |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1275 case sw_settings: |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1276 |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1277 ngx_http_v3_parse_start_local(b, &loc, st->length); |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1278 |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1279 rc = ngx_http_v3_parse_settings(c, &st->settings, &loc); |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1280 |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1281 ngx_http_v3_parse_end_local(b, &loc, &st->length); |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1282 |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1283 if (st->length == 0 && rc == NGX_AGAIN) { |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1284 return NGX_HTTP_V3_ERR_SETTINGS_ERROR; |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1285 } |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1286 |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1287 if (rc != NGX_DONE) { |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1288 return rc; |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1289 } |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1290 |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1291 if (st->length == 0) { |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1292 st->state = sw_type; |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1293 } |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1294 |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1295 break; |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1296 |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1297 case sw_max_push_id: |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1298 |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1299 ngx_http_v3_parse_start_local(b, &loc, st->length); |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1300 |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1301 rc = ngx_http_v3_parse_varlen_int(c, &st->vlint, &loc); |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1302 |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1303 ngx_http_v3_parse_end_local(b, &loc, &st->length); |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1304 |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1305 if (st->length == 0 && rc == NGX_AGAIN) { |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1306 return NGX_HTTP_V3_ERR_FRAME_ERROR; |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1307 } |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1308 |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1309 if (rc != NGX_DONE) { |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1310 return rc; |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1311 } |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1312 |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1313 rc = ngx_http_v3_set_max_push_id(c, st->vlint.value); |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1314 if (rc != NGX_OK) { |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1315 return rc; |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1316 } |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1317 |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1318 st->state = sw_type; |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1319 break; |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1320 |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1321 case sw_goaway: |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1322 |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1323 ngx_http_v3_parse_start_local(b, &loc, st->length); |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1324 |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1325 rc = ngx_http_v3_parse_varlen_int(c, &st->vlint, &loc); |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1326 |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1327 ngx_http_v3_parse_end_local(b, &loc, &st->length); |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1328 |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1329 if (st->length == 0 && rc == NGX_AGAIN) { |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1330 return NGX_HTTP_V3_ERR_FRAME_ERROR; |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1331 } |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1332 |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1333 if (rc != NGX_DONE) { |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1334 return rc; |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1335 } |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1336 |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1337 rc = ngx_http_v3_goaway(c, st->vlint.value); |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1338 if (rc != NGX_OK) { |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1339 return rc; |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1340 } |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1341 |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1342 st->state = sw_type; |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1343 break; |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1344 |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1345 case sw_skip: |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1346 |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1347 rc = ngx_http_v3_parse_skip(b, &st->length); |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1348 if (rc != NGX_DONE) { |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1349 return rc; |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1350 } |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1351 |
7692 | 1352 st->state = sw_type; |
1353 break; | |
1354 } | |
1355 } | |
1356 } | |
1357 | |
1358 | |
8259
ab6aaa8e86b0
HTTP/3: staticize internal parsing functions.
Sergey Kandaurov <pluknet@nginx.com>
parents:
8233
diff
changeset
|
1359 static ngx_int_t |
7692 | 1360 ngx_http_v3_parse_settings(ngx_connection_t *c, |
8563
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1361 ngx_http_v3_parse_settings_t *st, ngx_buf_t *b) |
7692 | 1362 { |
7961
4fd709540daf
HTTP/3: put ngx_http_v3_parse_varlen_int() return code in variable.
Roman Arutyunyan <arut@nginx.com>
parents:
7960
diff
changeset
|
1363 ngx_int_t rc; |
7692 | 1364 enum { |
1365 sw_start = 0, | |
1366 sw_id, | |
1367 sw_value | |
1368 }; | |
1369 | |
8563
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1370 for ( ;; ) { |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1371 |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1372 switch (st->state) { |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1373 |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1374 case sw_start: |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1375 |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1376 ngx_log_debug0(NGX_LOG_DEBUG_HTTP, c->log, 0, |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1377 "http3 parse settings"); |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1378 |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1379 st->state = sw_id; |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1380 |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1381 /* fall through */ |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1382 |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1383 case sw_id: |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1384 |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1385 rc = ngx_http_v3_parse_varlen_int(c, &st->vlint, b); |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1386 if (rc != NGX_DONE) { |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1387 return rc; |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1388 } |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1389 |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1390 st->id = st->vlint.value; |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1391 st->state = sw_value; |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1392 break; |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1393 |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1394 case sw_value: |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1395 |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1396 rc = ngx_http_v3_parse_varlen_int(c, &st->vlint, b); |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1397 if (rc != NGX_DONE) { |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1398 return rc; |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1399 } |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1400 |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1401 if (ngx_http_v3_set_param(c, st->id, st->vlint.value) != NGX_OK) { |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1402 return NGX_HTTP_V3_ERR_SETTINGS_ERROR; |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1403 } |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1404 |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1405 goto done; |
7692 | 1406 } |
1407 } | |
1408 | |
1409 done: | |
1410 | |
1411 ngx_log_debug0(NGX_LOG_DEBUG_HTTP, c->log, 0, "http3 parse settings done"); | |
1412 | |
1413 st->state = sw_start; | |
1414 return NGX_DONE; | |
1415 } | |
1416 | |
1417 | |
8432
345370fdd32d
HTTP/3: moved parsing uni stream type to ngx_http_v3_parse.c.
Roman Arutyunyan <arut@nginx.com>
parents:
8431
diff
changeset
|
1418 static ngx_int_t |
345370fdd32d
HTTP/3: moved parsing uni stream type to ngx_http_v3_parse.c.
Roman Arutyunyan <arut@nginx.com>
parents:
8431
diff
changeset
|
1419 ngx_http_v3_parse_encoder(ngx_connection_t *c, ngx_http_v3_parse_encoder_t *st, |
8563
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1420 ngx_buf_t *b) |
7692 | 1421 { |
8563
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1422 u_char ch; |
7692 | 1423 ngx_int_t rc; |
1424 enum { | |
1425 sw_start = 0, | |
1426 sw_inr, | |
8508
0ac25efb2da3
HTTP/3: quic-qpack term updates.
Sergey Kandaurov <pluknet@nginx.com>
parents:
8497
diff
changeset
|
1427 sw_iln, |
7692 | 1428 sw_capacity, |
1429 sw_duplicate | |
1430 }; | |
1431 | |
8563
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1432 for ( ;; ) { |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1433 |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1434 if (st->state == sw_start) { |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1435 |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1436 ngx_log_debug0(NGX_LOG_DEBUG_HTTP, c->log, 0, |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1437 "http3 parse encoder instruction"); |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1438 |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1439 if (b->pos == b->last) { |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1440 return NGX_AGAIN; |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1441 } |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1442 |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1443 ch = *b->pos; |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1444 |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1445 if (ch & 0x80) { |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1446 /* Insert With Name Reference */ |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1447 |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1448 st->state = sw_inr; |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1449 |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1450 } else if (ch & 0x40) { |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1451 /* Insert With Literal Name */ |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1452 |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1453 st->state = sw_iln; |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1454 |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1455 } else if (ch & 0x20) { |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1456 /* Set Dynamic Table Capacity */ |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1457 |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1458 st->state = sw_capacity; |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1459 |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1460 } else { |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1461 /* Duplicate */ |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1462 |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1463 st->state = sw_duplicate; |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1464 } |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1465 } |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1466 |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1467 switch (st->state) { |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1468 |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1469 case sw_inr: |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1470 |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1471 rc = ngx_http_v3_parse_field_inr(c, &st->field, b); |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1472 if (rc != NGX_DONE) { |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1473 return rc; |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1474 } |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1475 |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1476 st->state = sw_start; |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1477 break; |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1478 |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1479 case sw_iln: |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1480 |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1481 rc = ngx_http_v3_parse_field_iln(c, &st->field, b); |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1482 if (rc != NGX_DONE) { |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1483 return rc; |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1484 } |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1485 |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1486 st->state = sw_start; |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1487 break; |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1488 |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1489 case sw_capacity: |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1490 |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1491 rc = ngx_http_v3_parse_prefix_int(c, &st->pint, 5, b); |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1492 if (rc != NGX_DONE) { |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1493 return rc; |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1494 } |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1495 |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1496 rc = ngx_http_v3_set_capacity(c, st->pint.value); |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1497 if (rc != NGX_OK) { |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1498 return rc; |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1499 } |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1500 |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1501 st->state = sw_start; |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1502 break; |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1503 |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1504 default: /* sw_duplicate */ |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1505 |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1506 rc = ngx_http_v3_parse_prefix_int(c, &st->pint, 5, b); |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1507 if (rc != NGX_DONE) { |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1508 return rc; |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1509 } |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1510 |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1511 rc = ngx_http_v3_duplicate(c, st->pint.value); |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1512 if (rc != NGX_OK) { |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1513 return rc; |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1514 } |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1515 |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1516 st->state = sw_start; |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1517 break; |
7692 | 1518 } |
1519 } | |
1520 } | |
1521 | |
1522 | |
8259
ab6aaa8e86b0
HTTP/3: staticize internal parsing functions.
Sergey Kandaurov <pluknet@nginx.com>
parents:
8233
diff
changeset
|
1523 static ngx_int_t |
8508
0ac25efb2da3
HTTP/3: quic-qpack term updates.
Sergey Kandaurov <pluknet@nginx.com>
parents:
8497
diff
changeset
|
1524 ngx_http_v3_parse_field_inr(ngx_connection_t *c, |
8563
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1525 ngx_http_v3_parse_field_t *st, ngx_buf_t *b) |
7692 | 1526 { |
8563
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1527 u_char ch; |
7692 | 1528 ngx_int_t rc; |
1529 enum { | |
1530 sw_start = 0, | |
1531 sw_name_index, | |
1532 sw_value_len, | |
1533 sw_read_value_len, | |
1534 sw_value | |
1535 }; | |
1536 | |
8563
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1537 for ( ;; ) { |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1538 |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1539 switch (st->state) { |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1540 |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1541 case sw_start: |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1542 |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1543 ngx_log_debug0(NGX_LOG_DEBUG_HTTP, c->log, 0, |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1544 "http3 parse field inr"); |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1545 |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1546 if (b->pos == b->last) { |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1547 return NGX_AGAIN; |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1548 } |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1549 |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1550 ch = *b->pos; |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1551 |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1552 st->dynamic = (ch & 0x40) ? 0 : 1; |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1553 st->state = sw_name_index; |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1554 |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1555 /* fall through */ |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1556 |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1557 case sw_name_index: |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1558 |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1559 rc = ngx_http_v3_parse_prefix_int(c, &st->pint, 6, b); |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1560 if (rc != NGX_DONE) { |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1561 return rc; |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1562 } |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1563 |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1564 st->index = st->pint.value; |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1565 st->state = sw_value_len; |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1566 break; |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1567 |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1568 case sw_value_len: |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1569 |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1570 if (b->pos == b->last) { |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1571 return NGX_AGAIN; |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1572 } |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1573 |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1574 ch = *b->pos; |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1575 |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1576 st->literal.huffman = (ch & 0x80) ? 1 : 0; |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1577 st->state = sw_read_value_len; |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1578 |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1579 /* fall through */ |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1580 |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1581 case sw_read_value_len: |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1582 |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1583 rc = ngx_http_v3_parse_prefix_int(c, &st->pint, 7, b); |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1584 if (rc != NGX_DONE) { |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1585 return rc; |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1586 } |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1587 |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1588 st->literal.length = st->pint.value; |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1589 if (st->literal.length == 0) { |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1590 st->value.len = 0; |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1591 goto done; |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1592 } |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1593 |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1594 st->state = sw_value; |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1595 break; |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1596 |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1597 case sw_value: |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1598 |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1599 rc = ngx_http_v3_parse_literal(c, &st->literal, b); |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1600 if (rc != NGX_DONE) { |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1601 return rc; |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1602 } |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1603 |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1604 st->value = st->literal.value; |
7692 | 1605 goto done; |
1606 } | |
1607 } | |
1608 | |
1609 done: | |
1610 | |
1611 ngx_log_debug3(NGX_LOG_DEBUG_HTTP, c->log, 0, | |
8508
0ac25efb2da3
HTTP/3: quic-qpack term updates.
Sergey Kandaurov <pluknet@nginx.com>
parents:
8497
diff
changeset
|
1612 "http3 parse field inr done %s[%ui] \"%V\"", |
7692 | 1613 st->dynamic ? "dynamic" : "static", |
1614 st->index, &st->value); | |
1615 | |
7955
72f9ff4e0a88
HTTP/3: close QUIC connection with HTTP/QPACK errors when needed.
Roman Arutyunyan <arut@nginx.com>
parents:
7952
diff
changeset
|
1616 rc = ngx_http_v3_ref_insert(c, st->dynamic, st->index, &st->value); |
72f9ff4e0a88
HTTP/3: close QUIC connection with HTTP/QPACK errors when needed.
Roman Arutyunyan <arut@nginx.com>
parents:
7952
diff
changeset
|
1617 if (rc != NGX_OK) { |
72f9ff4e0a88
HTTP/3: close QUIC connection with HTTP/QPACK errors when needed.
Roman Arutyunyan <arut@nginx.com>
parents:
7952
diff
changeset
|
1618 return rc; |
7692 | 1619 } |
1620 | |
1621 st->state = sw_start; | |
1622 return NGX_DONE; | |
1623 } | |
1624 | |
1625 | |
8259
ab6aaa8e86b0
HTTP/3: staticize internal parsing functions.
Sergey Kandaurov <pluknet@nginx.com>
parents:
8233
diff
changeset
|
1626 static ngx_int_t |
8508
0ac25efb2da3
HTTP/3: quic-qpack term updates.
Sergey Kandaurov <pluknet@nginx.com>
parents:
8497
diff
changeset
|
1627 ngx_http_v3_parse_field_iln(ngx_connection_t *c, |
8563
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1628 ngx_http_v3_parse_field_t *st, ngx_buf_t *b) |
7692 | 1629 { |
8563
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1630 u_char ch; |
7692 | 1631 ngx_int_t rc; |
1632 enum { | |
1633 sw_start = 0, | |
1634 sw_name_len, | |
1635 sw_name, | |
1636 sw_value_len, | |
1637 sw_read_value_len, | |
1638 sw_value | |
1639 }; | |
1640 | |
8563
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1641 for ( ;; ) { |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1642 |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1643 switch (st->state) { |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1644 |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1645 case sw_start: |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1646 |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1647 ngx_log_debug0(NGX_LOG_DEBUG_HTTP, c->log, 0, |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1648 "http3 parse field iln"); |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1649 |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1650 if (b->pos == b->last) { |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1651 return NGX_AGAIN; |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1652 } |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1653 |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1654 ch = *b->pos; |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1655 |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1656 st->literal.huffman = (ch & 0x20) ? 1 : 0; |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1657 st->state = sw_name_len; |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1658 |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1659 /* fall through */ |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1660 |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1661 case sw_name_len: |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1662 |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1663 rc = ngx_http_v3_parse_prefix_int(c, &st->pint, 5, b); |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1664 if (rc != NGX_DONE) { |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1665 return rc; |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1666 } |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1667 |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1668 st->literal.length = st->pint.value; |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1669 if (st->literal.length == 0) { |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1670 return NGX_ERROR; |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1671 } |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1672 |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1673 st->state = sw_name; |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1674 break; |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1675 |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1676 case sw_name: |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1677 |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1678 rc = ngx_http_v3_parse_literal(c, &st->literal, b); |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1679 if (rc != NGX_DONE) { |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1680 return rc; |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1681 } |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1682 |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1683 st->name = st->literal.value; |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1684 st->state = sw_value_len; |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1685 break; |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1686 |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1687 case sw_value_len: |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1688 |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1689 if (b->pos == b->last) { |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1690 return NGX_AGAIN; |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1691 } |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1692 |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1693 ch = *b->pos; |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1694 |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1695 st->literal.huffman = (ch & 0x80) ? 1 : 0; |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1696 st->state = sw_read_value_len; |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1697 |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1698 /* fall through */ |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1699 |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1700 case sw_read_value_len: |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1701 |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1702 rc = ngx_http_v3_parse_prefix_int(c, &st->pint, 7, b); |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1703 if (rc != NGX_DONE) { |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1704 return rc; |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1705 } |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1706 |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1707 st->literal.length = st->pint.value; |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1708 if (st->literal.length == 0) { |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1709 st->value.len = 0; |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1710 goto done; |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1711 } |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1712 |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1713 st->state = sw_value; |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1714 break; |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1715 |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1716 case sw_value: |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1717 |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1718 rc = ngx_http_v3_parse_literal(c, &st->literal, b); |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1719 if (rc != NGX_DONE) { |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1720 return rc; |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1721 } |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1722 |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1723 st->value = st->literal.value; |
7692 | 1724 goto done; |
1725 } | |
1726 } | |
1727 | |
1728 done: | |
1729 | |
1730 ngx_log_debug2(NGX_LOG_DEBUG_HTTP, c->log, 0, | |
8508
0ac25efb2da3
HTTP/3: quic-qpack term updates.
Sergey Kandaurov <pluknet@nginx.com>
parents:
8497
diff
changeset
|
1731 "http3 parse field iln done \"%V\":\"%V\"", |
7692 | 1732 &st->name, &st->value); |
1733 | |
7955
72f9ff4e0a88
HTTP/3: close QUIC connection with HTTP/QPACK errors when needed.
Roman Arutyunyan <arut@nginx.com>
parents:
7952
diff
changeset
|
1734 rc = ngx_http_v3_insert(c, &st->name, &st->value); |
72f9ff4e0a88
HTTP/3: close QUIC connection with HTTP/QPACK errors when needed.
Roman Arutyunyan <arut@nginx.com>
parents:
7952
diff
changeset
|
1735 if (rc != NGX_OK) { |
72f9ff4e0a88
HTTP/3: close QUIC connection with HTTP/QPACK errors when needed.
Roman Arutyunyan <arut@nginx.com>
parents:
7952
diff
changeset
|
1736 return rc; |
7692 | 1737 } |
1738 | |
1739 st->state = sw_start; | |
1740 return NGX_DONE; | |
1741 } | |
1742 | |
1743 | |
8432
345370fdd32d
HTTP/3: moved parsing uni stream type to ngx_http_v3_parse.c.
Roman Arutyunyan <arut@nginx.com>
parents:
8431
diff
changeset
|
1744 static ngx_int_t |
345370fdd32d
HTTP/3: moved parsing uni stream type to ngx_http_v3_parse.c.
Roman Arutyunyan <arut@nginx.com>
parents:
8431
diff
changeset
|
1745 ngx_http_v3_parse_decoder(ngx_connection_t *c, ngx_http_v3_parse_decoder_t *st, |
8563
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1746 ngx_buf_t *b) |
7692 | 1747 { |
8563
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1748 u_char ch; |
7955
72f9ff4e0a88
HTTP/3: close QUIC connection with HTTP/QPACK errors when needed.
Roman Arutyunyan <arut@nginx.com>
parents:
7952
diff
changeset
|
1749 ngx_int_t rc; |
7692 | 1750 enum { |
1751 sw_start = 0, | |
8508
0ac25efb2da3
HTTP/3: quic-qpack term updates.
Sergey Kandaurov <pluknet@nginx.com>
parents:
8497
diff
changeset
|
1752 sw_ack_section, |
7692 | 1753 sw_cancel_stream, |
1754 sw_inc_insert_count | |
1755 }; | |
1756 | |
8563
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1757 for ( ;; ) { |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1758 |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1759 if (st->state == sw_start) { |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1760 |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1761 ngx_log_debug0(NGX_LOG_DEBUG_HTTP, c->log, 0, |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1762 "http3 parse decoder instruction"); |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1763 |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1764 if (b->pos == b->last) { |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1765 return NGX_AGAIN; |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1766 } |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1767 |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1768 ch = *b->pos; |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1769 |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1770 if (ch & 0x80) { |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1771 /* Section Acknowledgment */ |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1772 |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1773 st->state = sw_ack_section; |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1774 |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1775 } else if (ch & 0x40) { |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1776 /* Stream Cancellation */ |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1777 |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1778 st->state = sw_cancel_stream; |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1779 |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1780 } else { |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1781 /* Insert Count Increment */ |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1782 |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1783 st->state = sw_inc_insert_count; |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1784 } |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1785 } |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1786 |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1787 switch (st->state) { |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1788 |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1789 case sw_ack_section: |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1790 |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1791 rc = ngx_http_v3_parse_prefix_int(c, &st->pint, 7, b); |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1792 if (rc != NGX_DONE) { |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1793 return rc; |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1794 } |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1795 |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1796 rc = ngx_http_v3_ack_section(c, st->pint.value); |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1797 if (rc != NGX_OK) { |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1798 return rc; |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1799 } |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1800 |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1801 st->state = sw_start; |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1802 break; |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1803 |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1804 case sw_cancel_stream: |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1805 |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1806 rc = ngx_http_v3_parse_prefix_int(c, &st->pint, 6, b); |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1807 if (rc != NGX_DONE) { |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1808 return rc; |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1809 } |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1810 |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1811 rc = ngx_http_v3_cancel_stream(c, st->pint.value); |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1812 if (rc != NGX_OK) { |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1813 return rc; |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1814 } |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1815 |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1816 st->state = sw_start; |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1817 break; |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1818 |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1819 case sw_inc_insert_count: |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1820 |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1821 rc = ngx_http_v3_parse_prefix_int(c, &st->pint, 6, b); |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1822 if (rc != NGX_DONE) { |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1823 return rc; |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1824 } |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1825 |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1826 rc = ngx_http_v3_inc_insert_count(c, st->pint.value); |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1827 if (rc != NGX_OK) { |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1828 return rc; |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1829 } |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1830 |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1831 st->state = sw_start; |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1832 break; |
7692 | 1833 } |
1834 } | |
1835 } | |
7761
5649079a41f4
Parsing HTTP/3 request body.
Roman Arutyunyan <arut@nginx.com>
parents:
7693
diff
changeset
|
1836 |
5649079a41f4
Parsing HTTP/3 request body.
Roman Arutyunyan <arut@nginx.com>
parents:
7693
diff
changeset
|
1837 |
5649079a41f4
Parsing HTTP/3 request body.
Roman Arutyunyan <arut@nginx.com>
parents:
7693
diff
changeset
|
1838 ngx_int_t |
5649079a41f4
Parsing HTTP/3 request body.
Roman Arutyunyan <arut@nginx.com>
parents:
7693
diff
changeset
|
1839 ngx_http_v3_parse_data(ngx_connection_t *c, ngx_http_v3_parse_data_t *st, |
8563
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1840 ngx_buf_t *b) |
7761
5649079a41f4
Parsing HTTP/3 request body.
Roman Arutyunyan <arut@nginx.com>
parents:
7693
diff
changeset
|
1841 { |
7961
4fd709540daf
HTTP/3: put ngx_http_v3_parse_varlen_int() return code in variable.
Roman Arutyunyan <arut@nginx.com>
parents:
7960
diff
changeset
|
1842 ngx_int_t rc; |
7761
5649079a41f4
Parsing HTTP/3 request body.
Roman Arutyunyan <arut@nginx.com>
parents:
7693
diff
changeset
|
1843 enum { |
5649079a41f4
Parsing HTTP/3 request body.
Roman Arutyunyan <arut@nginx.com>
parents:
7693
diff
changeset
|
1844 sw_start = 0, |
5649079a41f4
Parsing HTTP/3 request body.
Roman Arutyunyan <arut@nginx.com>
parents:
7693
diff
changeset
|
1845 sw_type, |
8087
d70a38acaea0
HTTP/3: skip unknown frames on request stream.
Roman Arutyunyan <arut@nginx.com>
parents:
8015
diff
changeset
|
1846 sw_length, |
d70a38acaea0
HTTP/3: skip unknown frames on request stream.
Roman Arutyunyan <arut@nginx.com>
parents:
8015
diff
changeset
|
1847 sw_skip |
7761
5649079a41f4
Parsing HTTP/3 request body.
Roman Arutyunyan <arut@nginx.com>
parents:
7693
diff
changeset
|
1848 }; |
5649079a41f4
Parsing HTTP/3 request body.
Roman Arutyunyan <arut@nginx.com>
parents:
7693
diff
changeset
|
1849 |
8563
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1850 for ( ;; ) { |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1851 |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1852 switch (st->state) { |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1853 |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1854 case sw_start: |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1855 |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1856 ngx_log_debug0(NGX_LOG_DEBUG_HTTP, c->log, 0, "http3 parse data"); |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1857 |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1858 st->state = sw_type; |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1859 |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1860 /* fall through */ |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1861 |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1862 case sw_type: |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1863 |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1864 rc = ngx_http_v3_parse_varlen_int(c, &st->vlint, b); |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1865 if (rc != NGX_DONE) { |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1866 return rc; |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1867 } |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1868 |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1869 st->type = st->vlint.value; |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1870 |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1871 if (st->type == NGX_HTTP_V3_FRAME_HEADERS) { |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1872 /* trailers */ |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1873 goto done; |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1874 } |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1875 |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1876 if (ngx_http_v3_is_v2_frame(st->type) |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1877 || st->type == NGX_HTTP_V3_FRAME_GOAWAY |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1878 || st->type == NGX_HTTP_V3_FRAME_SETTINGS |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1879 || st->type == NGX_HTTP_V3_FRAME_MAX_PUSH_ID |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1880 || st->type == NGX_HTTP_V3_FRAME_CANCEL_PUSH |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1881 || st->type == NGX_HTTP_V3_FRAME_PUSH_PROMISE) |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1882 { |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1883 return NGX_HTTP_V3_ERR_FRAME_UNEXPECTED; |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1884 } |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1885 |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1886 st->state = sw_length; |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1887 break; |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1888 |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1889 case sw_length: |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1890 |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1891 rc = ngx_http_v3_parse_varlen_int(c, &st->vlint, b); |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1892 if (rc != NGX_DONE) { |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1893 return rc; |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1894 } |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1895 |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1896 st->length = st->vlint.value; |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1897 |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1898 ngx_log_debug2(NGX_LOG_DEBUG_HTTP, c->log, 0, |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1899 "http3 parse data type:%ui, len:%ui", |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1900 st->type, st->length); |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1901 |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1902 if (st->type != NGX_HTTP_V3_FRAME_DATA && st->length > 0) { |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1903 st->state = sw_skip; |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1904 break; |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1905 } |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1906 |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1907 st->state = sw_type; |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1908 return NGX_OK; |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1909 |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1910 case sw_skip: |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1911 |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1912 rc = ngx_http_v3_parse_skip(b, &st->length); |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1913 if (rc != NGX_DONE) { |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1914 return rc; |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1915 } |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1916 |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1917 st->state = sw_type; |
8087
d70a38acaea0
HTTP/3: skip unknown frames on request stream.
Roman Arutyunyan <arut@nginx.com>
parents:
8015
diff
changeset
|
1918 break; |
d70a38acaea0
HTTP/3: skip unknown frames on request stream.
Roman Arutyunyan <arut@nginx.com>
parents:
8015
diff
changeset
|
1919 } |
7761
5649079a41f4
Parsing HTTP/3 request body.
Roman Arutyunyan <arut@nginx.com>
parents:
7693
diff
changeset
|
1920 } |
5649079a41f4
Parsing HTTP/3 request body.
Roman Arutyunyan <arut@nginx.com>
parents:
7693
diff
changeset
|
1921 |
5649079a41f4
Parsing HTTP/3 request body.
Roman Arutyunyan <arut@nginx.com>
parents:
7693
diff
changeset
|
1922 done: |
5649079a41f4
Parsing HTTP/3 request body.
Roman Arutyunyan <arut@nginx.com>
parents:
7693
diff
changeset
|
1923 |
5649079a41f4
Parsing HTTP/3 request body.
Roman Arutyunyan <arut@nginx.com>
parents:
7693
diff
changeset
|
1924 ngx_log_debug0(NGX_LOG_DEBUG_HTTP, c->log, 0, "http3 parse data done"); |
5649079a41f4
Parsing HTTP/3 request body.
Roman Arutyunyan <arut@nginx.com>
parents:
7693
diff
changeset
|
1925 |
5649079a41f4
Parsing HTTP/3 request body.
Roman Arutyunyan <arut@nginx.com>
parents:
7693
diff
changeset
|
1926 st->state = sw_start; |
5649079a41f4
Parsing HTTP/3 request body.
Roman Arutyunyan <arut@nginx.com>
parents:
7693
diff
changeset
|
1927 return NGX_DONE; |
5649079a41f4
Parsing HTTP/3 request body.
Roman Arutyunyan <arut@nginx.com>
parents:
7693
diff
changeset
|
1928 } |
8432
345370fdd32d
HTTP/3: moved parsing uni stream type to ngx_http_v3_parse.c.
Roman Arutyunyan <arut@nginx.com>
parents:
8431
diff
changeset
|
1929 |
345370fdd32d
HTTP/3: moved parsing uni stream type to ngx_http_v3_parse.c.
Roman Arutyunyan <arut@nginx.com>
parents:
8431
diff
changeset
|
1930 |
345370fdd32d
HTTP/3: moved parsing uni stream type to ngx_http_v3_parse.c.
Roman Arutyunyan <arut@nginx.com>
parents:
8431
diff
changeset
|
1931 ngx_int_t |
345370fdd32d
HTTP/3: moved parsing uni stream type to ngx_http_v3_parse.c.
Roman Arutyunyan <arut@nginx.com>
parents:
8431
diff
changeset
|
1932 ngx_http_v3_parse_uni(ngx_connection_t *c, ngx_http_v3_parse_uni_t *st, |
8563
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1933 ngx_buf_t *b) |
8432
345370fdd32d
HTTP/3: moved parsing uni stream type to ngx_http_v3_parse.c.
Roman Arutyunyan <arut@nginx.com>
parents:
8431
diff
changeset
|
1934 { |
345370fdd32d
HTTP/3: moved parsing uni stream type to ngx_http_v3_parse.c.
Roman Arutyunyan <arut@nginx.com>
parents:
8431
diff
changeset
|
1935 ngx_int_t rc; |
345370fdd32d
HTTP/3: moved parsing uni stream type to ngx_http_v3_parse.c.
Roman Arutyunyan <arut@nginx.com>
parents:
8431
diff
changeset
|
1936 enum { |
345370fdd32d
HTTP/3: moved parsing uni stream type to ngx_http_v3_parse.c.
Roman Arutyunyan <arut@nginx.com>
parents:
8431
diff
changeset
|
1937 sw_start = 0, |
345370fdd32d
HTTP/3: moved parsing uni stream type to ngx_http_v3_parse.c.
Roman Arutyunyan <arut@nginx.com>
parents:
8431
diff
changeset
|
1938 sw_type, |
345370fdd32d
HTTP/3: moved parsing uni stream type to ngx_http_v3_parse.c.
Roman Arutyunyan <arut@nginx.com>
parents:
8431
diff
changeset
|
1939 sw_control, |
345370fdd32d
HTTP/3: moved parsing uni stream type to ngx_http_v3_parse.c.
Roman Arutyunyan <arut@nginx.com>
parents:
8431
diff
changeset
|
1940 sw_encoder, |
345370fdd32d
HTTP/3: moved parsing uni stream type to ngx_http_v3_parse.c.
Roman Arutyunyan <arut@nginx.com>
parents:
8431
diff
changeset
|
1941 sw_decoder, |
345370fdd32d
HTTP/3: moved parsing uni stream type to ngx_http_v3_parse.c.
Roman Arutyunyan <arut@nginx.com>
parents:
8431
diff
changeset
|
1942 sw_unknown |
345370fdd32d
HTTP/3: moved parsing uni stream type to ngx_http_v3_parse.c.
Roman Arutyunyan <arut@nginx.com>
parents:
8431
diff
changeset
|
1943 }; |
345370fdd32d
HTTP/3: moved parsing uni stream type to ngx_http_v3_parse.c.
Roman Arutyunyan <arut@nginx.com>
parents:
8431
diff
changeset
|
1944 |
8563
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1945 for ( ;; ) { |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1946 |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1947 switch (st->state) { |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1948 case sw_start: |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1949 |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1950 ngx_log_debug0(NGX_LOG_DEBUG_HTTP, c->log, 0, "http3 parse uni"); |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1951 |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1952 st->state = sw_type; |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1953 |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1954 /* fall through */ |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1955 |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1956 case sw_type: |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1957 |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1958 rc = ngx_http_v3_parse_varlen_int(c, &st->vlint, b); |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1959 if (rc != NGX_DONE) { |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1960 return rc; |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1961 } |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1962 |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1963 rc = ngx_http_v3_register_uni_stream(c, st->vlint.value); |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1964 if (rc != NGX_OK) { |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1965 return rc; |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1966 } |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1967 |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1968 switch (st->vlint.value) { |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1969 case NGX_HTTP_V3_STREAM_CONTROL: |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1970 st->state = sw_control; |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1971 break; |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1972 |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1973 case NGX_HTTP_V3_STREAM_ENCODER: |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1974 st->state = sw_encoder; |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1975 break; |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1976 |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1977 case NGX_HTTP_V3_STREAM_DECODER: |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1978 st->state = sw_decoder; |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1979 break; |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1980 |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1981 default: |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1982 st->state = sw_unknown; |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1983 } |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1984 |
8432
345370fdd32d
HTTP/3: moved parsing uni stream type to ngx_http_v3_parse.c.
Roman Arutyunyan <arut@nginx.com>
parents:
8431
diff
changeset
|
1985 break; |
345370fdd32d
HTTP/3: moved parsing uni stream type to ngx_http_v3_parse.c.
Roman Arutyunyan <arut@nginx.com>
parents:
8431
diff
changeset
|
1986 |
8563
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1987 case sw_control: |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1988 |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1989 return ngx_http_v3_parse_control(c, &st->u.control, b); |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1990 |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1991 case sw_encoder: |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1992 |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1993 return ngx_http_v3_parse_encoder(c, &st->u.encoder, b); |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1994 |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1995 case sw_decoder: |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1996 |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1997 return ngx_http_v3_parse_decoder(c, &st->u.decoder, b); |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1998 |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
1999 case sw_unknown: |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
2000 |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
2001 b->pos = b->last; |
d6e191a583cc
HTTP/3: bulk parse functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8508
diff
changeset
|
2002 return NGX_AGAIN; |
8432
345370fdd32d
HTTP/3: moved parsing uni stream type to ngx_http_v3_parse.c.
Roman Arutyunyan <arut@nginx.com>
parents:
8431
diff
changeset
|
2003 } |
345370fdd32d
HTTP/3: moved parsing uni stream type to ngx_http_v3_parse.c.
Roman Arutyunyan <arut@nginx.com>
parents:
8431
diff
changeset
|
2004 } |
345370fdd32d
HTTP/3: moved parsing uni stream type to ngx_http_v3_parse.c.
Roman Arutyunyan <arut@nginx.com>
parents:
8431
diff
changeset
|
2005 } |