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/hosted"
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 |
hosted.dodo |
connection |
std/http/connection |
hosted.dodo |
hosting |
std/http/hosting |
hosted.dodo |
http |
std/http |
hosted.dodo |
io |
std/io |
hosted.dodo |
native |
std/net/native |
hosted.dodo |
net |
std/net |
hosted.dodo |
policy |
std/http/client |
hosted.dodo |
slice |
core/slice |
hosted.dodo |
WORKSPACE_BYTES
Constant · Source
16KiB parser, 4KiB receive, 16KiB transmit, 16KiB retained final headers.
pub const WORKSPACE_BYTES: usize = 53248
Config
Struct · Source
pub struct Config {
pub header_bytes: usize
pub header_fields: usize
pub body_bytes: u64
pub request_body_bytes: usize
pub resolution_timeout_ms: u64
pub connect_timeout_ms: u64
pub request_timeout_ms: u64
pub max_redirects: usize
}
Config.defaults
Function · Source
pub fn defaults() -> Config
Config.limits
Function · Source
pub fn limits(&self) -> http.Limits
Request
Struct · Source
pub struct Request {
pub url: &[u8]
pub method: &[u8]
pub headers: &[http.Header]
// Borrowed bytes are intrinsically replayable. No implicit reader rewind.
pub body: &[u8]
}
Response
Struct · Source
pub struct Response {
pub status: u16
pub body_bytes: u64
pub redirects: usize
}
Head
Struct · Source
Header bytes are copied; no parser/input borrow escapes an exchange.
pub struct Head {
// Private implementation fields omitted.
}
Head.new
Function · Source
pub fn new(data: &mut[u8]) -> Head from(data)
Head.clear
Function · Source
pub fn clear(&mut self)
Head.insert
Function · Source
pub fn insert(&mut self, name: &[u8], value: &[u8]) -> void!hosting.Error
Head.len
Function · Source
pub fn len(&self) -> usize
header_at
Function · Source
Zero-delimited names/values are safe because HTTP fields reject NUL.
pub fn header_at(data: &[u8], wanted: &[u8], occurrence: usize) -> Option<http.Header> from(data)
SystemResolver
Struct · Source
Structural resolver: resolve(host, port, workspace, operation, clock, cancel) returns a Result whose value provides len() and get(index)->SocketAddress!net.Error. Must retain no operation after return. SystemResolver cannot interrupt getaddrinfo.
pub struct SystemResolver {
}
SystemResolver.resolve
Function · Source
pub fn resolve<C, X>(&mut self, host: &[u8], port: u16, workspace: &mut[u8], operation: &net.Operation, clock: &mut C, cancel: &X) -> native.Addresses!net.Error from(workspace)
Authority
Struct · Source
pub struct Authority {
pub host: &[u8]
pub port: u16
}
authority
Function · Source
pub fn authority(uri: &http.Uri) -> Authority!hosting.Error from(uri)
exchange
Function · Source
Used by plain and TLS connectors. S provides polling I/O, flush()->bool!Error, wait(writing, milliseconds)->void!Error. One attempt, no automatic retry.
pub fn exchange<S, W, C, X>(stream: &mut S, request: &http.Request, body: &[u8], workspace: &mut[u8], config: &Config,
head: &mut Head, sink: &mut W, clock: &mut C, cancel: &X, until: u64, delivered: &mut u64) -> Response!hosting.Error
PlainConnector
Struct · Source
pub struct PlainConnector {
}
PlainConnector.exchange
Function · Source
pub fn exchange<W, C, X>(&mut self, socket: &mut native.TcpConnection, host: &[u8], secure: bool,
request: &http.Request, body: &[u8], workspace: &mut[u8], config: &Config, head: &mut Head,
sink: &mut W, clock: &mut C, cancel: &X, until: u64, delivered: &mut u64) -> Response!hosting.Error
Client
Struct · Source
pub struct Client {
// Private implementation fields omitted.
}
Client.new
Function · Source
pub fn new(workspace: &mut[u8], config: Config) -> Client!hosting.Error from(workspace)
Client.header
Function · Source
Final headers, including duplicates by occurrence, live until the next call. Clear on error, so a failed request cannot expose stale headers.
pub fn header(&self, name: &[u8], occurrence: usize) -> Option<http.Header> from(self)
Client.get
Function · Source
pub fn get(&mut self, url: &[u8], storage: &mut[u8]) -> Response!hosting.Error
Client.get_to
Function · Source
pub fn get_to<W>(&mut self, url: &[u8], sink: &mut W) -> Response!hosting.Error
Client.request
Function · Source
pub fn request<W>(&mut self, request: &Request, sink: &mut W) -> Response!hosting.Error
Client.request_with
Function · Source
pub fn request_with<W, R, P, C, X>(&mut self, request: &Request, sink: &mut W, resolver: &mut R,
connector: &mut P, clock: &mut C, cancel: &X) -> Response!hosting.Error