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
/// The environment variable that names the wire protocol.
pub const ENV_PROTOCOL: &str = "BENCH_PROTOCOL";
/// The environment variable that names the certificate chain.
pub const ENV_TLS_CERTIFICATE: &str = "BENCH_TLS_CERT";
/// The environment variable that names the private key.
pub const ENV_TLS_KEY: &str = "BENCH_TLS_KEY";
/// The protocol name that selects HTTP/1 over a plain socket.
pub const PROTOCOL_HTTP1: &str = "http1";
/// The protocol name that selects HTTP/1 over TLS.
pub const PROTOCOL_HTTP1_TLS: &str = "http1-tls";
/// The protocol name that selects HTTP/2 over a plain socket.
pub const PROTOCOL_HTTP2: &str = "http2";
/// The protocol name that selects HTTP/2 over TLS.
pub const PROTOCOL_HTTP2_TLS: &str = "http2-tls";
/// The protocol name that selects HTTP/3 over QUIC.
pub const PROTOCOL_HTTP3: &str = "http3";
/// The identifier the ALPN protocol of HTTP/1.1 is spelled with.
pub const ALPN_HTTP1: & = b"http/1.1";
/// The identifier the ALPN protocol of HTTP/2 is spelled with.
pub const ALPN_HTTP2: & = b"h2";
/// The identifier the ALPN protocol of HTTP/3 is spelled with.
pub const ALPN_HTTP3: & = b"h3";
/// The path the dynamic route lives at.
pub const PATH_USER: &str = "/api/user/";
/// The path the query route lives at.
pub const PATH_SEARCH: &str = "/api/search";
/// The path the header route lives at.
pub const PATH_HEADERS: &str = "/api/headers";
/// The path the body route lives at.
pub const PATH_ECHO: &str = "/api/echo";
/// The body the control answers the static route with.
pub const BODY_ROOT: &str = "hello hyperlane benchmark";
/// The prefix of the body the control answers the dynamic route with.
pub const BODY_USER_PREFIX: &str = "user ";
/// The prefix of the body the control answers the query route with.
pub const BODY_QUERY_PREFIX: &str = "q=";
/// The prefix of the body the control answers the header route with.
pub const BODY_TAG_PREFIX: &str = "tag=";
/// The name of the query parameter the query route reads.
pub const PARAM_QUERY: &str = "q";
/// The name of the request header the header route reads.
pub const HEADER_TAG: &str = "x-bench-tag";
/// The name of the header that announces the body length.
pub const HEADER_CONTENT_LENGTH: &str = "content-length";
/// The bytes that separate one query parameter from the next.
pub const QUERY_SEPARATOR: &str = "&";
/// The bytes that separate one query parameter from its value.
pub const QUERY_ASSIGN: &str = "=";
/// The bytes that separate the path from the query.
pub const PATH_QUERY_SEPARATOR: &str = "?";
/// The bytes that separate one path segment from the next.
pub const PATH_SEPARATOR: &str = "/";
/// The status the control answers with.
pub const STATUS_OK: u16 = 200;
/// The reason the HTTP/3 protocol could not start without TLS.
pub const ERROR_HTTP3_NEEDS_TLS: &str = "HTTP/3 requires TLS";
/// The status line every HTTP/1.1 answer starts with.
pub const RESPONSE_STATUS_LINE: & = b"HTTP/1.1 200 OK\r\n";
/// The header name and separator the content length answer starts with.
pub const CONTENT_LENGTH_PREFIX: & = b"content-length: ";
/// The bytes that end an HTTP head.
pub const HEAD_TERMINATOR: & = b"\r\n\r\n";