| 1 |
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or |
| 2 |
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license |
| 3 |
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your |
| 4 |
// option. This file may not be copied, modified, or distributed |
| 5 |
// except according to those terms. |
| 6 |
|
| 7 |
#[derive(Debug)] |
| 8 |
pub struct StaticTableEntry { |
| 9 |
index: u64, |
| 10 |
name: &'static [u8], |
| 11 |
value: &'static [u8], |
| 12 |
} |
| 13 |
|
| 14 |
impl StaticTableEntry { |
| 15 |
pub const fn name(&self) -> &[u8] { |
| 16 |
self.name |
| 17 |
} |
| 18 |
|
| 19 |
pub const fn value(&self) -> &[u8] { |
| 20 |
self.value |
| 21 |
} |
| 22 |
|
| 23 |
pub const fn index(&self) -> u64 { |
| 24 |
self.index |
| 25 |
} |
| 26 |
} |
| 27 |
|
| 28 |
macro_rules! static_table_entries { |
| 29 |
[$($i:expr, $n:expr, $v:expr);+ $(;)?] => { |
| 30 |
&[ $(StaticTableEntry { index: $i, name: $n, value: $v }),+ ] |
| 31 |
}; |
| 32 |
} |
| 33 |
|
| 34 |
pub const HEADER_STATIC_TABLE: &[StaticTableEntry] = static_table_entries![ |
| 35 |
0, b":authority", b""; |
| 36 |
1, b":path", b"/"; |
| 37 |
2, b"age", b"0"; |
| 38 |
3, b"content-disposition", b""; |
| 39 |
4, b"content-length", b"0"; |
| 40 |
5, b"cookie", b""; |
| 41 |
6, b"date", b""; |
| 42 |
7, b"etag", b""; |
| 43 |
8, b"if-modified-since", b""; |
| 44 |
9, b"if-none-match", b""; |
| 45 |
10, b"last-modified", b""; |
| 46 |
11, b"link", b""; |
| 47 |
12, b"location", b""; |
| 48 |
13, b"referer", b""; |
| 49 |
14, b"set-cookie", b""; |
| 50 |
15, b":method", b"CONNECT"; |
| 51 |
16, b":method", b"DELETE"; |
| 52 |
17, b":method", b"GET"; |
| 53 |
18, b":method", b"HEAD"; |
| 54 |
19, b":method", b"OPTIONS"; |
| 55 |
20, b":method", b"POST"; |
| 56 |
21, b":method", b"PUT"; |
| 57 |
22, b":scheme", b"http"; |
| 58 |
23, b":scheme", b"https"; |
| 59 |
24, b":status", b"103"; |
| 60 |
25, b":status", b"200"; |
| 61 |
26, b":status", b"304"; |
| 62 |
27, b":status", b"404"; |
| 63 |
28, b":status", b"503"; |
| 64 |
29, b"accept", b"*/*"; |
| 65 |
30, b"accept", b"application/dns-message"; |
| 66 |
31, b"accept-encoding", b"gzip, deflate, br"; |
| 67 |
32, b"accept-ranges", b"bytes"; |
| 68 |
33, b"access-control-allow-headers", b"cache-control"; |
| 69 |
34, b"access-control-allow-headers", b"content-type"; |
| 70 |
35, b"access-control-allow-origin", b"*"; |
| 71 |
36, b"cache-control", b"max-age=0"; |
| 72 |
37, b"cache-control", b"max-age=2592000"; |
| 73 |
38, b"cache-control", b"max-age=604800"; |
| 74 |
39, b"cache-control", b"no-cache"; |
| 75 |
40, b"cache-control", b"no-store"; |
| 76 |
41, b"cache-control", b"public, max-age=31536000"; |
| 77 |
42, b"content-encoding", b"br"; |
| 78 |
43, b"content-encoding", b"gzip"; |
| 79 |
44, b"content-type", b"application/dns-message"; |
| 80 |
45, b"content-type", b"application/javascript"; |
| 81 |
46, b"content-type", b"application/json"; |
| 82 |
47, b"content-type", b"application/x-www-form-urlencoded"; |
| 83 |
48, b"content-type", b"image/gif"; |
| 84 |
49, b"content-type", b"image/jpeg"; |
| 85 |
50, b"content-type", b"image/png"; |
| 86 |
51, b"content-type", b"text/css"; |
| 87 |
52, b"content-type", b"text/html; charset=utf-8"; |
| 88 |
53, b"content-type", b"text/plain"; |
| 89 |
54, b"content-type", b"text/plain;charset=utf-8"; |
| 90 |
55, b"range", b"bytes=0-"; |
| 91 |
56, b"strict-transport-security", b"max-age=31536000"; |
| 92 |
57, b"strict-transport-security", b"max-age=31536000; includesubdomains"; |
| 93 |
58, b"strict-transport-security", b"max-age=31536000; includesubdomains; preload"; |
| 94 |
59, b"vary", b"accept-encoding"; |
| 95 |
60, b"vary", b"origin"; |
| 96 |
61, b"x-content-type-options", b"nosniff"; |
| 97 |
62, b"x-xss-protection", b"1; mode=block"; |
| 98 |
63, b":status", b"100"; |
| 99 |
64, b":status", b"204"; |
| 100 |
65, b":status", b"206"; |
| 101 |
66, b":status", b"302"; |
| 102 |
67, b":status", b"400"; |
| 103 |
68, b":status", b"403"; |
| 104 |
69, b":status", b"421"; |
| 105 |
70, b":status", b"425"; |
| 106 |
71, b":status", b"500"; |
| 107 |
72, b"accept-language", b""; |
| 108 |
73, b"access-control-allow-credentials", b"FALSE"; |
| 109 |
74, b"access-control-allow-credentials", b"TRUE"; |
| 110 |
75, b"access-control-allow-headers", b"*"; |
| 111 |
76, b"access-control-allow-methods", b"get"; |
| 112 |
77, b"access-control-allow-methods", b"get, post, options"; |
| 113 |
78, b"access-control-allow-methods", b"options"; |
| 114 |
79, b"access-control-expose-headers", b"content-length"; |
| 115 |
80, b"access-control-request-headers", b"content-type"; |
| 116 |
81, b"access-control-request-method", b"get"; |
| 117 |
82, b"access-control-request-method", b"post"; |
| 118 |
83, b"alt-svc", b"clear"; |
| 119 |
84, b"authorization", b""; |
| 120 |
85, b"content-security-policy", b"script-src 'none'; object-src 'none'; base-uri 'none'"; |
| 121 |
86, b"early-data", b"1"; |
| 122 |
87, b"expect-ct", b""; |
| 123 |
88, b"forwarded", b""; |
| 124 |
89, b"if-range", b""; |
| 125 |
90, b"origin", b""; |
| 126 |
91, b"purpose", b"prefetch"; |
| 127 |
92, b"server", b""; |
| 128 |
93, b"timing-allow-origin", b"*"; |
| 129 |
94, b"upgrade-insecure-requests", b"1"; |
| 130 |
95, b"user-agent", b""; |
| 131 |
96, b"x-forwarded-for", b""; |
| 132 |
97, b"x-frame-options", b"deny"; |
| 133 |
98, b"x-frame-options", b"sameorigin"; |
| 134 |
]; |