http_constant/common/
const.rs

1use crate::*;
2
3/// A single space character.
4///
5/// This constant is used to represent a space character in string
6/// or byte operations.
7pub const SPACE: &str = " ";
8
9/// The byte representation of a single space character.
10///
11/// This constant provides the byte equivalent of the space character
12/// for use in low-level operations.
13pub const SPACE_U8: u8 = SPACE.as_bytes()[0];
14
15/// A tab character.
16///
17/// This constant is used to represent a tab character in string
18/// or byte operations.
19pub const TAB: &str = "\t";
20
21/// The byte representation of a tab character.
22///
23/// This constant provides the byte equivalent of the tab character
24/// for use in low-level operations.
25pub const TAB_U8: u8 = TAB.as_bytes()[0];
26
27/// A line break character (newline).
28///
29/// This constant is used to represent a line break character in
30/// string or byte operations.
31pub const BR: &str = "\n";
32
33/// A const byte slice representation of the string `BR`.
34pub const BR_BYTES: &[u8] = BR.as_bytes();
35
36/// A colon followed by a space (`: `).
37///
38/// This constant is commonly used in formatted strings, such as
39/// headers or key-value pairs, where a colon and a space are needed.
40pub const COLON_SPACE: &str = ": ";
41
42/// The byte representation of the first character in the `COLON_SPACE`.
43///
44/// This constant provides the byte equivalent of the colon character
45/// from the `COLON_SPACE` string.
46pub const COLON_SPACE_BYTES: &[u8] = COLON_SPACE.as_bytes();
47
48/// A colon followed by a space symbol (`:`).
49///
50/// This constant is commonly used in formatted strings, such as
51/// headers or key-value pairs, where a colon and a space are needed.
52pub const COLON_SPACE_SYMBOL: &str = ":";
53
54/// Query symbols
55pub const QUERY_SYMBOL: &str = "?";
56
57/// Hash symbols
58pub const HASH_SYMBOL: &str = "#";
59
60/// Empty str
61pub const EMPTY_STR: &str = "";
62
63/// Default host
64pub const DEFAULT_HOST: &str = "0.0.0.0";
65
66/// Default web port
67pub const DEFAULT_WEB_PORT: usize = 80;
68
69/// Http br
70pub const HTTP_BR: &str = "\r\n";
71
72/// Http br bytes
73pub const HTTP_BR_BYTES: &[u8] = HTTP_BR.as_bytes();
74
75/// Http double br
76pub const HTTP_DOUBLE_BR: &str = "\r\n\r\n";
77
78/// Http double br bytes
79pub const HTTP_DOUBLE_BR_BYTES: &[u8] = HTTP_DOUBLE_BR.as_bytes();
80
81/// Default http path
82pub const DEFAULT_HTTP_PATH: &str = "/";
83
84/// Default http path bytes
85pub const DEFAULT_HTTP_PATH_BYTES: &[u8] = DEFAULT_HTTP_PATH.as_bytes();
86
87/// And
88pub const AND: &str = "&";
89
90/// And bytes
91pub const AND_BYTES: &[u8] = AND.as_bytes();
92
93/// Equal
94pub const EQUAL: &str = "=";
95
96/// Equal bytes
97pub const EQUAL_BYTES: &[u8] = EQUAL.as_bytes();
98
99/// Zero str
100pub const ZERO_STR: &str = "0";
101
102/// Zero str bytes
103pub const ZERO_STR_BYTES: &[u8] = ZERO_STR.as_bytes();
104
105/// Default buffer size
106pub const DEFAULT_BUFFER_SIZE: usize = 4096;
107
108/// Default max redirect times
109pub const DEFAULT_MAX_REDIRECT_TIMES: usize = 8;
110
111/// Default timeout
112pub const DEFAULT_TIMEOUT: u64 = u64::MAX;
113
114/// Point
115pub const POINT: &str = ".";
116
117/// Root path
118pub const ROOT_PATH: &str = "/";
119
120/// Semicolon
121pub const SEMICOLON: &str = ";";
122
123/// Semicolon and space
124pub const SEMICOLON_SPACE: &str = "; ";
125
126/// GUID
127pub const GUID: &[u8; 36] = b"258EAFA5-E914-47DA-95CA-C5AB0DC85B11";
128
129/// HASH_STATE
130pub const HASH_STATE: [u32; 5] = [
131    0x67452301u32,
132    0xEFCDAB89,
133    0x98BADCFE,
134    0x10325476,
135    0xC3D2E1F0,
136];
137
138/// BASE64_CHARSET_TABLE
139pub const BASE64_CHARSET_TABLE: &[u8] =
140    b"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
141
142/// MAX_FRAME_SIZE
143pub const MAX_FRAME_SIZE: usize = 65535;
144
145/// MAX_UTF8_ATTEMPTS
146pub const MAX_UTF8_ATTEMPTS: usize = 4;
147
148/// DEFAULT_SOCKET_ADDR
149pub const DEFAULT_SOCKET_ADDR: SocketAddr =
150    SocketAddr::V4(SocketAddrV4::new(Ipv4Addr::new(0, 0, 0, 0), 0));
151
152/// SOCKET_ADDR_127_0_0_1
153pub const SOCKET_ADDR_127_0_0_1: SocketAddr =
154    SocketAddr::V4(SocketAddrV4::new(Ipv4Addr::new(127, 0, 0, 1), 0));
155
156/// hyperlane
157pub const HYPERLANE: &str = "hyperlane";
158
159/// Hyperlane
160pub const HYPERLANE_PASCAL_CASE: &str = "Hyperlane";
161
162/// DEFAULT_INNER_PRINT
163pub const DEFAULT_INNER_PRINT: bool = true;
164
165/// DEFAULT_NODELAY
166pub const DEFAULT_INNER_LOG: bool = true;
167
168/// DEFAULT_NODELAY
169pub const DEFAULT_NODELAY: bool = false;
170
171/// DEFAULT_LINGER
172pub const DEFAULT_LINGER: Option<Duration> = None;
173
174/// DEFAULT_TTI
175pub const DEFAULT_TTI: Option<u32> = None;
176
177/// warning
178pub const WARNING: &str = "warning";
179
180/// success
181pub const SUCCESS: &str = "success";
182
183/// fail
184pub const FAIL: &str = "fail";
185
186/// error
187pub const ERROR: &str = "error";
188
189/// info
190pub const INFO: &str = "info";
191
192/// debug
193pub const DEBUG: &str = "debug";
194
195/// plain
196pub const PLAIN: &str = "plain";
197
198/// binary
199pub const BINARY: &str = "binary";