1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
/// Context attribute key preserving the pre-rewrite request path after an internal rewrite.
pub const ATTR_ORIGINAL_PATH: &str = "hyperlane_plugin_rewrite_original_path";
/// Preformatted internal context map key for zero-allocation original-path attribute updates.
pub const ATTR_ORIGINAL_PATH_MAP_KEY: &str =
"External(\"hyperlane_plugin_rewrite_original_path\")";
/// Scheme string denoting HTTPS traffic.
pub const SCHEME_HTTPS: &str = "https";
/// Scheme string denoting plaintext HTTP traffic.
pub const SCHEME_HTTP: &str = "http";
/// Scheme-authority separator used when assembling absolute redirect URLs.
pub const SCHEME_SEPARATOR: &str = "://";
/// RFC 7239 `Forwarded` directive prefix selecting the incoming protocol scheme.
pub const FORWARDED_PROTO_PREFIX: &str = "proto=";
/// Default HTTP port stripped during canonical host comparison.
pub const DEFAULT_HTTP_PORT: &str = ":80";
/// Default HTTPS port stripped during canonical host comparison.
pub const DEFAULT_HTTPS_PORT: &str = ":443";
/// Error message prefix when compiling an invalid regex rewrite pattern.
pub const ERR_INVALID_REGEX: &str = "invalid rewrite regex pattern";
/// Error message when a rewrite target or host contains forbidden CR/LF characters.
pub const ERR_UNSAFE_LOCATION: &str = "unsafe CR/LF character in rewrite target";
/// FxHash 64-bit multiplicative mixing constant.
pub const FX_HASH_K: u64 = 0x517c_c1b7_2722_0a95;
/// SWAR broadcast low-bit mask across 8 bytes (`0x01` repeated).
pub const SWAR_LO_BITS: u64 = 0x0101_0101_0101_0101;
/// SWAR broadcast high-bit mask across 8 bytes (`0x80` repeated).
pub const SWAR_HI_BITS: u64 = 0x8080_8080_8080_8080;
/// SWAR broadcast ASCII space mask across 8 bytes (`0x20` repeated).
pub const SWAR_SPACES: u64 = 0x2020_2020_2020_2020;
/// RFC 9110 valid HTTP header field-value byte lookup table (matching `Response::set_header`).
pub const HTTP_HEADER_VALUE_VALID_LUT: = ;
/// SWAR broadcast mask for ASCII LF (`0x0A`).
pub const SWAR_LF_MASK: u64 = 0x0a0a_0a0a_0a0a_0a0a;
/// SWAR broadcast mask for ASCII CR (`0x0D`).
pub const SWAR_CR_MASK: u64 = 0x0d0d_0d0d_0d0d_0d0d;
/// Stack buffer capacity in bytes for zero-allocation HTTP/1.1 redirect wire serialization.
pub const REDIRECT_WIRE_STACK_CAP: usize = 512;
/// Prebuilt HTTP/1.1 `301 Moved Permanently` redirect wire head up to the `Location` value.
pub const WIRE_301_PREFIX: & =
b"HTTP/1.1 301 Moved Permanently\r\nconnection:keep-alive\r\ncontent-length:0\r\nlocation:";
/// Prebuilt HTTP/1.1 `302 Found` redirect wire head up to the `Location` value.
pub const WIRE_302_PREFIX: & =
b"HTTP/1.1 302 Found\r\nconnection:keep-alive\r\ncontent-length:0\r\nlocation:";
/// Prebuilt HTTP/1.1 `307 Temporary Redirect` redirect wire head up to the `Location` value.
pub const WIRE_307_PREFIX: & =
b"HTTP/1.1 307 Temporary Redirect\r\nconnection:keep-alive\r\ncontent-length:0\r\nlocation:";
/// Prebuilt HTTP/1.1 `308 Permanent Redirect` redirect wire head up to the `Location` value.
pub const WIRE_308_PREFIX: & =
b"HTTP/1.1 308 Permanent Redirect\r\nconnection:keep-alive\r\ncontent-length:0\r\nlocation:";
/// HTTP/1.1 redirect wire terminator ending the `Location` header line and response head.
pub const WIRE_HEADER_END: & = b"\r\n\r\n";
/// Capture pattern accepting one or more ASCII decimal digits (`[0-9]+`).
pub const CAP_PAT_DIGITS_RANGE: &str = "([0-9]+)";
/// Capture pattern accepting one or more non-slash bytes (`[^/]+`).
pub const CAP_PAT_NON_SLASH: &str = "([^/]+)";
/// Capture pattern accepting one or more bytes (`.+`).
pub const CAP_PAT_NON_EMPTY: &str = "(.+)";
/// Capture pattern accepting zero or more bytes (`.*`).
pub const CAP_PAT_ANY: &str = "(.*)";
/// First capture group expansion placeholder `$1`.
pub const REPL_CAP_1: &str = "$1";
/// Braced first capture group expansion placeholder `${1}`.
pub const REPL_CAP_1_BRACED: &str = "${1}";
/// ASCII carriage return byte (`\r`).
pub const BYTE_CR: u8 = b'\r';
/// ASCII line feed byte (`\n`).
pub const BYTE_LF: u8 = b'\n';
/// ASCII NUL byte (`\0`).
pub const BYTE_NUL: u8 = b'\0';
/// ASCII forward slash byte (`/`).
pub const BYTE_SLASH: u8 = b'/';
/// ASCII question mark byte (`?`).
pub const BYTE_QUESTION: u8 = b'?';
/// ASCII dollar sign byte (`$`).
pub const BYTE_DOLLAR: u8 = b'$';
/// ASCII underscore byte (`_`).
pub const BYTE_UNDERSCORE: u8 = b'_';
/// ASCII ampersand byte (`&`).
pub const BYTE_AMP: u8 = b'&';
/// ASCII equals sign byte (`=`).
pub const BYTE_EQ: u8 = b'=';
/// 256-entry lookup table marking regular-expression metacharacters.
pub const REGEX_META_LUT: = ;