rwebtransport 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Cargo.lock +666 -0
- package/Cargo.toml +31 -0
- package/LICENSE +202 -0
- package/NOTICE +41 -0
- package/README.md +550 -0
- package/crates/echo-server/Cargo.toml +20 -0
- package/crates/echo-server/src/main.rs +666 -0
- package/crates/native/Cargo.toml +23 -0
- package/crates/native/src/config.rs +129 -0
- package/crates/native/src/driver.rs +463 -0
- package/crates/native/src/lib.rs +821 -0
- package/crates/native/src/server.rs +718 -0
- package/crates/native/src/session.rs +1191 -0
- package/crates/native/src/tls.rs +96 -0
- package/crates/wtcore/Cargo.toml +15 -0
- package/crates/wtcore/src/h3.rs +226 -0
- package/crates/wtcore/src/lib.rs +9 -0
- package/dist/datagrams.d.ts +16 -0
- package/dist/errors.d.ts +10 -0
- package/dist/index.d.ts +7 -0
- package/dist/index.js +1512 -0
- package/dist/index.js.map +1 -0
- package/dist/index.mjs +1473 -0
- package/dist/index.mjs.map +1 -0
- package/dist/loader.d.ts +2 -0
- package/dist/native.d.ts +226 -0
- package/dist/server.d.ts +44 -0
- package/dist/streams.d.ts +14 -0
- package/dist/types.d.ts +24 -0
- package/dist/webtransport.d.ts +20 -0
- package/package.json +79 -0
- package/prebuilds/win32-x64/rwebtransport.node +0 -0
- package/scripts/bench.mjs +180 -0
- package/scripts/build.js +67 -0
- package/scripts/postinstall.js +67 -0
- package/scripts/setup-unix.sh +129 -0
- package/scripts/setup-windows.ps1 +229 -0
- package/vendor/quiche/AGENTS.md +75 -0
- package/vendor/quiche/COPYING +23 -0
- package/vendor/quiche/Cargo.lock +1212 -0
- package/vendor/quiche/Cargo.toml +215 -0
- package/vendor/quiche/README.md +466 -0
- package/vendor/quiche/examples/Makefile +46 -0
- package/vendor/quiche/examples/README.md +20 -0
- package/vendor/quiche/examples/cert-big.crt +90 -0
- package/vendor/quiche/examples/cert.crt +18 -0
- package/vendor/quiche/examples/cert.key +28 -0
- package/vendor/quiche/examples/client.c +343 -0
- package/vendor/quiche/examples/client.rs +281 -0
- package/vendor/quiche/examples/gen-certs.sh +15 -0
- package/vendor/quiche/examples/http3-client.c +473 -0
- package/vendor/quiche/examples/http3-client.rs +349 -0
- package/vendor/quiche/examples/http3-server.c +614 -0
- package/vendor/quiche/examples/http3-server.rs +680 -0
- package/vendor/quiche/examples/qpack-decode.rs +87 -0
- package/vendor/quiche/examples/qpack-encode.rs +88 -0
- package/vendor/quiche/examples/rootca.crt +21 -0
- package/vendor/quiche/examples/server.c +529 -0
- package/vendor/quiche/examples/server.rs +529 -0
- package/vendor/quiche/include/quiche.h +1282 -0
- package/vendor/quiche/quiche.svg +1 -0
- package/vendor/quiche/src/buffers.rs +105 -0
- package/vendor/quiche/src/build.rs +66 -0
- package/vendor/quiche/src/cid.rs +1079 -0
- package/vendor/quiche/src/crypto/boringssl.rs +373 -0
- package/vendor/quiche/src/crypto/mod.rs +671 -0
- package/vendor/quiche/src/dgram.rs +118 -0
- package/vendor/quiche/src/error.rs +263 -0
- package/vendor/quiche/src/ffi.rs +2290 -0
- package/vendor/quiche/src/flowcontrol.rs +246 -0
- package/vendor/quiche/src/frame.rs +2172 -0
- package/vendor/quiche/src/h3/AGENTS.md +54 -0
- package/vendor/quiche/src/h3/ffi.rs +442 -0
- package/vendor/quiche/src/h3/frame.rs +1404 -0
- package/vendor/quiche/src/h3/mod.rs +8223 -0
- package/vendor/quiche/src/h3/qpack/decoder.rs +288 -0
- package/vendor/quiche/src/h3/qpack/encoder.rs +235 -0
- package/vendor/quiche/src/h3/qpack/mod.rs +202 -0
- package/vendor/quiche/src/h3/qpack/static_table.rs +323 -0
- package/vendor/quiche/src/h3/stream.rs +1595 -0
- package/vendor/quiche/src/lib.rs +9556 -0
- package/vendor/quiche/src/minmax.rs +446 -0
- package/vendor/quiche/src/packet.rs +2334 -0
- package/vendor/quiche/src/path.rs +1374 -0
- package/vendor/quiche/src/pmtud.rs +652 -0
- package/vendor/quiche/src/rand.rs +64 -0
- package/vendor/quiche/src/range_buf.rs +186 -0
- package/vendor/quiche/src/ranges.rs +755 -0
- package/vendor/quiche/src/recovery/AGENTS.md +80 -0
- package/vendor/quiche/src/recovery/bandwidth.rs +565 -0
- package/vendor/quiche/src/recovery/bytes_in_flight.rs +179 -0
- package/vendor/quiche/src/recovery/congestion/cubic.rs +1038 -0
- package/vendor/quiche/src/recovery/congestion/delivery_rate.rs +514 -0
- package/vendor/quiche/src/recovery/congestion/hystart.rs +241 -0
- package/vendor/quiche/src/recovery/congestion/mod.rs +361 -0
- package/vendor/quiche/src/recovery/congestion/prr.rs +238 -0
- package/vendor/quiche/src/recovery/congestion/recovery.rs +1170 -0
- package/vendor/quiche/src/recovery/congestion/reno.rs +291 -0
- package/vendor/quiche/src/recovery/congestion/test_sender.rs +201 -0
- package/vendor/quiche/src/recovery/gcongestion/bbr/bandwidth_sampler.rs +1947 -0
- package/vendor/quiche/src/recovery/gcongestion/bbr/windowed_filter.rs +158 -0
- package/vendor/quiche/src/recovery/gcongestion/bbr.rs +37 -0
- package/vendor/quiche/src/recovery/gcongestion/bbr2/drain.rs +120 -0
- package/vendor/quiche/src/recovery/gcongestion/bbr2/mode.rs +318 -0
- package/vendor/quiche/src/recovery/gcongestion/bbr2/network_model.rs +784 -0
- package/vendor/quiche/src/recovery/gcongestion/bbr2/probe_bw.rs +729 -0
- package/vendor/quiche/src/recovery/gcongestion/bbr2/probe_rtt.rs +175 -0
- package/vendor/quiche/src/recovery/gcongestion/bbr2/startup.rs +190 -0
- package/vendor/quiche/src/recovery/gcongestion/bbr2.rs +855 -0
- package/vendor/quiche/src/recovery/gcongestion/mod.rs +275 -0
- package/vendor/quiche/src/recovery/gcongestion/pacer.rs +294 -0
- package/vendor/quiche/src/recovery/gcongestion/recovery.rs +1384 -0
- package/vendor/quiche/src/recovery/mod.rs +3086 -0
- package/vendor/quiche/src/recovery/rtt.rs +152 -0
- package/vendor/quiche/src/stream/mod.rs +2210 -0
- package/vendor/quiche/src/stream/recv_buf.rs +1236 -0
- package/vendor/quiche/src/stream/send_buf.rs +849 -0
- package/vendor/quiche/src/test_utils.rs +681 -0
- package/vendor/quiche/src/tests.rs +12922 -0
- package/vendor/quiche/src/tls/boringssl.rs +375 -0
- package/vendor/quiche/src/tls/mod.rs +1245 -0
- package/vendor/quiche/src/transport_params.rs +628 -0
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
// Copyright (C) 2019, Cloudflare, Inc.
|
|
2
|
+
// All rights reserved.
|
|
3
|
+
//
|
|
4
|
+
// Redistribution and use in source and binary forms, with or without
|
|
5
|
+
// modification, are permitted provided that the following conditions are
|
|
6
|
+
// met:
|
|
7
|
+
//
|
|
8
|
+
// * Redistributions of source code must retain the above copyright notice,
|
|
9
|
+
// this list of conditions and the following disclaimer.
|
|
10
|
+
//
|
|
11
|
+
// * Redistributions in binary form must reproduce the above copyright
|
|
12
|
+
// notice, this list of conditions and the following disclaimer in the
|
|
13
|
+
// documentation and/or other materials provided with the distribution.
|
|
14
|
+
//
|
|
15
|
+
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
|
|
16
|
+
// IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
|
|
17
|
+
// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
|
18
|
+
// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
|
|
19
|
+
// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
|
20
|
+
// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
|
21
|
+
// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
|
22
|
+
// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
|
23
|
+
// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
|
24
|
+
// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
|
25
|
+
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
26
|
+
|
|
27
|
+
//! HTTP/3 header compression (QPACK).
|
|
28
|
+
|
|
29
|
+
pub use encoder::encode_int;
|
|
30
|
+
pub use encoder::encode_str;
|
|
31
|
+
|
|
32
|
+
pub const INDEXED: u8 = 0b1000_0000;
|
|
33
|
+
pub const INDEXED_WITH_POST_BASE: u8 = 0b0001_0000;
|
|
34
|
+
pub const LITERAL: u8 = 0b0010_0000;
|
|
35
|
+
pub const LITERAL_WITH_NAME_REF: u8 = 0b0100_0000;
|
|
36
|
+
|
|
37
|
+
/// A specialized [`Result`] type for quiche QPACK operations.
|
|
38
|
+
///
|
|
39
|
+
/// This type is used throughout quiche's QPACK public API for any operation
|
|
40
|
+
/// that can produce an error.
|
|
41
|
+
///
|
|
42
|
+
/// [`Result`]: https://doc.rust-lang.org/std/result/enum.Result.html
|
|
43
|
+
pub type Result<T> = std::result::Result<T, Error>;
|
|
44
|
+
|
|
45
|
+
/// A QPACK error.
|
|
46
|
+
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
|
|
47
|
+
pub enum Error {
|
|
48
|
+
/// The provided buffer is too short.
|
|
49
|
+
BufferTooShort,
|
|
50
|
+
|
|
51
|
+
/// The QPACK header block's huffman encoding is invalid.
|
|
52
|
+
InvalidHuffmanEncoding,
|
|
53
|
+
|
|
54
|
+
/// The QPACK static table index provided doesn't exist.
|
|
55
|
+
InvalidStaticTableIndex,
|
|
56
|
+
|
|
57
|
+
/// The decoded QPACK header name or value is not valid.
|
|
58
|
+
InvalidHeaderValue,
|
|
59
|
+
|
|
60
|
+
/// The decoded header list exceeded the size limit.
|
|
61
|
+
HeaderListTooLarge,
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
impl std::fmt::Display for Error {
|
|
65
|
+
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
|
|
66
|
+
write!(f, "{self:?}")
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
impl std::error::Error for Error {
|
|
71
|
+
fn source(&self) -> Option<&(dyn std::error::Error + 'static)> {
|
|
72
|
+
None
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
impl From<octets::BufferTooShortError> for Error {
|
|
77
|
+
fn from(_err: octets::BufferTooShortError) -> Self {
|
|
78
|
+
Error::BufferTooShort
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
#[cfg(test)]
|
|
83
|
+
mod tests {
|
|
84
|
+
use crate::*;
|
|
85
|
+
|
|
86
|
+
use super::*;
|
|
87
|
+
|
|
88
|
+
#[test]
|
|
89
|
+
fn encode_decode() {
|
|
90
|
+
let mut encoded = [0u8; 240];
|
|
91
|
+
|
|
92
|
+
let headers = vec![
|
|
93
|
+
h3::Header::new(b":path", b"/rsrc.php/v3/yn/r/rIPZ9Qkrdd9.png"),
|
|
94
|
+
h3::Header::new(b"accept-encoding", b"gzip, deflate, br"),
|
|
95
|
+
h3::Header::new(b"accept-language", b"en-US,en;q=0.9"),
|
|
96
|
+
h3::Header::new(b"user-agent", b"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/63.0.3239.70 Safari/537.36"),
|
|
97
|
+
h3::Header::new(b"accept", b"image/webp,image/apng,image/*,*/*;q=0.8"),
|
|
98
|
+
h3::Header::new(b"referer", b"https://static.xx.fbcdn.net/rsrc.php/v3/yT/l/0,cross/dzXGESIlGQQ.css"),
|
|
99
|
+
h3::Header::new(b":authority", b"static.xx.fbcdn.net"),
|
|
100
|
+
h3::Header::new(b":scheme", b"https"),
|
|
101
|
+
h3::Header::new(b":method", b"GET"),
|
|
102
|
+
];
|
|
103
|
+
|
|
104
|
+
let mut enc = Encoder::new();
|
|
105
|
+
assert_eq!(enc.encode(&headers, &mut encoded), Ok(240));
|
|
106
|
+
|
|
107
|
+
let mut dec = Decoder::new();
|
|
108
|
+
assert_eq!(dec.decode(&encoded, u64::MAX), Ok(headers));
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
#[test]
|
|
112
|
+
fn lower_case() {
|
|
113
|
+
let mut encoded = [0u8; 35];
|
|
114
|
+
|
|
115
|
+
let headers_expected = vec![
|
|
116
|
+
h3::Header::new(b":status", b"200"),
|
|
117
|
+
h3::Header::new(b":path", b"/HeLlO"),
|
|
118
|
+
h3::Header::new(b"woot", b"woot"),
|
|
119
|
+
h3::Header::new(b"hello", b"WorlD"),
|
|
120
|
+
h3::Header::new(b"foo", b"BaR"),
|
|
121
|
+
];
|
|
122
|
+
|
|
123
|
+
// Header.
|
|
124
|
+
let headers_in = vec![
|
|
125
|
+
h3::Header::new(b":StAtUs", b"200"),
|
|
126
|
+
h3::Header::new(b":PaTh", b"/HeLlO"),
|
|
127
|
+
h3::Header::new(b"WooT", b"woot"),
|
|
128
|
+
h3::Header::new(b"hello", b"WorlD"),
|
|
129
|
+
h3::Header::new(b"fOo", b"BaR"),
|
|
130
|
+
];
|
|
131
|
+
|
|
132
|
+
let mut enc = Encoder::new();
|
|
133
|
+
assert_eq!(enc.encode(&headers_in, &mut encoded), Ok(35));
|
|
134
|
+
|
|
135
|
+
let mut dec = Decoder::new();
|
|
136
|
+
let headers_out = dec.decode(&encoded, u64::MAX).unwrap();
|
|
137
|
+
|
|
138
|
+
assert_eq!(headers_expected, headers_out);
|
|
139
|
+
|
|
140
|
+
// HeaderRef.
|
|
141
|
+
let headers_in = vec![
|
|
142
|
+
h3::HeaderRef::new(b":StAtUs", b"200"),
|
|
143
|
+
h3::HeaderRef::new(b":PaTh", b"/HeLlO"),
|
|
144
|
+
h3::HeaderRef::new(b"WooT", b"woot"),
|
|
145
|
+
h3::HeaderRef::new(b"hello", b"WorlD"),
|
|
146
|
+
h3::HeaderRef::new(b"fOo", b"BaR"),
|
|
147
|
+
];
|
|
148
|
+
|
|
149
|
+
let mut enc = Encoder::new();
|
|
150
|
+
assert_eq!(enc.encode(&headers_in, &mut encoded), Ok(35));
|
|
151
|
+
|
|
152
|
+
let mut dec = Decoder::new();
|
|
153
|
+
let headers_out = dec.decode(&encoded, u64::MAX).unwrap();
|
|
154
|
+
|
|
155
|
+
assert_eq!(headers_expected, headers_out);
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
#[test]
|
|
159
|
+
fn lower_ascii_range() {
|
|
160
|
+
let mut encoded = [0u8; 50];
|
|
161
|
+
let mut enc = Encoder::new();
|
|
162
|
+
|
|
163
|
+
// Indexed name with literal value
|
|
164
|
+
let headers1 = vec![h3::Header::new(b"location", b" ")];
|
|
165
|
+
assert_eq!(enc.encode(&headers1, &mut encoded), Ok(19));
|
|
166
|
+
|
|
167
|
+
// Literal name and value
|
|
168
|
+
let headers2 = vec![h3::Header::new(b"a", b"")];
|
|
169
|
+
assert_eq!(enc.encode(&headers2, &mut encoded), Ok(20));
|
|
170
|
+
|
|
171
|
+
let headers3 = vec![h3::Header::new(b" ", b"hello")];
|
|
172
|
+
assert_eq!(enc.encode(&headers3, &mut encoded), Ok(24));
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
#[test]
|
|
176
|
+
fn extended_ascii_range() {
|
|
177
|
+
let mut encoded = [0u8; 50];
|
|
178
|
+
let mut enc = Encoder::new();
|
|
179
|
+
|
|
180
|
+
let name = b"location";
|
|
181
|
+
let value = "£££££££££££££££";
|
|
182
|
+
|
|
183
|
+
// Indexed name with literal value
|
|
184
|
+
let headers1 = vec![h3::Header::new(name, value.as_bytes())];
|
|
185
|
+
assert_eq!(enc.encode(&headers1, &mut encoded), Ok(34));
|
|
186
|
+
|
|
187
|
+
// Literal name and value
|
|
188
|
+
let value = "ððððððððððððððð";
|
|
189
|
+
let headers2 = vec![h3::Header::new(b"a", value.as_bytes())];
|
|
190
|
+
assert_eq!(enc.encode(&headers2, &mut encoded), Ok(35));
|
|
191
|
+
|
|
192
|
+
let headers3 = vec![h3::Header::new(value.as_bytes(), b"hello")];
|
|
193
|
+
assert_eq!(enc.encode(&headers3, &mut encoded), Ok(39));
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
pub use decoder::Decoder;
|
|
198
|
+
pub use encoder::Encoder;
|
|
199
|
+
|
|
200
|
+
mod decoder;
|
|
201
|
+
mod encoder;
|
|
202
|
+
mod static_table;
|
|
@@ -0,0 +1,323 @@
|
|
|
1
|
+
// Copyright (C) 2020, Cloudflare, Inc.
|
|
2
|
+
// All rights reserved.
|
|
3
|
+
//
|
|
4
|
+
// Redistribution and use in source and binary forms, with or without
|
|
5
|
+
// modification, are permitted provided that the following conditions are
|
|
6
|
+
// met:
|
|
7
|
+
//
|
|
8
|
+
// * Redistributions of source code must retain the above copyright notice,
|
|
9
|
+
// this list of conditions and the following disclaimer.
|
|
10
|
+
//
|
|
11
|
+
// * Redistributions in binary form must reproduce the above copyright
|
|
12
|
+
// notice, this list of conditions and the following disclaimer in the
|
|
13
|
+
// documentation and/or other materials provided with the distribution.
|
|
14
|
+
//
|
|
15
|
+
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
|
|
16
|
+
// IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
|
|
17
|
+
// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
|
18
|
+
// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
|
|
19
|
+
// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
|
20
|
+
// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
|
21
|
+
// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
|
22
|
+
// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
|
23
|
+
// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
|
24
|
+
// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
|
25
|
+
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
26
|
+
|
|
27
|
+
/// This table maps the statically encoded QPACK entries to their
|
|
28
|
+
/// index. The mapping is from name length to a list of names of this
|
|
29
|
+
/// length, with the list of possible values for that name and the proper
|
|
30
|
+
/// encoding for this name: value pair.
|
|
31
|
+
type HeaderName = &'static [u8];
|
|
32
|
+
type HeaderValue = &'static [u8];
|
|
33
|
+
type HeaderValueEncPairs = &'static [(HeaderValue, u64)];
|
|
34
|
+
pub const STATIC_ENCODE_TABLE: &[&[(HeaderName, HeaderValueEncPairs)]] = &[
|
|
35
|
+
// Headers of len 0
|
|
36
|
+
&[],
|
|
37
|
+
// Headers of len 1
|
|
38
|
+
&[],
|
|
39
|
+
// Headers of len 2
|
|
40
|
+
&[],
|
|
41
|
+
// Headers of len 3
|
|
42
|
+
&[(b"age", &[(b"0", 2)])],
|
|
43
|
+
// Headers of len 4
|
|
44
|
+
&[
|
|
45
|
+
(b"etag", &[(b"", 7)]),
|
|
46
|
+
(b"date", &[(b"", 6)]),
|
|
47
|
+
(b"link", &[(b"", 11)]),
|
|
48
|
+
(b"vary", &[(b"accept-encoding", 59), (b"origin", 60)]),
|
|
49
|
+
],
|
|
50
|
+
// Headers of len 5
|
|
51
|
+
&[(b"range", &[(b"bytes=0-", 55)]), (b":path", &[(b"/", 1)])],
|
|
52
|
+
// Headers of len 6
|
|
53
|
+
&[
|
|
54
|
+
(b"cookie", &[(b"", 5)]),
|
|
55
|
+
(b"origin", &[(b"", 90)]),
|
|
56
|
+
(b"server", &[(b"", 92)]),
|
|
57
|
+
(b"accept", &[(b"*/*", 29), (b"application/dns-message", 30)]),
|
|
58
|
+
],
|
|
59
|
+
// Headers of len 7
|
|
60
|
+
&[
|
|
61
|
+
(b"purpose", &[(b"prefetch", 91)]),
|
|
62
|
+
(b"referer", &[(b"", 13)]),
|
|
63
|
+
(b"alt-svc", &[(b"clear", 83)]),
|
|
64
|
+
(b":status", &[
|
|
65
|
+
(b"103", 24),
|
|
66
|
+
(b"200", 25),
|
|
67
|
+
(b"304", 26),
|
|
68
|
+
(b"404", 27),
|
|
69
|
+
(b"503", 28),
|
|
70
|
+
(b"100", 63),
|
|
71
|
+
(b"204", 64),
|
|
72
|
+
(b"206", 65),
|
|
73
|
+
(b"302", 66),
|
|
74
|
+
(b"400", 67),
|
|
75
|
+
(b"403", 68),
|
|
76
|
+
(b"421", 69),
|
|
77
|
+
(b"425", 70),
|
|
78
|
+
(b"500", 71),
|
|
79
|
+
]),
|
|
80
|
+
(b":scheme", &[(b"http", 22), (b"https", 23)]),
|
|
81
|
+
(b":method", &[
|
|
82
|
+
(b"CONNECT", 15),
|
|
83
|
+
(b"DELETE", 16),
|
|
84
|
+
(b"GET", 17),
|
|
85
|
+
(b"HEAD", 18),
|
|
86
|
+
(b"OPTIONS", 19),
|
|
87
|
+
(b"POST", 20),
|
|
88
|
+
(b"PUT", 21),
|
|
89
|
+
]),
|
|
90
|
+
],
|
|
91
|
+
// Headers of len 8
|
|
92
|
+
&[(b"location", &[(b"", 12)]), (b"if-range", &[(b"", 89)])],
|
|
93
|
+
// Headers of len 9
|
|
94
|
+
&[(b"expect-ct", &[(b"", 87)]), (b"forwarded", &[(b"", 88)])],
|
|
95
|
+
// Headers of len 10
|
|
96
|
+
&[
|
|
97
|
+
(b"user-agent", &[(b"", 95)]),
|
|
98
|
+
(b":authority", &[(b"", 0)]),
|
|
99
|
+
(b"set-cookie", &[(b"", 14)]),
|
|
100
|
+
(b"early-data", &[(b"1", 86)]),
|
|
101
|
+
],
|
|
102
|
+
// Headers of len 11
|
|
103
|
+
&[],
|
|
104
|
+
// Headers of len 12
|
|
105
|
+
&[(b"content-type", &[
|
|
106
|
+
(b"application/dns-message", 44),
|
|
107
|
+
(b"application/javascript", 45),
|
|
108
|
+
(b"application/json", 46),
|
|
109
|
+
(b"application/x-www-form-urlencoded", 47),
|
|
110
|
+
(b"image/gif", 48),
|
|
111
|
+
(b"image/jpeg", 49),
|
|
112
|
+
(b"image/png", 50),
|
|
113
|
+
(b"text/css", 51),
|
|
114
|
+
(b"text/html; charset=utf-8", 52),
|
|
115
|
+
(b"text/plain", 53),
|
|
116
|
+
(b"text/plain;charset=utf-8", 54),
|
|
117
|
+
])],
|
|
118
|
+
// Headers of len 13
|
|
119
|
+
&[
|
|
120
|
+
(b"last-modified", &[(b"", 10)]),
|
|
121
|
+
(b"accept-ranges", &[(b"bytes", 32)]),
|
|
122
|
+
(b"authorization", &[(b"", 84)]),
|
|
123
|
+
(b"if-none-match", &[(b"", 9)]),
|
|
124
|
+
(b"cache-control", &[
|
|
125
|
+
(b"max-age=0", 36),
|
|
126
|
+
(b"max-age=2592000", 37),
|
|
127
|
+
(b"max-age=604800", 38),
|
|
128
|
+
(b"no-cache", 39),
|
|
129
|
+
(b"no-store", 40),
|
|
130
|
+
(b"public, max-age=31536000", 41),
|
|
131
|
+
]),
|
|
132
|
+
],
|
|
133
|
+
// Headers of len 14
|
|
134
|
+
&[(b"content-length", &[(b"0", 4)])],
|
|
135
|
+
// Headers of len 15
|
|
136
|
+
&[
|
|
137
|
+
(b"accept-encoding", &[(b"gzip, deflate, br", 31)]),
|
|
138
|
+
(b"x-forwarded-for", &[(b"", 96)]),
|
|
139
|
+
(b"accept-language", &[(b"", 72)]),
|
|
140
|
+
(b"x-frame-options", &[(b"deny", 97), (b"sameorigin", 98)]),
|
|
141
|
+
],
|
|
142
|
+
// Headers of len 16
|
|
143
|
+
&[
|
|
144
|
+
(b"content-encoding", &[(b"br", 42), (b"gzip", 43)]),
|
|
145
|
+
(b"x-xss-protection", &[(b"1; mode=block", 62)]),
|
|
146
|
+
],
|
|
147
|
+
// Headers of len 17
|
|
148
|
+
&[(b"if-modified-since", &[(b"", 8)])],
|
|
149
|
+
// Headers of len 18
|
|
150
|
+
&[],
|
|
151
|
+
// Headers of len 19
|
|
152
|
+
&[
|
|
153
|
+
(b"content-disposition", &[(b"", 3)]),
|
|
154
|
+
(b"timing-allow-origin", &[(b"*", 93)]),
|
|
155
|
+
],
|
|
156
|
+
// Headers of len 20
|
|
157
|
+
&[],
|
|
158
|
+
// Headers of len 21
|
|
159
|
+
&[],
|
|
160
|
+
// Headers of len 22
|
|
161
|
+
&[(b"x-content-type-options", &[(b"nosniff", 61)])],
|
|
162
|
+
// Headers of len 23
|
|
163
|
+
&[(b"content-security-policy", &[(
|
|
164
|
+
b"script-src 'none'; object-src 'none'; base-uri 'none'",
|
|
165
|
+
85,
|
|
166
|
+
)])],
|
|
167
|
+
// Headers of len 24
|
|
168
|
+
&[],
|
|
169
|
+
// Headers of len 25
|
|
170
|
+
&[
|
|
171
|
+
(b"upgrade-insecure-requests", &[(b"1", 94)]),
|
|
172
|
+
(b"strict-transport-security", &[
|
|
173
|
+
(b"max-age=31536000", 56),
|
|
174
|
+
(b"max-age=31536000; includesubdomains", 57),
|
|
175
|
+
(b"max-age=31536000; includesubdomains; preload", 58),
|
|
176
|
+
]),
|
|
177
|
+
],
|
|
178
|
+
// Headers of len 26
|
|
179
|
+
&[],
|
|
180
|
+
// Headers of len 27
|
|
181
|
+
&[(b"access-control-allow-origin", &[(b"*", 35)])],
|
|
182
|
+
// Headers of len 28
|
|
183
|
+
&[
|
|
184
|
+
(b"access-control-allow-methods", &[
|
|
185
|
+
(b"get", 76),
|
|
186
|
+
(b"get, post, options", 77),
|
|
187
|
+
(b"options", 78),
|
|
188
|
+
]),
|
|
189
|
+
(b"access-control-allow-headers", &[
|
|
190
|
+
(b"cache-control", 33),
|
|
191
|
+
(b"content-type", 34),
|
|
192
|
+
(b"*", 75),
|
|
193
|
+
]),
|
|
194
|
+
],
|
|
195
|
+
// Headers of len 29
|
|
196
|
+
&[
|
|
197
|
+
(b"access-control-expose-headers", &[(b"content-length", 79)]),
|
|
198
|
+
(b"access-control-request-method", &[
|
|
199
|
+
(b"get", 81),
|
|
200
|
+
(b"post", 82),
|
|
201
|
+
]),
|
|
202
|
+
],
|
|
203
|
+
// Headers of len 30
|
|
204
|
+
&[(b"access-control-request-headers", &[(b"content-type", 80)])],
|
|
205
|
+
// Headers of len 31
|
|
206
|
+
&[],
|
|
207
|
+
// Headers of len 32
|
|
208
|
+
&[(b"access-control-allow-credentials", &[
|
|
209
|
+
(b"FALSE", 73),
|
|
210
|
+
(b"TRUE", 74),
|
|
211
|
+
])],
|
|
212
|
+
];
|
|
213
|
+
|
|
214
|
+
pub const STATIC_DECODE_TABLE: [(&[u8], &[u8]); 99] = [
|
|
215
|
+
(b":authority", b""),
|
|
216
|
+
(b":path", b"/"),
|
|
217
|
+
(b"age", b"0"),
|
|
218
|
+
(b"content-disposition", b""),
|
|
219
|
+
(b"content-length", b"0"),
|
|
220
|
+
(b"cookie", b""),
|
|
221
|
+
(b"date", b""),
|
|
222
|
+
(b"etag", b""),
|
|
223
|
+
(b"if-modified-since", b""),
|
|
224
|
+
(b"if-none-match", b""),
|
|
225
|
+
(b"last-modified", b""),
|
|
226
|
+
(b"link", b""),
|
|
227
|
+
(b"location", b""),
|
|
228
|
+
(b"referer", b""),
|
|
229
|
+
(b"set-cookie", b""),
|
|
230
|
+
(b":method", b"CONNECT"),
|
|
231
|
+
(b":method", b"DELETE"),
|
|
232
|
+
(b":method", b"GET"),
|
|
233
|
+
(b":method", b"HEAD"),
|
|
234
|
+
(b":method", b"OPTIONS"),
|
|
235
|
+
(b":method", b"POST"),
|
|
236
|
+
(b":method", b"PUT"),
|
|
237
|
+
(b":scheme", b"http"),
|
|
238
|
+
(b":scheme", b"https"),
|
|
239
|
+
(b":status", b"103"),
|
|
240
|
+
(b":status", b"200"),
|
|
241
|
+
(b":status", b"304"),
|
|
242
|
+
(b":status", b"404"),
|
|
243
|
+
(b":status", b"503"),
|
|
244
|
+
(b"accept", b"*/*"),
|
|
245
|
+
(b"accept", b"application/dns-message"),
|
|
246
|
+
(b"accept-encoding", b"gzip, deflate, br"),
|
|
247
|
+
(b"accept-ranges", b"bytes"),
|
|
248
|
+
(b"access-control-allow-headers", b"cache-control"),
|
|
249
|
+
(b"access-control-allow-headers", b"content-type"),
|
|
250
|
+
(b"access-control-allow-origin", b"*"),
|
|
251
|
+
(b"cache-control", b"max-age=0"),
|
|
252
|
+
(b"cache-control", b"max-age=2592000"),
|
|
253
|
+
(b"cache-control", b"max-age=604800"),
|
|
254
|
+
(b"cache-control", b"no-cache"),
|
|
255
|
+
(b"cache-control", b"no-store"),
|
|
256
|
+
(b"cache-control", b"public, max-age=31536000"),
|
|
257
|
+
(b"content-encoding", b"br"),
|
|
258
|
+
(b"content-encoding", b"gzip"),
|
|
259
|
+
(b"content-type", b"application/dns-message"),
|
|
260
|
+
(b"content-type", b"application/javascript"),
|
|
261
|
+
(b"content-type", b"application/json"),
|
|
262
|
+
(b"content-type", b"application/x-www-form-urlencoded"),
|
|
263
|
+
(b"content-type", b"image/gif"),
|
|
264
|
+
(b"content-type", b"image/jpeg"),
|
|
265
|
+
(b"content-type", b"image/png"),
|
|
266
|
+
(b"content-type", b"text/css"),
|
|
267
|
+
(b"content-type", b"text/html; charset=utf-8"),
|
|
268
|
+
(b"content-type", b"text/plain"),
|
|
269
|
+
(b"content-type", b"text/plain;charset=utf-8"),
|
|
270
|
+
(b"range", b"bytes=0-"),
|
|
271
|
+
(b"strict-transport-security", b"max-age=31536000"),
|
|
272
|
+
(
|
|
273
|
+
b"strict-transport-security",
|
|
274
|
+
b"max-age=31536000; includesubdomains",
|
|
275
|
+
),
|
|
276
|
+
(
|
|
277
|
+
b"strict-transport-security",
|
|
278
|
+
b"max-age=31536000; includesubdomains; preload",
|
|
279
|
+
),
|
|
280
|
+
(b"vary", b"accept-encoding"),
|
|
281
|
+
(b"vary", b"origin"),
|
|
282
|
+
(b"x-content-type-options", b"nosniff"),
|
|
283
|
+
(b"x-xss-protection", b"1; mode=block"),
|
|
284
|
+
(b":status", b"100"),
|
|
285
|
+
(b":status", b"204"),
|
|
286
|
+
(b":status", b"206"),
|
|
287
|
+
(b":status", b"302"),
|
|
288
|
+
(b":status", b"400"),
|
|
289
|
+
(b":status", b"403"),
|
|
290
|
+
(b":status", b"421"),
|
|
291
|
+
(b":status", b"425"),
|
|
292
|
+
(b":status", b"500"),
|
|
293
|
+
(b"accept-language", b""),
|
|
294
|
+
(b"access-control-allow-credentials", b"FALSE"),
|
|
295
|
+
(b"access-control-allow-credentials", b"TRUE"),
|
|
296
|
+
(b"access-control-allow-headers", b"*"),
|
|
297
|
+
(b"access-control-allow-methods", b"get"),
|
|
298
|
+
(b"access-control-allow-methods", b"get, post, options"),
|
|
299
|
+
(b"access-control-allow-methods", b"options"),
|
|
300
|
+
(b"access-control-expose-headers", b"content-length"),
|
|
301
|
+
(b"access-control-request-headers", b"content-type"),
|
|
302
|
+
(b"access-control-request-method", b"get"),
|
|
303
|
+
(b"access-control-request-method", b"post"),
|
|
304
|
+
(b"alt-svc", b"clear"),
|
|
305
|
+
(b"authorization", b""),
|
|
306
|
+
(
|
|
307
|
+
b"content-security-policy",
|
|
308
|
+
b"script-src 'none'; object-src 'none'; base-uri 'none'",
|
|
309
|
+
),
|
|
310
|
+
(b"early-data", b"1"),
|
|
311
|
+
(b"expect-ct", b""),
|
|
312
|
+
(b"forwarded", b""),
|
|
313
|
+
(b"if-range", b""),
|
|
314
|
+
(b"origin", b""),
|
|
315
|
+
(b"purpose", b"prefetch"),
|
|
316
|
+
(b"server", b""),
|
|
317
|
+
(b"timing-allow-origin", b"*"),
|
|
318
|
+
(b"upgrade-insecure-requests", b"1"),
|
|
319
|
+
(b"user-agent", b""),
|
|
320
|
+
(b"x-forwarded-for", b""),
|
|
321
|
+
(b"x-frame-options", b"deny"),
|
|
322
|
+
(b"x-frame-options", b"sameorigin"),
|
|
323
|
+
];
|