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
/// Canonical gRPC `Content-Type` header value.
pub const GRPC_CONTENT_TYPE: &str = "application/grpc";
/// Response header carrying the numeric gRPC status code.
pub const GRPC_STATUS_HEADER: &str = "grpc-status";
/// Response header carrying the percent-encoded gRPC error message.
pub const GRPC_MESSAGE_HEADER: &str = "grpc-message";
/// Request/response header identifying the gRPC payload compression coding.
pub const GRPC_ENCODING_HEADER: &str = "grpc-encoding";
/// Request header carrying the client-supplied RPC timeout budget.
pub const GRPC_TIMEOUT_HEADER: &str = "grpc-timeout";
/// Default maximum decoded gRPC message size (4 MiB).
pub const DEFAULT_GRPC_MAX_MESSAGE_SIZE: usize = 4 * 1024 * 1024;
/// Length of the 5-byte gRPC Length-Prefixed-Message header.
pub const GRPC_FRAME_HEADER_LEN: usize = 5;
/// Default decompression scratch buffer size.
pub const GRPC_DECOMPRESS_BUF_SIZE: usize = 4096;
/// Uppercase hexadecimal digits for RFC 3986 percent-encoding of `grpc-message`.
pub const GRPC_HEX_UPPER: & = b"0123456789ABCDEF";
/// Identity encoding token indicating uncompressed gRPC frames.
pub const GRPC_IDENTITY_ENCODING: &str = "identity";
/// Error text when a gRPC payload is truncated before the 5-byte frame header.
pub const ERR_GRPC_TRUNCATED_HEADER: &str = "Truncated gRPC frame header";
/// Error text when a gRPC payload has an invalid compression flag (`> 1`).
pub const ERR_GRPC_INVALID_FLAG: &str = "Invalid gRPC compression flag";
/// Error text when a gRPC payload declares a length exceeding the configured cap.
pub const ERR_GRPC_MSG_TOO_LARGE: &str = "gRPC message exceeds max_message_size";
/// Error text when a gRPC payload ends before the declared frame length.
pub const ERR_GRPC_TRUNCATED_BODY: &str = "Truncated gRPC frame payload";
/// Error text when a frame is flagged compressed without a supported `grpc-encoding`.
pub const ERR_GRPC_UNSUPPORTED_ENCODING: &str = "Unsupported or missing grpc-encoding";
/// Error text when a gRPC method path is not registered in [`GrpcRouter`].
pub const ERR_GRPC_UNIMPLEMENTED: &str = "gRPC method not implemented";
/// Error text when a gRPC handler exceeds the caller's `grpc-timeout` deadline.
pub const ERR_GRPC_DEADLINE_EXCEEDED: &str = "gRPC deadline exceeded";