Library guide · API index and notation
This page is generated from the bundled library in this checkout. Signatures and adjacent source comments are reproduced below; the linked guide explains usage, storage, failures, and platform support.
import "std/http/client"
Names used in signatures
Unqualified names denote this package’s types (including other source files in the same package), language built-ins, or generic parameters such as T. Qualified names use the import aliases below. These aliases belong to the library source; import a dependency yourself to use its alias in your program.
| Alias | Package | Source file |
|---|---|---|
bytes |
core/bytes |
client.dodo |
connection |
std/http/connection |
client.dodo |
http |
std/http |
client.dodo |
io |
std/io |
client.dodo |
Proxy
Enum · Source
Policies are values. No environment proxy discovery or global reuse pool.
pub enum Proxy {
Direct, Forward, Tunnel
}
Policy
Struct · Source
pub struct Policy {
pub redirects: http.RedirectPolicy
pub retries: http.RetryPolicy
pub proxy: Proxy
pub connect_timeout_ms: u64
pub request_timeout_ms: u64
pub idle_timeout_ms: u64
pub max_idle: usize
}
Policy.defaults
Function · Source
pub fn defaults() -> Policy
RedirectAction
Enum · Source
pub enum RedirectAction {
Reject, Preserve, Get
}
redirect
Function · Source
pub fn redirect(policy: &Policy, status: u16, source: &http.Uri, destination: &http.Uri,
hops: usize, replayable: bool, method: &[u8]) -> RedirectAction
SlotState
Enum · Source
Caller-backed pool metadata; transport owners stay in application slots. A slot enters Idle only after both message bodies completed successfully.
pub enum SlotState {
Vacant, Busy, Idle
}
Slot
Struct · Source
pub struct Slot {
pub state: SlotState
pub origin: u64
pub trust: u64
pub proxy: u64
pub idle_since_ms: u64
}
Pool
Struct · Source
pub struct Pool {
// Private implementation fields omitted.
}
Pool.new
Function · Source
pub fn new(slots: &mut[Slot]) -> Pool from(slots)
Pool.take
Function · Source
Origin/trust/proxy IDs must be collision-free application identities, never unverified hashes. The pool never crosses any of these boundaries.
pub fn take(&mut self, origin: u64, trust: u64, proxy: u64, now_ms: u64, idle_ms: u64) -> Option<usize>
Pool.from_policy
Function · Source
pub fn from_policy(slots: &mut[Slot], policy: &Policy) -> Pool from(slots)
Pool.reserve
Function · Source
pub fn reserve(&mut self, origin: u64, trust: u64, proxy: u64) -> Option<usize>
Pool.release
Function · Source
pub fn release<C>(&mut self, index: usize, connection: &C, now_ms: u64) -> bool
Pool.discard
Function · Source
pub fn discard(&mut self, index: usize)
Pool.state
Function · Source
pub fn state(&self, index: usize) -> SlotState
RedirectHeaders
Struct · Source
pub struct RedirectHeaders {
// Private implementation fields omitted.
}
RedirectHeaders.new
Function · Source
pub fn new(headers: &[http.Header], same_origin: bool, to_proxy: bool) -> RedirectHeaders from(headers)
RedirectHeaders.next
Function · Source
pub fn next(&mut self) -> Option<http.Header> from(self)
Client
Struct · Source
Attach an already-established transport by passing it explicitly to poll calls. TLS verification and proxy CONNECT must finish before origin traffic. The client owns no transport, thread, clock, allocator, or implicit retry.
pub struct Client {
// Private implementation fields omitted.
}
Client.new
Function · Source
pub fn new(origin: http.Uri, workspace: &mut[u8], input: &mut[u8], output: &mut[u8], limits: http.Limits, policy: Policy) -> Client!connection.Error from(origin, workspace, input, output)
Client.tunnel_established
Function · Source
This is an explicit caller assertion: the supplied stream is now the established tunnel (and verified TLS stream for a secure origin).
pub fn tunnel_established(&mut self) -> void!connection.Error
Client.origin
Function · Source
pub fn origin(&self) -> &http.Uri
Client.poison
Function · Source
pub fn poison(&mut self)
Client.connect_deadline
Function · Source
Connect timeout is exposed for the external connector/provider; its execution model owns cancellation and all OS operation lifetimes.
pub fn connect_deadline(&self, now_ms: u64) -> u64
Client.request_deadline
Function · Source
pub fn request_deadline(&self) -> u64
Client.check
Function · Source
pub fn check(&mut self, now_ms: u64, cancelled: bool) -> void!connection.Error
Client.begin
Function · Source
pub fn begin(&mut self, request: &http.Request, now_ms: u64, cancelled: bool) -> void!connection.Error
Client.poll_flush
Function · Source
pub fn poll_flush<S>(&mut self, stream: &mut S, now_ms: u64, cancelled: bool) -> io.Poll!connection.Error
Client.send_body
Function · Source
pub fn send_body(&mut self, source: &[u8], now_ms: u64, cancelled: bool) -> usize!connection.Error
Client.finish_body
Function · Source
pub fn finish_body(&mut self, trailers: &[http.Header], now_ms: u64, cancelled: bool) -> void!connection.Error
Client.poll_event
Function · Source
pub fn poll_event<S>(&mut self, stream: &mut S, now_ms: u64, cancelled: bool) -> http.Event!connection.Error
Client.body
Function · Source
pub fn body(&self) -> &[u8]
Client.consume_body
Function · Source
pub fn consume_body(&mut self, count: usize, now_ms: u64, cancelled: bool) -> void!connection.Error
Client.status
Function · Source
pub fn status(&self) -> u16
Client.field
Function · Source
pub fn field(&self, offset: usize, length: usize) -> &[u8]!http.Error from(self)
Client.unread
Function · Source
pub fn unread(&self) -> &[u8]
Client.pending_output
Function · Source
pub fn pending_output(&self) -> usize
Client.reusable
Function · Source
pub fn reusable(&self) -> bool
Client.retry_allowed
Function · Source
pub fn retry_allowed(&self, method: &http.Method, attempts: usize, replayable: bool) -> bool
Client.next
Function · Source
Drained exchanges alone can reset this attached connection. A retry of a failed exchange constructs a fresh client around a fresh provider stream.
pub fn next(&mut self, now_ms: u64, cancelled: bool) -> void!connection.Error