Module input_ext
net only.Expand description
Small, single-concern accessor traits for reading routing/transport properties off a service input (an http request, a connect target, …).
Each concern (URI, path, authority, protocol, http version, transport) is its own small trait, so a caller reads exactly the piece it needs instead of building a combined context up front.
Design (matching ClientIp): each resolution trait has
no ExtensionsRef bound and is never
blanket-derived from another trait — every input type opts in with the
resolution that fits it (the http Request/Parts impls in rama-http-types
walk the Forwarded → uri → Host → TLS SNI chain, their target view skips Forwarded;
a transport target resolves its authority directly). The only blanket impls
are the trivial reference-forwarding ones and the composed connector
accessors, whose methods are purely derived.
The return type is the fallibility contract: an Option may be absent (a
caller that requires it does .ok_or_else(|| …)? with its own error);
transport_protocol is
always known, so it returns a bare value.
Each resolution trait also carries default methods built on its one
required accessor (e.g. AuthorityInputExt::host_as_domain), so callers
get ergonomic projections without re-writing the same closure chains.
§Which one to use
An HTTP request has two views of its target resource (RFC 9110 §7.1). The plain
accessors, authority and
protocol, say what the end client asked for and may come
from Forwarded context: use them for routing, policy and logs. The target_* ones,
target_authority and
target_protocol, say what this hop dials, names in
TLS SNI and keys its connection pool by, and never read forwarded context. http_version
and target_http_version split the same way.
Traits§
- Authority
Input Ext - Read the routing authority (
host[:port]) of a service input. - Connector
Target Input Ext std - Resolve the transport address (
host:port) to connect to: the routingauthoritywith the applicationprotocol’s default port as the port fallback. - Connector
Transport Protocol Input Ext std - Resolve the physical transport protocol a connector should establish.
- Http
Version Input Ext std - Read the contextual HTTP
Versionof a service input. - Path
Input Ext - Read the URI path of a service input.
- Protocol
Input Ext - Read the application-layer
Protocol(scheme) of a service input. - Target
Http Version Input Ext std - Read the target HTTP
Versiona connector should establish. - Transport
Protocol Input Ext - Read the transport-layer
TransportProtocol(TCP/UDP) of a service input. - UriInput
Ext - Read the
Uriof a service input that carries one.