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
/// Hexadecimal uppercase digit table used by percent-encoding and multipart boundaries.
pub const HEX_UPPER: & = b"0123456789ABCDEF";
/// Default `application/x-www-form-urlencoded` media type for form request bodies.
pub const FORM_URLENCODED_CONTENT_TYPE: &str = "application/x-www-form-urlencoded";
/// Canonical `application/json` media type applied by [`RequestBuilder::try_body_json`].
pub const JSON_CONTENT_TYPE: &str = "application/json";
/// Internal delimiter joining repeated `Set-Cookie` response headers without colliding with RFC 9110 field values.
pub const SET_COOKIE_DELIMITER: char = '\n';
/// Default `multipart/form-data` boundary prefix.
pub const MULTIPART_BOUNDARY_PREFIX: &str = "hyperlane-boundary-";
/// `Authorization` header prefix for Bearer tokens.
pub const BEARER_PREFIX: &str = "Bearer ";
/// `Authorization` header prefix for HTTP Basic credentials.
pub const BASIC_PREFIX: &str = "Basic ";
/// Error message returned when an HTTP/2 TLS handshake fails to negotiate `h2` ALPN.
pub const H2_ALPN_MISMATCH: &str = "Server did not negotiate HTTP/2 via ALPN";
/// Maximum stack buffer length for zero-allocation lowercase header lookups.
pub const RESPONSE_HEADER_STACK_LIMIT: usize = 64;
/// Maximum exponential backoff delay between automatic retries (milliseconds).
pub const MAX_RETRY_BACKOFF_MS: u64 = 1000;
/// Base exponential backoff delay for the first retry attempt (milliseconds).
pub const BASE_RETRY_BACKOFF_MS: u64 = 50;
/// Upper cap honored for server-supplied `Retry-After` integer delays (milliseconds).
pub const MAX_RETRY_AFTER_MS: u64 = 10_000;
/// Lowercase `retry-after` response header name.
pub const HEADER_RETRY_AFTER: &str = "retry-after";
/// HTTP/2 client initial per-stream receive window size (1 MiB).
pub const H2_INITIAL_STREAM_WINDOW: u32 = 1024 * 1024;
/// HTTP/2 client initial connection-level receive window size (4 MiB).
pub const H2_INITIAL_CONN_WINDOW: u32 = 4 * 1024 * 1024;
/// HTTP/2 client maximum DATA frame size (64 KiB).
pub const H2_MAX_FRAME_SIZE: u32 = 64 * 1024;
/// Stack buffer capacity for zero-allocation HTTP/2 URI serialization.
pub const H2_URI_STACK_CAP: usize = 256;
/// Default HTTP/1.1 tail headers emitted when a request has no custom headers and keep-alive is enabled.
pub const DEFAULT_WIRE_TAIL_KEEP_ALIVE: & =
b"\r\naccept: */*\r\nuser-agent: hyperlane\r\nconnection: keep-alive\r\n\r\n";
/// Default HTTP/1.1 tail headers emitted when a request has no custom headers and keep-alive is disabled.
pub const DEFAULT_WIRE_TAIL_CLOSE: & =
b"\r\naccept: */*\r\nuser-agent: hyperlane\r\nconnection: close\r\n\r\n";
/// Default size of the thread-local pre-zeroed synchronous read scratch buffer.
pub const SYNC_READ_SCRATCH_CAP: usize = 8192;
/// Error message when an HTTP/2 send stream closes before granting flow-control capacity.
pub const H2_SEND_CAPACITY_CLOSED: &str =
"HTTP/2 send stream closed before granting capacity";
/// Multipart boundary double-dash prefix bytes.
pub const MULTIPART_DASH_BYTES: & = b"--";
/// Multipart `Content-Disposition` form-data name header prefix bytes.
pub const MULTIPART_DISPOSITION_PREFIX: & = b"Content-Disposition: form-data; name=\"";
/// Multipart filename parameter prefix bytes.
pub const MULTIPART_FILENAME_PREFIX: & = b"; filename=\"";
/// Multipart `Content-Type` header prefix bytes.
pub const MULTIPART_CONTENT_TYPE_PREFIX: & = b"Content-Type: ";
/// Double-quote byte used in multipart parameters and URL validation.
pub const QUOTE_U8: u8 = b'"';
/// Underscore replacement byte for unsafe multipart parameter characters.
pub const UNDERSCORE_U8: u8 = b'_';
/// Hyphen byte allowed inside DNS host labels.
pub const HYPHEN_U8: u8 = b'-';
/// Forbidden ASCII bytes inside the fast-path URL path component.
pub const FAST_URL_PATH_FORBIDDEN: & = b"\\\"<>`{}^";
/// Forbidden ASCII bytes inside the fast-path URL query component.
pub const FAST_URL_QUERY_FORBIDDEN: & = b"\"<>`";
/// IDNA punycode label prefix requiring full WHATWG URL host validation.
pub const PUNYCODE_PREFIX: &str = "xn--";
/// Percent byte introducing percent-encoded sequences in URL paths.
pub const PERCENT_U8: u8 = b'%';