trillium-client-v0.7.0
·
191 commits
to main
since this release
Changed
- Compatible with trillium 1.0
ObjectSafeConnectorreplaced byArcedConnector;config.arced()→ArcedConnector::new(config)- Error variants renamed:
MalformedHeadersplit intoInvalidHeaderNameandInvalidHeaderValue;PartialHeadmerged intoInvalidHead - Maximum head size increased from 2KB to 8KB
- Previously deprecated
with_header,with_headers, andwithout_headerremoved async_traitre-export removedClient::with_default_poolremoved and keepalive is now the default. To opt out,Client::without_keepalivewas addedConn::response_bodynow returns atrillium_client::ResponseBodyinstead of atrillium_http::ReceivedBody
Added
HTTP/3
Client::new_with_quic(connector, quic_connector) builds a client with HTTP/3 support. The client tracks Alt-Svc response headers and automatically uses HTTP/3 for subsequent requests to origins that advertise it. QUIC connections are pooled; if an H3 attempt fails, that endpoint is marked broken and requests fall back to HTTP/1.1 for a backoff period before retrying. Requests to origins without a cached alt-svc entry always use HTTP/1.1.
QuicClientConfig and ArcedQuicClientConfig are re-exported from trillium-server-common. The QuicClientConfig type parameter is bound at construction time (before type erasure), keeping trillium-quinn and the runtime adapter as independent crates that neither depends on the other.
use trillium_client::Client;
use trillium_rustls::RustlsConfig;
use trillium_rustls::rustls::client::ClientConfig;
use trillium_quinn::ClientQuicConfig;
let client = Client::new_with_quic(
RustlsConfig::<ClientConfig>::default(),
ClientQuicConfig::with_webpki_roots(),
);Other additions
Conn::http_version() -> Version— returns the HTTP version used for the request; after the request completes this reflects whether HTTP/3 was negotiatedClient::with_timeout(Duration)andConn::with_timeout(Duration)— per-request timeouts, returningError::TimedOuton expiryClient::set_timeout(&mut self, Duration)andConn::set_timeout(&mut self, Duration)— in-place variants of the above- Per-connection state via
TypeSet:with_state,insert_state,state,state_mut,take_state sonic-rsfeature: opt-in alternative toserde_jsonforwith_json_bodyandresponse_json. Enable withfeatures = ["sonic-rs"]. The two features are mutually exclusive — enable only one. Note: unlikeserde_json,sonic-rsdoes not guarantee stable map key ordering — tests that assert on raw JSON string output may need to parse back toValuebefore comparing. To keep usingserde_json, usefeatures = ["serde_json"].
Added
- deprecate Headers::contains_ignore_ascii_case
- (client) impl IntoUrl for IpAddr and SocketAddr for convenience