pub struct HttpPushSender { /* private fields */ }Expand description
HTTP-based PushSender using hyper.
Retries failed deliveries according to a configurable PushRetryPolicy.
§Transport
With the tls-rustls feature (enabled by default via the a2a-protocol-sdk
crate) this sender delivers over both http:// and https:// — the latter
being the norm for production and what the A2A spec’s webhook field
describes. Without the feature it is plaintext-HTTP only and fails fast on
an https:// target with a clear, actionable error rather than a late,
opaque connector failure.
You can always supply a fully custom TLS stack via
RequestHandlerBuilder::with_push_sender;
PushSender is a public, object-safe trait.
§HTTPS and DNS-rebinding
The SSRF pre-flight (validate_webhook_url_with_dns) always runs, rejecting
webhooks that resolve to private/loopback/link-local addresses. For http://
targets the validated IP is additionally pinned (the request dials the
literal IP with the original Host header) to close the DNS-rebinding TOCTOU
window. For https:// targets the IP is not pinned — the connection must
present the original hostname for SNI and certificate verification — and the
rebinding window is instead closed by TLS itself: an attacker who flips DNS to
a private address after validation cannot present a certificate valid for the
original hostname, so the handshake fails.
§Security
- Rejects webhook URLs targeting private/loopback/link-local addresses to prevent SSRF attacks (including IPv4-in-IPv6 smuggling), and pins the validated IP against DNS-rebinding between validation and connect.
- Validates authentication credentials to prevent HTTP header injection (rejects values containing CR/LF characters).
Implementations§
Source§impl HttpPushSender
impl HttpPushSender
Sourcepub fn new() -> HttpPushSender
pub fn new() -> HttpPushSender
Creates a new HttpPushSender with the default 30-second request timeout
and default retry policy.
Sourcepub fn with_timeout(request_timeout: Duration) -> HttpPushSender
pub fn with_timeout(request_timeout: Duration) -> HttpPushSender
Creates a new HttpPushSender with a custom per-request timeout.
Sourcepub fn with_tls_config(tls_config: ClientConfig) -> HttpPushSender
pub fn with_tls_config(tls_config: ClientConfig) -> HttpPushSender
Creates an HttpPushSender that delivers HTTPS using a custom rustls
ClientConfig instead of the default Mozilla
root store.
Use this to trust an internal/private CA for webhook endpoints, or to
present a client certificate for mutual TLS. Uses the default per-request
timeout and retry policy (chain with_retry_policy
to change them). http:// targets are still delivered in plaintext.
Requires the tls-rustls feature.
Sourcepub fn with_retry_policy(self, policy: PushRetryPolicy) -> HttpPushSender
pub fn with_retry_policy(self, policy: PushRetryPolicy) -> HttpPushSender
Sets a custom retry policy for push notification delivery.
Sourcepub const fn allow_private_urls(self) -> HttpPushSender
pub const fn allow_private_urls(self) -> HttpPushSender
Creates an HttpPushSender that allows private/loopback URLs.
Warning: This disables SSRF protection and should only be used in testing or trusted environments.
Trait Implementations§
Source§impl Debug for HttpPushSender
impl Debug for HttpPushSender
Source§impl Default for HttpPushSender
impl Default for HttpPushSender
Source§fn default() -> HttpPushSender
fn default() -> HttpPushSender
Source§impl PushSender for HttpPushSender
impl PushSender for HttpPushSender
Source§fn allows_private_urls(&self) -> bool
fn allows_private_urls(&self) -> bool
true if this sender allows webhook URLs targeting
private/loopback addresses. Used by the handler to skip SSRF
validation at push config creation time in testing environments. Read moreAuto Trait Implementations§
impl !RefUnwindSafe for HttpPushSender
impl !UnwindSafe for HttpPushSender
impl Freeze for HttpPushSender
impl Send for HttpPushSender
impl Sync for HttpPushSender
impl Unpin for HttpPushSender
impl UnsafeUnpin for HttpPushSender
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> FutureExt for T
impl<T> FutureExt for T
Source§fn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_context(self, otel_cx: Context) -> WithContext<Self>
Source§fn with_current_context(self) -> WithContext<Self>
fn with_current_context(self) -> WithContext<Self>
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a tonic::Request