Mercurial > hg > nginx
annotate src/http/v3/ngx_http_v3_encode.c @ 8837:8f0f6407ae23 quic
QUIC: Stateless Reset Token debug logging cleanup.
author | Sergey Kandaurov <pluknet@nginx.com> |
---|---|
date | Tue, 24 Aug 2021 14:41:31 +0300 |
parents | 0ac25efb2da3 |
children | b5a305db30e0 |
rev | line source |
---|---|
8215 | 1 |
2 /* | |
3 * Copyright (C) Roman Arutyunyan | |
4 * Copyright (C) Nginx, Inc. | |
5 */ | |
6 | |
7 | |
8 #include <ngx_config.h> | |
9 #include <ngx_core.h> | |
10 #include <ngx_http.h> | |
11 | |
12 | |
13 uintptr_t | |
14 ngx_http_v3_encode_varlen_int(u_char *p, uint64_t value) | |
15 { | |
16 if (value <= 63) { | |
17 if (p == NULL) { | |
18 return 1; | |
19 } | |
20 | |
21 *p++ = value; | |
22 return (uintptr_t) p; | |
23 } | |
24 | |
25 if (value <= 16383) { | |
26 if (p == NULL) { | |
27 return 2; | |
28 } | |
29 | |
30 *p++ = 0x40 | (value >> 8); | |
31 *p++ = value; | |
32 return (uintptr_t) p; | |
33 } | |
34 | |
35 if (value <= 1073741823) { | |
36 if (p == NULL) { | |
8349
b13176e717ba
HTTP/3: fixed encoding variable-length integers.
Roman Arutyunyan <arut@nginx.com>
parents:
8226
diff
changeset
|
37 return 4; |
8215 | 38 } |
39 | |
8349
b13176e717ba
HTTP/3: fixed encoding variable-length integers.
Roman Arutyunyan <arut@nginx.com>
parents:
8226
diff
changeset
|
40 *p++ = 0x80 | (value >> 24); |
b13176e717ba
HTTP/3: fixed encoding variable-length integers.
Roman Arutyunyan <arut@nginx.com>
parents:
8226
diff
changeset
|
41 *p++ = (value >> 16); |
8215 | 42 *p++ = (value >> 8); |
43 *p++ = value; | |
44 return (uintptr_t) p; | |
45 } | |
46 | |
47 if (p == NULL) { | |
8349
b13176e717ba
HTTP/3: fixed encoding variable-length integers.
Roman Arutyunyan <arut@nginx.com>
parents:
8226
diff
changeset
|
48 return 8; |
8215 | 49 } |
50 | |
8349
b13176e717ba
HTTP/3: fixed encoding variable-length integers.
Roman Arutyunyan <arut@nginx.com>
parents:
8226
diff
changeset
|
51 *p++ = 0xc0 | (value >> 56); |
b13176e717ba
HTTP/3: fixed encoding variable-length integers.
Roman Arutyunyan <arut@nginx.com>
parents:
8226
diff
changeset
|
52 *p++ = (value >> 48); |
b13176e717ba
HTTP/3: fixed encoding variable-length integers.
Roman Arutyunyan <arut@nginx.com>
parents:
8226
diff
changeset
|
53 *p++ = (value >> 40); |
b13176e717ba
HTTP/3: fixed encoding variable-length integers.
Roman Arutyunyan <arut@nginx.com>
parents:
8226
diff
changeset
|
54 *p++ = (value >> 32); |
b13176e717ba
HTTP/3: fixed encoding variable-length integers.
Roman Arutyunyan <arut@nginx.com>
parents:
8226
diff
changeset
|
55 *p++ = (value >> 24); |
8215 | 56 *p++ = (value >> 16); |
57 *p++ = (value >> 8); | |
58 *p++ = value; | |
59 return (uintptr_t) p; | |
60 } | |
61 | |
62 | |
63 uintptr_t | |
64 ngx_http_v3_encode_prefix_int(u_char *p, uint64_t value, ngx_uint_t prefix) | |
65 { | |
66 ngx_uint_t thresh, n; | |
67 | |
68 thresh = (1 << prefix) - 1; | |
69 | |
70 if (value < thresh) { | |
71 if (p == NULL) { | |
72 return 1; | |
73 } | |
74 | |
75 *p++ |= value; | |
76 return (uintptr_t) p; | |
77 } | |
78 | |
79 value -= thresh; | |
80 | |
8455
b0e81f49d7c0
HTTP/3: fixed prefixed integer encoding and decoding.
Roman Arutyunyan <arut@nginx.com>
parents:
8349
diff
changeset
|
81 if (p == NULL) { |
b0e81f49d7c0
HTTP/3: fixed prefixed integer encoding and decoding.
Roman Arutyunyan <arut@nginx.com>
parents:
8349
diff
changeset
|
82 for (n = 2; value >= 128; n++) { |
b0e81f49d7c0
HTTP/3: fixed prefixed integer encoding and decoding.
Roman Arutyunyan <arut@nginx.com>
parents:
8349
diff
changeset
|
83 value >>= 7; |
8215 | 84 } |
85 | |
8455
b0e81f49d7c0
HTTP/3: fixed prefixed integer encoding and decoding.
Roman Arutyunyan <arut@nginx.com>
parents:
8349
diff
changeset
|
86 return n; |
8215 | 87 } |
88 | |
89 *p++ |= thresh; | |
90 | |
8455
b0e81f49d7c0
HTTP/3: fixed prefixed integer encoding and decoding.
Roman Arutyunyan <arut@nginx.com>
parents:
8349
diff
changeset
|
91 while (value >= 128) { |
b0e81f49d7c0
HTTP/3: fixed prefixed integer encoding and decoding.
Roman Arutyunyan <arut@nginx.com>
parents:
8349
diff
changeset
|
92 *p++ = 0x80 | value; |
b0e81f49d7c0
HTTP/3: fixed prefixed integer encoding and decoding.
Roman Arutyunyan <arut@nginx.com>
parents:
8349
diff
changeset
|
93 value >>= 7; |
8215 | 94 } |
95 | |
8455
b0e81f49d7c0
HTTP/3: fixed prefixed integer encoding and decoding.
Roman Arutyunyan <arut@nginx.com>
parents:
8349
diff
changeset
|
96 *p++ = value; |
8215 | 97 |
98 return (uintptr_t) p; | |
99 } | |
8488
79125ef2e39f
HTTP/3: header encoding functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8455
diff
changeset
|
100 |
79125ef2e39f
HTTP/3: header encoding functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8455
diff
changeset
|
101 |
79125ef2e39f
HTTP/3: header encoding functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8455
diff
changeset
|
102 uintptr_t |
8807
0ac25efb2da3
HTTP/3: quic-qpack term updates.
Sergey Kandaurov <pluknet@nginx.com>
parents:
8534
diff
changeset
|
103 ngx_http_v3_encode_field_section_prefix(u_char *p, ngx_uint_t insert_count, |
8488
79125ef2e39f
HTTP/3: header encoding functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8455
diff
changeset
|
104 ngx_uint_t sign, ngx_uint_t delta_base) |
79125ef2e39f
HTTP/3: header encoding functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8455
diff
changeset
|
105 { |
79125ef2e39f
HTTP/3: header encoding functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8455
diff
changeset
|
106 if (p == NULL) { |
79125ef2e39f
HTTP/3: header encoding functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8455
diff
changeset
|
107 return ngx_http_v3_encode_prefix_int(NULL, insert_count, 8) |
79125ef2e39f
HTTP/3: header encoding functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8455
diff
changeset
|
108 + ngx_http_v3_encode_prefix_int(NULL, delta_base, 7); |
79125ef2e39f
HTTP/3: header encoding functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8455
diff
changeset
|
109 } |
79125ef2e39f
HTTP/3: header encoding functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8455
diff
changeset
|
110 |
79125ef2e39f
HTTP/3: header encoding functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8455
diff
changeset
|
111 *p = 0; |
79125ef2e39f
HTTP/3: header encoding functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8455
diff
changeset
|
112 p = (u_char *) ngx_http_v3_encode_prefix_int(p, insert_count, 8); |
79125ef2e39f
HTTP/3: header encoding functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8455
diff
changeset
|
113 |
79125ef2e39f
HTTP/3: header encoding functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8455
diff
changeset
|
114 *p = sign ? 0x80 : 0; |
79125ef2e39f
HTTP/3: header encoding functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8455
diff
changeset
|
115 p = (u_char *) ngx_http_v3_encode_prefix_int(p, delta_base, 7); |
79125ef2e39f
HTTP/3: header encoding functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8455
diff
changeset
|
116 |
79125ef2e39f
HTTP/3: header encoding functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8455
diff
changeset
|
117 return (uintptr_t) p; |
79125ef2e39f
HTTP/3: header encoding functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8455
diff
changeset
|
118 } |
79125ef2e39f
HTTP/3: header encoding functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8455
diff
changeset
|
119 |
79125ef2e39f
HTTP/3: header encoding functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8455
diff
changeset
|
120 |
79125ef2e39f
HTTP/3: header encoding functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8455
diff
changeset
|
121 uintptr_t |
8807
0ac25efb2da3
HTTP/3: quic-qpack term updates.
Sergey Kandaurov <pluknet@nginx.com>
parents:
8534
diff
changeset
|
122 ngx_http_v3_encode_field_ri(u_char *p, ngx_uint_t dynamic, ngx_uint_t index) |
8488
79125ef2e39f
HTTP/3: header encoding functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8455
diff
changeset
|
123 { |
8807
0ac25efb2da3
HTTP/3: quic-qpack term updates.
Sergey Kandaurov <pluknet@nginx.com>
parents:
8534
diff
changeset
|
124 /* Indexed Field Line */ |
8488
79125ef2e39f
HTTP/3: header encoding functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8455
diff
changeset
|
125 |
79125ef2e39f
HTTP/3: header encoding functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8455
diff
changeset
|
126 if (p == NULL) { |
79125ef2e39f
HTTP/3: header encoding functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8455
diff
changeset
|
127 return ngx_http_v3_encode_prefix_int(NULL, index, 6); |
79125ef2e39f
HTTP/3: header encoding functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8455
diff
changeset
|
128 } |
79125ef2e39f
HTTP/3: header encoding functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8455
diff
changeset
|
129 |
79125ef2e39f
HTTP/3: header encoding functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8455
diff
changeset
|
130 *p = dynamic ? 0x80 : 0xc0; |
79125ef2e39f
HTTP/3: header encoding functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8455
diff
changeset
|
131 |
79125ef2e39f
HTTP/3: header encoding functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8455
diff
changeset
|
132 return ngx_http_v3_encode_prefix_int(p, index, 6); |
79125ef2e39f
HTTP/3: header encoding functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8455
diff
changeset
|
133 } |
79125ef2e39f
HTTP/3: header encoding functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8455
diff
changeset
|
134 |
79125ef2e39f
HTTP/3: header encoding functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8455
diff
changeset
|
135 |
79125ef2e39f
HTTP/3: header encoding functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8455
diff
changeset
|
136 uintptr_t |
8807
0ac25efb2da3
HTTP/3: quic-qpack term updates.
Sergey Kandaurov <pluknet@nginx.com>
parents:
8534
diff
changeset
|
137 ngx_http_v3_encode_field_lri(u_char *p, ngx_uint_t dynamic, ngx_uint_t index, |
8488
79125ef2e39f
HTTP/3: header encoding functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8455
diff
changeset
|
138 u_char *data, size_t len) |
79125ef2e39f
HTTP/3: header encoding functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8455
diff
changeset
|
139 { |
8807
0ac25efb2da3
HTTP/3: quic-qpack term updates.
Sergey Kandaurov <pluknet@nginx.com>
parents:
8534
diff
changeset
|
140 /* Literal Field Line With Name Reference */ |
8488
79125ef2e39f
HTTP/3: header encoding functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8455
diff
changeset
|
141 |
79125ef2e39f
HTTP/3: header encoding functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8455
diff
changeset
|
142 if (p == NULL) { |
79125ef2e39f
HTTP/3: header encoding functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8455
diff
changeset
|
143 return ngx_http_v3_encode_prefix_int(NULL, index, 4) |
79125ef2e39f
HTTP/3: header encoding functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8455
diff
changeset
|
144 + ngx_http_v3_encode_prefix_int(NULL, len, 7) |
79125ef2e39f
HTTP/3: header encoding functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8455
diff
changeset
|
145 + len; |
79125ef2e39f
HTTP/3: header encoding functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8455
diff
changeset
|
146 } |
79125ef2e39f
HTTP/3: header encoding functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8455
diff
changeset
|
147 |
8534
985f9351dd87
HTTP/3: do not set the never-indexed literal bit by default.
Roman Arutyunyan <arut@nginx.com>
parents:
8491
diff
changeset
|
148 *p = dynamic ? 0x40 : 0x50; |
8488
79125ef2e39f
HTTP/3: header encoding functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8455
diff
changeset
|
149 p = (u_char *) ngx_http_v3_encode_prefix_int(p, index, 4); |
79125ef2e39f
HTTP/3: header encoding functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8455
diff
changeset
|
150 |
79125ef2e39f
HTTP/3: header encoding functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8455
diff
changeset
|
151 *p = 0; |
79125ef2e39f
HTTP/3: header encoding functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8455
diff
changeset
|
152 p = (u_char *) ngx_http_v3_encode_prefix_int(p, len, 7); |
79125ef2e39f
HTTP/3: header encoding functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8455
diff
changeset
|
153 |
79125ef2e39f
HTTP/3: header encoding functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8455
diff
changeset
|
154 if (data) { |
79125ef2e39f
HTTP/3: header encoding functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8455
diff
changeset
|
155 p = ngx_cpymem(p, data, len); |
79125ef2e39f
HTTP/3: header encoding functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8455
diff
changeset
|
156 } |
79125ef2e39f
HTTP/3: header encoding functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8455
diff
changeset
|
157 |
79125ef2e39f
HTTP/3: header encoding functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8455
diff
changeset
|
158 return (uintptr_t) p; |
79125ef2e39f
HTTP/3: header encoding functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8455
diff
changeset
|
159 } |
79125ef2e39f
HTTP/3: header encoding functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8455
diff
changeset
|
160 |
79125ef2e39f
HTTP/3: header encoding functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8455
diff
changeset
|
161 |
79125ef2e39f
HTTP/3: header encoding functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8455
diff
changeset
|
162 uintptr_t |
8807
0ac25efb2da3
HTTP/3: quic-qpack term updates.
Sergey Kandaurov <pluknet@nginx.com>
parents:
8534
diff
changeset
|
163 ngx_http_v3_encode_field_l(u_char *p, ngx_str_t *name, ngx_str_t *value) |
8488
79125ef2e39f
HTTP/3: header encoding functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8455
diff
changeset
|
164 { |
8807
0ac25efb2da3
HTTP/3: quic-qpack term updates.
Sergey Kandaurov <pluknet@nginx.com>
parents:
8534
diff
changeset
|
165 /* Literal Field Line With Literal Name */ |
8488
79125ef2e39f
HTTP/3: header encoding functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8455
diff
changeset
|
166 |
79125ef2e39f
HTTP/3: header encoding functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8455
diff
changeset
|
167 if (p == NULL) { |
79125ef2e39f
HTTP/3: header encoding functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8455
diff
changeset
|
168 return ngx_http_v3_encode_prefix_int(NULL, name->len, 3) |
79125ef2e39f
HTTP/3: header encoding functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8455
diff
changeset
|
169 + name->len |
79125ef2e39f
HTTP/3: header encoding functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8455
diff
changeset
|
170 + ngx_http_v3_encode_prefix_int(NULL, value->len, 7) |
79125ef2e39f
HTTP/3: header encoding functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8455
diff
changeset
|
171 + value->len; |
79125ef2e39f
HTTP/3: header encoding functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8455
diff
changeset
|
172 } |
79125ef2e39f
HTTP/3: header encoding functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8455
diff
changeset
|
173 |
8534
985f9351dd87
HTTP/3: do not set the never-indexed literal bit by default.
Roman Arutyunyan <arut@nginx.com>
parents:
8491
diff
changeset
|
174 *p = 0x20; |
8488
79125ef2e39f
HTTP/3: header encoding functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8455
diff
changeset
|
175 p = (u_char *) ngx_http_v3_encode_prefix_int(p, name->len, 3); |
79125ef2e39f
HTTP/3: header encoding functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8455
diff
changeset
|
176 |
79125ef2e39f
HTTP/3: header encoding functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8455
diff
changeset
|
177 ngx_strlow(p, name->data, name->len); |
79125ef2e39f
HTTP/3: header encoding functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8455
diff
changeset
|
178 p += name->len; |
79125ef2e39f
HTTP/3: header encoding functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8455
diff
changeset
|
179 |
79125ef2e39f
HTTP/3: header encoding functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8455
diff
changeset
|
180 *p = 0; |
79125ef2e39f
HTTP/3: header encoding functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8455
diff
changeset
|
181 p = (u_char *) ngx_http_v3_encode_prefix_int(p, value->len, 7); |
79125ef2e39f
HTTP/3: header encoding functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8455
diff
changeset
|
182 |
79125ef2e39f
HTTP/3: header encoding functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8455
diff
changeset
|
183 p = ngx_cpymem(p, value->data, value->len); |
79125ef2e39f
HTTP/3: header encoding functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8455
diff
changeset
|
184 |
79125ef2e39f
HTTP/3: header encoding functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8455
diff
changeset
|
185 return (uintptr_t) p; |
79125ef2e39f
HTTP/3: header encoding functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8455
diff
changeset
|
186 } |
79125ef2e39f
HTTP/3: header encoding functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8455
diff
changeset
|
187 |
79125ef2e39f
HTTP/3: header encoding functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8455
diff
changeset
|
188 |
79125ef2e39f
HTTP/3: header encoding functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8455
diff
changeset
|
189 uintptr_t |
8807
0ac25efb2da3
HTTP/3: quic-qpack term updates.
Sergey Kandaurov <pluknet@nginx.com>
parents:
8534
diff
changeset
|
190 ngx_http_v3_encode_field_pbi(u_char *p, ngx_uint_t index) |
8488
79125ef2e39f
HTTP/3: header encoding functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8455
diff
changeset
|
191 { |
8807
0ac25efb2da3
HTTP/3: quic-qpack term updates.
Sergey Kandaurov <pluknet@nginx.com>
parents:
8534
diff
changeset
|
192 /* Indexed Field Line With Post-Base Index */ |
8488
79125ef2e39f
HTTP/3: header encoding functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8455
diff
changeset
|
193 |
79125ef2e39f
HTTP/3: header encoding functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8455
diff
changeset
|
194 if (p == NULL) { |
79125ef2e39f
HTTP/3: header encoding functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8455
diff
changeset
|
195 return ngx_http_v3_encode_prefix_int(NULL, index, 4); |
79125ef2e39f
HTTP/3: header encoding functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8455
diff
changeset
|
196 } |
79125ef2e39f
HTTP/3: header encoding functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8455
diff
changeset
|
197 |
79125ef2e39f
HTTP/3: header encoding functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8455
diff
changeset
|
198 *p = 0x10; |
79125ef2e39f
HTTP/3: header encoding functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8455
diff
changeset
|
199 |
79125ef2e39f
HTTP/3: header encoding functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8455
diff
changeset
|
200 return ngx_http_v3_encode_prefix_int(p, index, 4); |
79125ef2e39f
HTTP/3: header encoding functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8455
diff
changeset
|
201 } |
79125ef2e39f
HTTP/3: header encoding functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8455
diff
changeset
|
202 |
79125ef2e39f
HTTP/3: header encoding functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8455
diff
changeset
|
203 |
79125ef2e39f
HTTP/3: header encoding functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8455
diff
changeset
|
204 uintptr_t |
8807
0ac25efb2da3
HTTP/3: quic-qpack term updates.
Sergey Kandaurov <pluknet@nginx.com>
parents:
8534
diff
changeset
|
205 ngx_http_v3_encode_field_lpbi(u_char *p, ngx_uint_t index, u_char *data, |
8488
79125ef2e39f
HTTP/3: header encoding functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8455
diff
changeset
|
206 size_t len) |
79125ef2e39f
HTTP/3: header encoding functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8455
diff
changeset
|
207 { |
8807
0ac25efb2da3
HTTP/3: quic-qpack term updates.
Sergey Kandaurov <pluknet@nginx.com>
parents:
8534
diff
changeset
|
208 /* Literal Field Line With Post-Base Name Reference */ |
8488
79125ef2e39f
HTTP/3: header encoding functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8455
diff
changeset
|
209 |
79125ef2e39f
HTTP/3: header encoding functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8455
diff
changeset
|
210 if (p == NULL) { |
79125ef2e39f
HTTP/3: header encoding functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8455
diff
changeset
|
211 return ngx_http_v3_encode_prefix_int(NULL, index, 3) |
79125ef2e39f
HTTP/3: header encoding functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8455
diff
changeset
|
212 + ngx_http_v3_encode_prefix_int(NULL, len, 7) |
79125ef2e39f
HTTP/3: header encoding functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8455
diff
changeset
|
213 + len; |
79125ef2e39f
HTTP/3: header encoding functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8455
diff
changeset
|
214 } |
79125ef2e39f
HTTP/3: header encoding functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8455
diff
changeset
|
215 |
8534
985f9351dd87
HTTP/3: do not set the never-indexed literal bit by default.
Roman Arutyunyan <arut@nginx.com>
parents:
8491
diff
changeset
|
216 *p = 0; |
8488
79125ef2e39f
HTTP/3: header encoding functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8455
diff
changeset
|
217 p = (u_char *) ngx_http_v3_encode_prefix_int(p, index, 3); |
79125ef2e39f
HTTP/3: header encoding functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8455
diff
changeset
|
218 |
79125ef2e39f
HTTP/3: header encoding functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8455
diff
changeset
|
219 *p = 0; |
79125ef2e39f
HTTP/3: header encoding functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8455
diff
changeset
|
220 p = (u_char *) ngx_http_v3_encode_prefix_int(p, len, 7); |
79125ef2e39f
HTTP/3: header encoding functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8455
diff
changeset
|
221 |
79125ef2e39f
HTTP/3: header encoding functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8455
diff
changeset
|
222 if (data) { |
79125ef2e39f
HTTP/3: header encoding functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8455
diff
changeset
|
223 p = ngx_cpymem(p, data, len); |
79125ef2e39f
HTTP/3: header encoding functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8455
diff
changeset
|
224 } |
79125ef2e39f
HTTP/3: header encoding functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8455
diff
changeset
|
225 |
79125ef2e39f
HTTP/3: header encoding functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8455
diff
changeset
|
226 return (uintptr_t) p; |
79125ef2e39f
HTTP/3: header encoding functions.
Roman Arutyunyan <arut@nginx.com>
parents:
8455
diff
changeset
|
227 } |