Expand description
§Metadata
§Purpose
Utilities for translating HTTP headers into gRPC metadata. This allows context such as authentication tokens, tracing IDs, and custom headers to be propagated to the upstream gRPC service.
§Scope
This module defines:
forward_metadata: Propagates HTTP headers totonic::metadata::MetadataMap.grpc_timeout: Parsesgrpc-timeoutheaders intoDuration.
§Position in the Architecture
Called by generated code before making the gRPC request. It populates the tonic::Request
metadata from the incoming http::Request headers.
§Design Constraints
- Filtering: Certain headers (e.g.,
Content-Type,Host) are filtered out to prevent interference with the gRPC transport. - Security: Only forwards headers that match allowed prefixes or are explicitly permitted to prevent header injection attacks.
Structs§
- Metadata
Forwarding Config - Configuration for metadata forwarding security.
Functions§
- forward_
metadata - Propagates HTTP headers from the incoming request to the gRPC metadata map.
- grpc_
timeout - Parses the
grpc-timeoutheader value into aDuration.