|
|
|
@@ -35,11 +35,11 @@ interface host {
|
|
|
|
|
/// `respond`. An empty result means the body is complete.
|
|
|
|
|
pull: func(limit: u32) -> result<list<u8>, host-error>;
|
|
|
|
|
}
|
|
|
|
|
/// Begins a request to a host both declared by the package and granted on
|
|
|
|
|
/// the connection. Each redirect and DNS result is checked, and DNS is
|
|
|
|
|
/// pinned. Private/LAN addresses additionally require the private-network
|
|
|
|
|
/// grant. Cross-origin redirects remove request headers; HTTPS cannot
|
|
|
|
|
/// downgrade. The host bounds total bytes per exchange, not buffer size.
|
|
|
|
|
/// Begins a request to any HTTP or HTTPS host, including LAN and loopback
|
|
|
|
|
/// addresses. This API has no per-connection network grant. Each redirect
|
|
|
|
|
/// and DNS result is checked, and DNS is pinned. Cross-origin redirects
|
|
|
|
|
/// remove request headers; HTTPS cannot downgrade. The host bounds total
|
|
|
|
|
/// bytes per exchange, not buffer size.
|
|
|
|
|
http: func(request: request) -> result<exchange, host-error>;
|
|
|
|
|
|
|
|
|
|
/// One open TCP connection. Dropping the handle closes the socket, and the
|
|
|
|
@@ -51,13 +51,13 @@ interface host {
|
|
|
|
|
/// Writes at most 1,048,576 bytes and returns how many were accepted.
|
|
|
|
|
write: func(data: list<u8>) -> result<u32, host-error>;
|
|
|
|
|
}
|
|
|
|
|
/// Opens a socket to a host and port both declared by the package and
|
|
|
|
|
/// granted on the connection. The host resolves and pins DNS, applies the
|
|
|
|
|
/// same private-address rule as `http`, and starts TLS when asked. Ports
|
|
|
|
|
/// negotiated at runtime, such as an FTP data channel, still need a grant.
|
|
|
|
|
/// Opens a socket to any host, including LAN and loopback addresses, on a
|
|
|
|
|
/// package-declared port. This API has no per-connection network grant.
|
|
|
|
|
/// The host resolves and pins DNS and starts TLS when asked. Ports
|
|
|
|
|
/// negotiated at runtime, such as an FTP data channel, must be declared.
|
|
|
|
|
connect: func(host: string, port: u16, tls: bool) -> result<tcp, host-error>;
|
|
|
|
|
|
|
|
|
|
/// One datagram socket connected to a single granted peer.
|
|
|
|
|
/// One datagram socket connected to a single peer.
|
|
|
|
|
resource udp {
|
|
|
|
|
/// Sends one datagram of at most 65,507 bytes.
|
|
|
|
|
send: func(data: list<u8>) -> result<u32, host-error>;
|
|
|
|
@@ -65,8 +65,8 @@ interface host {
|
|
|
|
|
/// means none arrived inside the host's wait, not that the peer left.
|
|
|
|
|
receive: func(limit: u32) -> result<list<u8>, host-error>;
|
|
|
|
|
}
|
|
|
|
|
/// Connects a datagram socket under the same declaration and grant rules
|
|
|
|
|
/// as `connect`, for the few filesystem protocols that still need one.
|
|
|
|
|
/// Connects a datagram socket under the same address and port rules as
|
|
|
|
|
/// `connect`, for the few filesystem protocols that still need one.
|
|
|
|
|
bind: func(host: string, port: u16) -> result<udp, host-error>;
|
|
|
|
|
|
|
|
|
|
/// A configuration value, typed as the package's manifest declared it.
|
|
|
|
@@ -81,7 +81,8 @@ interface host {
|
|
|
|
|
|
|
|
|
|
/// Filesystem operations for one connection. Paths are absolute within its
|
|
|
|
|
/// root, starting with `/`; they are never local OS paths or resource URIs.
|
|
|
|
|
/// Dot segments, backslashes, percent escapes, colons, and controls are invalid.
|
|
|
|
|
/// Colons and percent signs are literal; paths must never be URL-decoded.
|
|
|
|
|
/// Dot segments, backslashes, and controls are invalid.
|
|
|
|
|
/// Every invocation is bounded by host fuel, memory, time, and cancellation.
|
|
|
|
|
interface provider {
|
|
|
|
|
use host.{setting};
|
|
|
|
|