pub struct HttpCcipReadGateway { /* private fields */ }ccip-read-http and crate feature ccip-read and not (WASI and WASIp1) only.Expand description
The default HTTP implementation of CcipReadGateway.
Requests follow ERC-3668: URL templates containing {data} are fetched with GET, all
others receive a POST with a JSON body carrying sender and data. The URLs of a request
are tried in order; a 4xx response aborts the request, while any other failure falls through
to the next URL.
§URL trust
Templates in CcipReadRequest::urls are chosen by the callee contract. This gateway only
checks that each URL uses http or https and will follow a URL to a private, link-local,
loopback, or cloud-metadata address. To constrain destinations, construct
HttpCcipReadGateway::new with a custom reqwest::Client, or implement
CcipReadGateway with your own allowlist, blocklist, or DNS/IP policy.
Implementations§
Source§impl HttpCcipReadGateway
impl HttpCcipReadGateway
Sourcepub const fn new(client: Client) -> Self
pub const fn new(client: Client) -> Self
Creates a gateway using an existing HTTP client, keeping its timeout and redirect policy.
Sourcepub const fn with_max_url_length(self, max_url_length: usize) -> Self
pub const fn with_max_url_length(self, max_url_length: usize) -> Self
Sets the maximum expanded gateway URL length in bytes (default: 2 MiB).
Expansion is checked before allocating the URL. This limit is independent of the response size limit, so a large request may still retrieve a small response.
Trait Implementations§
Source§impl CcipReadGateway for HttpCcipReadGateway
impl CcipReadGateway for HttpCcipReadGateway
Source§fn request<'life0, 'life1, 'async_trait>(
&'life0 self,
request: &'life1 CcipReadRequest,
max_response_size: usize,
) -> Pin<Box<dyn Future<Output = Result<Bytes, CcipReadGatewayError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn request<'life0, 'life1, 'async_trait>(
&'life0 self,
request: &'life1 CcipReadRequest,
max_response_size: usize,
) -> Pin<Box<dyn Future<Output = Result<Bytes, CcipReadGatewayError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Source§impl Clone for HttpCcipReadGateway
impl Clone for HttpCcipReadGateway
Source§fn clone(&self) -> HttpCcipReadGateway
fn clone(&self) -> HttpCcipReadGateway
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for HttpCcipReadGateway
impl Debug for HttpCcipReadGateway
Auto Trait Implementations§
impl !RefUnwindSafe for HttpCcipReadGateway
impl !UnwindSafe for HttpCcipReadGateway
impl Freeze for HttpCcipReadGateway
impl Send for HttpCcipReadGateway
impl Sync for HttpCcipReadGateway
impl Unpin for HttpCcipReadGateway
impl UnsafeUnpin for HttpCcipReadGateway
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
Source§impl<T> WithSubscriber for T
impl<T> WithSubscriber for T
Source§fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘ
fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘ
Source§fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ
fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ
Layout§
Note: Most layout information is completely unstable and may even differ between compilations. The only exception is types with certain repr(...) attributes. Please see the Rust Reference's “Type Layout” chapter for details on type layout guarantees.
Size: 16 bytes