Silk

silk/http_client

Profiles: aarch64-apple-darwin, aarch64-unknown-linux-gnu, aarch64-unknown-linux-gnu-no-libc, wasm32-unknown-unknown, x86_64-unknown-linux-gnu, x86_64-unknown-linux-gnu-no-libc.

Scoped incremental HTTP/1 client exchanges over an explicit transport loan.

Details

A connection admits one exchange at a time. Complete request and response framing are required before reuse. Cleanup closes terminally without a hidden flush, body drain, retry, or replay.

Import as Client with import silk.http_client as Client.

Public declarations: 44.

ConnectionPhase

pub enum ConnectionPhase

The exclusive connection state.

Ready

Ready = 0

Admits one new exchange.

Active

Active = 1

Has an active exchange.

Closed

Closed = 2

Cannot perform another HTTP exchange.

ExchangePhase

pub enum ExchangePhase

The next permitted exchange operation.

Prepared

Prepared = 0

Permits sending the validated request head.

AwaitContinue

AwaitContinue = 1

Requires response heads until 100 or an early final response.

Upload

Upload = 2

Permits request body writes and request finish.

AwaitResponse

AwaitResponse = 3

Permits receiving response heads.

Response

Response = 4

Permits response body reads.

Tunnel

Tunnel = 5

Permits an exclusive tunnel handoff.

Finished

Finished = 6

Records complete message boundaries.

Aborted

Aborted = 7

Forbids further exchange operations.

ContinuePolicy

pub union ContinuePolicy

The explicit upload admission policy.

Disabled

ContinuePolicy.Disabled: ContinuePolicy

Completes upload before receiving response heads.

Require100

ContinuePolicy.Require100 { deadline: Instant }: ContinuePolicy

Waits for 100 under a finite absolute deadline, without fallback.

Field deadline

pub deadline: Instant

The absolute monotonic continue deadline, clamped to the overall deadline.

RequestOptions

pub struct RequestOptions

Deadlines for one exchange. They are never restarted between operations.

Field deadline

pub deadline: silk/option.Option<silk/system_clock.Instant>

The overall absolute monotonic deadline; None is unbounded.

Field continuePolicy

pub continuePolicy: ContinuePolicy

The selected expectation policy, matching the prepared request.

Associated function RequestOptions.defaults

pub fn defaults() -> RequestOptions

Returns an unbounded overall request deadline with upload-before-response behavior.

Limits

pub struct Limits

Finite connection and message storage and wire budgets.

Field head

pub head: HeadLimits

Parser limits for request and response heads.

Field requestBody

pub requestBody: BodyLimits

Independent request body limits.

Field responseBody

pub responseBody: BodyLimits

Independent response body limits.

Field readCapacity

pub readCapacity: usize

Positive input buffer capacity.

Field writeCapacity

pub writeCapacity: usize

Positive framing output scratch capacity.

Field maxRequests

pub maxRequests: usize

Maximum requests admitted on this connection.

Field maxInformationalResponses

pub maxInformationalResponses: usize

Maximum informational heads per exchange; use 16 for the standard default.

Field maxInformationalWireBytes

pub maxInformationalWireBytes: u64

Maximum aggregate informational head wire bytes; use 65536 for the standard default.

Field maxDiscardWireBytes

pub maxDiscardWireBytes: u64

Maximum wire bytes consumed by one explicit discard or drain operation; at most 1048576.

Associated function Limits.defaults

pub fn defaults() -> Limits

Returns finite standard limits, including 16 informational heads and 65536 informational wire bytes.

Implementation Copy for Limits

impl Copy for Limits

ClientError

pub union ClientError

A typed protocol, stage, budget, or transport failure.

Content

ClientError.Content { error: silk/http_content.ContentError<'static> }: ClientError

Preserves a content decoding failure and its exact output coordinates.

Field error

pub error: silk/http_content.ContentError<'static>

The owned runtime content, checksum, or framing failure.

ClientError.Head { error: ParseError }: ClientError

Preserves a head parser failure.

Field error

pub error: ParseError

The underlying head failure.

Body

ClientError.Body { error: BodyError }: ClientError

Preserves framing failure and exact committed coordinates.

Field error

pub error: BodyError

The underlying body failure.

Transport

ClientError.Transport { error: TransportError }: ClientError

Preserves plain or secured transport failure.

Field error

pub error: TransportError

The underlying transport failure.

Output

ClientError.Output { error: TransportError, progress: WriteProgress }: ClientError

Records framed output accepted before the transport failed.

Field error

pub error: TransportError

The underlying transport failure.

Field progress

pub progress: WriteProgress

Payload and wire progress for the failed call.

OutputTimeout

ClientError.OutputTimeout { progress: WriteProgress }: ClientError

Records a client deadline expiring after payload or wire progress.

Field progress

pub progress: WriteProgress

The exact accepted payload and committed wire coordinates.

OutputAllocation

ClientError.OutputAllocation { error: OutOfMemoryError, progress: WriteProgress }: ClientError

Records payload accepted by framing before a transport allocation failed.

Field error

pub error: OutOfMemoryError

The allocator failure from the transport.

Field progress

pub progress: WriteProgress

The exact payload and committed wire coordinates.

InvalidState

ClientError.InvalidState: ClientError

Rejects an operation before I/O when its stage is invalid.

InvalidRequest

ClientError.InvalidRequest: ClientError

Rejects incompatible body framing or expectation policy before I/O.

InvalidLimits

ClientError.InvalidLimits: ClientError

Rejects zero buffer capacities before allocation.

LimitExceeded

ClientError.LimitExceeded: ClientError

Reports a finite informational or connection budget exhaustion.

TruncatedHead

ClientError.TruncatedHead: ClientError

Reports response input ending before a complete head.

UnsupportedUpgrade

ClientError.UnsupportedUpgrade: ClientError

Rejects status 101 without protocol handoff.

ContinueTimeout

ClientError.ContinueTimeout: ClientError

Reports expiry while waiting for permission to upload.

Timeout

ClientError.Timeout: ClientError

Reports the overall absolute deadline expiring.

validateLimits

pub fn validateLimits<'life0>(limits: &'life0 silk/http_client.Limits) -> silk/result.Result<(), silk/http_client.ClientError>

Validates connection limits without allocation, transport contact, or parser construction.

Details

Read and write capacities must be positive. The discard limit must not exceed 1,048,576 wire bytes. Head parser storage must have representable metadata and fit its owned-storage limit. Head storage failures retain the exact parser error in ClientError.Head.

DiscardOutcome

pub enum DiscardOutcome

The result of a bounded response-framing discard.

Completed

Completed = 0

The complete response boundary was reached within the limit.

CapReached

CapReached = 1

The next response-framing byte would exceed the limit.

ReuseEligibility

pub union ReuseEligibility

Whether one owned connection can return to an idle pool.

Eligible

ReuseEligibility.Eligible: ReuseEligibility

The connection has complete persistent boundaries and can return to an idle pool.

NotReady

ReuseEligibility.NotReady: ReuseEligibility

The connection is not ready after one complete reusable exchange.

NotOwned

ReuseEligibility.NotOwned: ReuseEligibility

The connection no longer owns armed physical close authority.

RequestLimit

ReuseEligibility.RequestLimit: ReuseEligibility

The connection has reached its finite request-count limit.

RetainedInput

ReuseEligibility.RetainedInput { bytes: usize }: ReuseEligibility

The connection retains bytes after the complete response boundary.

Field bytes

pub bytes: usize

The exact retained byte count.

Implementation Copy for ReuseEligibility

impl Copy for ReuseEligibility

WriteProgress

pub struct WriteProgress

Exact accepted payload and transport wire prefixes for one write call.

Field consumed

pub consumed: usize

Payload prefix accepted by the framing encoder.

Field written

pub written: usize

Framed prefix committed to the transport in this call.

Field totalPayload

pub totalPayload: u64

Cumulative encoded payload bytes.

Field totalWire

pub totalWire: u64

Cumulative encoded wire bytes.

Implementation Copy for WriteProgress

impl Copy for WriteProgress

Connection

pub struct Connection<P>

An affine owned connection retaining the transport, bounded storage, and next input suffix.

Method Connection.phase

pub fn phase<P, 'life1>(self: &'life1 Connection<P>) -> ConnectionPhase

Returns the current logical connection phase.

Method Connection.unread

pub fn unread<P, 'life1>(self: &'life1 Connection<P>) -> usize

Returns the exact retained input suffix length.

Method Connection.transportContext

pub fn transportContext<P, 'view>(self: &'view Connection<P>) -> silk/http_client.TransportContext<'view, P>

Borrows the provider for immutable route and connection-context inspection.

reuseEligibility

pub fn reuseEligibility<P, 'life1>(connection: &'life1 silk/http_client.Connection<P>) -> ReuseEligibility

Returns whether an owned connection can return to an idle pool without resetting client state.

Details

Eligible requires Ready phase, armed physical ownership, request-budget headroom, and no retained input. Other results identify the first failed condition without exposing counters.

TransportContext

pub struct TransportContext<'view, P>

Shared inspection of retained route context without mutable transport authority.

Field transport

pub transport: &'view P

The immutable exact provider retained by the owned connection.

Exchange

pub struct Exchange<'exchange, P>

One exclusive callback-scoped request and response lifecycle.

Method Exchange.phase

pub fn phase<'exchange, P, 'life2>(self: &'life2 Exchange<'exchange, P>) -> ExchangePhase

Returns the next permitted stage.

Method Exchange.head

pub effect<'env> fn head<'exchange: 'env, P: 'env, 'head: 'env, 'env>(self: &'head Exchange<'exchange, P>) -> silk/http_head.ResponseHead<'head> ! ClientError

Borrows the most recently received head until the exchange is mutably used again. Use ResponseHead.copy with explicit value limits to retain an owned copy.

ConnectionHandler

pub interface ConnectionHandler<P, A, E, ?R>

A higher-ranked callback that cannot return its connection loan.

Operation handle

effect<'call> fn handle<'call: 'call>(handler: Self, connection: &'call mut silk/http_client.Connection<P>) -> A ! E ? R where &mut P provides &HttpTransport from &mut HttpTransport | &mut MonotonicClock | &mut Allocator | &mut Random, &mut P provides &HttpTransport from &mut HttpTransport

Runs inside an exclusive connection scope and preserves caller channels.

RouteProtocol

pub enum RouteProtocol

The HTTP version and TLS application-protocol policy for one routed scope.

Http10

Http10 = 0

Uses HTTP/1.0 and sends no TLS application-protocol extension.

OptionalHttp11

OptionalHttp11 = 1

Uses HTTP/1.1 and permits the TLS peer to omit application-protocol selection.

RequiredHttp11

RequiredHttp11 = 2

Uses HTTP/1.1 and requires the TLS peer to select http/1.1.

RouteSettings

pub struct RouteSettings

Complete finite settings for one target-neutral routed HTTP scope.

Field http

pub http: Limits

Connection, parser, buffering, and message limits.

Field request

pub request: HeaderLimits

Request-head value limits used for the generated CONNECT request.

Field maxRequestHeadBytes

pub maxRequestHeadBytes: usize

Maximum owned bytes in the generated CONNECT head.

Field maxProxyCredentialBytes

pub maxProxyCredentialBytes: usize

Maximum owned proxy-credential bytes in the generated CONNECT head.

Field protocol

pub protocol: RouteProtocol

HTTP version and TLS application-protocol policy.

Field tls

pub tls: ClientLimits

TLS client protocol limits.

Field handshakeDurationNanoseconds

pub handshakeDurationNanoseconds: u64

Finite TLS handshake duration in nanoseconds.

Implementation Copy for RouteSettings

impl Copy for RouteSettings

AcquiredRouteContext

pub service AcquiredRouteContext<P, A, E, ?R>

Lexical consumer of one plain provider supplied to a target-neutral route acquisition scope.

Operation use

effect<'env> fn use<'env>(provider: P) -> A ! E ? R | &mut silk/http_client.AcquiredRouteContext<P, A, E, ? R> where &mut P provides &HttpTransport from &mut HttpTransport | &mut MonotonicClock | &mut Allocator | &mut Random, &mut P provides &HttpTransport from &mut HttpTransport, &mut P provides &ByteDuplex from &mut ByteDuplex | &mut MonotonicClock | &mut Allocator | &mut Random, &mut P provides &ByteDuplex from &mut ByteDuplex, R in Without<R, &ByteDuplex>, R in Without<R, &HttpTransport>

Consumes the exact provider selected for the requested physical peer.

RouteClient

pub interface RouteClient<P, A, E, AcquisitionError, ?AcquisitionRequirements, ?R>

A target-neutral owner that acquires one exact physical peer for a routed scope.

Operation settings

fn settings<'life6>(client: &'life6 Self) -> RouteSettings

Returns all HTTP and TLS settings without applying hidden defaults.

Operation acquire

effect<'env> fn acquire<'env>(client: Self, peer: Origin, deadline: silk/option.Option<silk/system_clock.Instant>) -> A ! E | AcquisitionError ? AcquisitionRequirements | R | &mut silk/http_client.AcquiredRouteContext<P, A, E, ? R> where R in Without<R, &ByteDuplex>, R in Without<R, &HttpTransport>

Acquires one owned plain provider for peer under the unchanged absolute deadline.

RouteTransport

pub struct RouteTransport<'transport, 'provider: 'transport, 'tunnel: 'provider, P>

The uniform final HTTP transport lent to a routed callback.

RouteHandler

pub interface RouteHandler<'configuration, P, A, E, ?R>

A higher-ranked callback for one selected route and its final HTTP connection.

Operation handle

effect<'call> fn handle<'call: 'call, 'transport: 'call, 'provider: 'transport + 'call, 'tunnel: 'provider + 'call>(handler: Self, route: silk/http_proxy.Route<'configuration>, connection: &'call mut silk/http_client.Connection<silk/http_client.RouteTransport<'transport, 'provider, 'tunnel, P>>) -> A ! E ? R where &mut P provides &HttpTransport from &mut HttpTransport | &mut MonotonicClock | &mut Allocator | &mut Random, &mut P provides &HttpTransport from &mut HttpTransport, &mut P provides &ByteDuplex from &mut ByteDuplex | &mut MonotonicClock | &mut Allocator | &mut Random, &mut P provides &ByteDuplex from &mut ByteDuplex

Runs after route acquisition and required origin authentication complete.

Implementation HttpTransport for silk/http_client.RouteTransport<'transport, 'provider, 'tunnel, P>

impl HttpTransport for silk/http_client.RouteTransport<'transport, 'provider, 'tunnel, P>

Operation readSomeRaw

readSomeRaw = RouteTransport.read

Operation writeSomeRaw

writeSomeRaw = RouteTransport.write

Operation flush

flush = RouteTransport.flushOutput

Operation close

close = RouteTransport.closeTransport

withRoute

pub effect<'env> fn withRoute<'configuration: 'env, P, A, E, AcquisitionError, ?R, ?AcquisitionRequirements, H: 'env, C: 'env, 'env>(client: C, route: silk/http_proxy.Route<'configuration>, preparedTrust: silk/option.Option<silk/trust_snapshot.TrustSnapshot>, deadline: silk/option.Option<silk/system_clock.Instant>, handler: H) -> A ! E | AcquisitionError | ProxyError | ClientError | Tls.ConnectionError | IdentityError | OutOfMemoryError ? R | AcquisitionRequirements | &mut Allocator | &mut MonotonicClock | &mut SystemClock | &mut Random where &mut P provides &HttpTransport from &mut HttpTransport | &mut MonotonicClock | &mut Allocator | &mut Random, &mut P provides &HttpTransport from &mut HttpTransport, &mut P provides &ByteDuplex from &mut ByteDuplex | &mut MonotonicClock | &mut Allocator | &mut Random, &mut P provides &ByteDuplex from &mut ByteDuplex, R in Without<R, &ByteDuplex>, R in Without<R, &HttpTransport>

Acquires and lends one route-selected HTTP connection under one unchanged absolute deadline.

Details

Trust presence is validated before acquisition. Forward uses the plain proxy connection. A Tunnel sends CONNECT before it authenticates the original origin and lends the secured channel.

makeOwned

pub effect<'env> fn makeOwned<P: 'env, 'env>(transport: P, origin: Origin, version: Version, limits: Limits, overallDeadline: silk/option.Option<silk/system_clock.Instant>) -> silk/http_client.Connection<P> ! ClientError | OutOfMemoryError ? &mut Allocator where &mut P provides &HttpTransport from &mut HttpTransport

Owns the transport and bounded parser state so a completed connection can be retained for later exchanges. Allocation failure terminally closes the supplied transport without a hidden flush.

withOwned

pub effect<'env> fn withOwned<P: 'env, A, E, ?R, H: 'env, 'env>(transport: P, origin: Origin, version: Version, limits: Limits, overallDeadline: silk/option.Option<silk/system_clock.Instant>, handler: H) -> A ! E | ClientError | OutOfMemoryError ? R | &mut Allocator where &mut P provides &HttpTransport from &mut HttpTransport | &mut MonotonicClock | &mut Allocator | &mut Random, &mut P provides &HttpTransport from &mut HttpTransport

Lends an owned connection for a callback, then closes it on every exit.

withConnected

pub effect<'env> fn withConnected<'env: 'env, P: 'env, A, E, ?R, H: 'env>(transport: &'env mut P, origin: Origin, version: Version, limits: Limits, overallDeadline: silk/option.Option<silk/system_clock.Instant>, handler: H) -> A ! E | ClientError | OutOfMemoryError ? R | &mut Allocator where &mut P provides &HttpTransport from &mut HttpTransport | &mut MonotonicClock | &mut Allocator | &mut Random, &mut P provides &HttpTransport from &mut HttpTransport

Lends an explicit transport through one terminal connection scope while its physical owner stays outside.

close

pub effect<'env> fn close<P: 'env, 'life1: 'env, 'env>(connection: &'life1 mut silk/http_client.Connection<P>) -> () ! ClientError where &mut P provides &HttpTransport from &mut HttpTransport

Closes an owned connection terminally without flushing or draining; repeated closure is local.

withExchange

pub effect<'env> fn withExchange<'exchange: 'env, 'callback: 'env, P: 'env, A, E, ?R, 'life6: 'env, 'env>(connection: &'exchange mut silk/http_client.Connection<P>, request: &'life6 silk/http_request.PreparedRequest, requestedOptions: RequestOptions, callback: for<'call, 'exchangeView: 'call> once fn<'callback>(&'call mut silk/http_client.Exchange<'exchangeView, P>) -> once Effect<'call & 'callback; A ! E ? R>) -> A ! E | ClientError | OutOfMemoryError ? R | &mut Allocator

Lends one prepared exchange. Incomplete or failed callbacks permanently remove reuse authority.

send

pub effect<'env> fn send<'exchange: 'env, P: 'env, 'life2: 'env, 'env>(exchange: &'life2 mut silk/http_client.Exchange<'exchange, P>) -> () ! ClientError | OutOfMemoryError ? &mut MonotonicClock | &mut Allocator | &mut Random where &mut P provides &HttpTransport from &mut HttpTransport | &mut MonotonicClock | &mut Allocator | &mut Random

Sends the prepared head once; Require100 also flushes before waiting for response heads.

writeSome

pub effect<'env> fn writeSome<'exchange: 'env, P: 'env, 'life2: 'env, 'life3: 'env, 'env>(exchange: &'life2 mut silk/http_client.Exchange<'exchange, P>, input: &'life3 [u8]) -> WriteProgress ! ClientError | OutOfMemoryError ? &mut MonotonicClock | &mut Allocator | &mut Random where &mut P provides &HttpTransport from &mut HttpTransport | &mut MonotonicClock | &mut Allocator | &mut Random

Accepts one payload prefix and preserves exact payload and transport progress on failure.

finishRequest

pub effect<'env> fn finishRequest<'exchange: 'env, P: 'env, 'life2: 'env, 'life3: 'env, 'life4: 'env, 'env>(exchange: &'life2 mut silk/http_client.Exchange<'exchange, P>, trailers: &'life3 silk/http_headers.Headers<'life4>) -> () ! ClientError | OutOfMemoryError ? &mut MonotonicClock | &mut Allocator | &mut Random where &mut P provides &HttpTransport from &mut HttpTransport | &mut MonotonicClock | &mut Allocator | &mut Random

Completes bounded request trailers and flushes before response reads are permitted.

receive

pub effect<'env> fn receive<'exchange: 'env, P: 'env, 'life2: 'env, 'env>(exchange: &'life2 mut silk/http_client.Exchange<'exchange, P>) -> u16 ! ClientError | OutOfMemoryError ? &mut MonotonicClock | &mut Allocator | &mut Random where &mut P provides &HttpTransport from &mut HttpTransport | &mut MonotonicClock | &mut Allocator | &mut Random

Receives one bounded head; informational and final error statuses remain ordinary response values.

receiveFinal

pub effect<'env> fn receiveFinal<'exchange: 'env, P: 'env, 'life2: 'env, 'env>(exchange: &'life2 mut silk/http_client.Exchange<'exchange, P>) -> u16 ! ClientError | OutOfMemoryError ? &mut MonotonicClock | &mut Allocator | &mut Random where &mut P provides &HttpTransport from &mut HttpTransport | &mut MonotonicClock | &mut Allocator | &mut Random

Receives bounded informational heads until the shared parser reaches one final response.

Details

Parser, head, informational-budget, 101-upgrade, transport, and deadline failures remain the original ClientError. This operation does not copy response metadata or consume a body.

readSome

pub effect<'env> fn readSome<'exchange: 'env, P: 'env, 'life2: 'env, 'life3: 'env, 'env>(exchange: &'life2 mut silk/http_client.Exchange<'exchange, P>, output: &'life3 mut [u8]) -> usize ! ClientError | OutOfMemoryError ? &mut MonotonicClock | &mut Allocator | &mut Random where &mut P provides &HttpTransport from &mut HttpTransport | &mut MonotonicClock | &mut Allocator | &mut Random

Reads one framed payload prefix without consuming the next message suffix.

discardRemainingAtMost

pub effect<'env> fn discardRemainingAtMost<'exchange: 'env, P: 'env, 'life2: 'env, 'env>(exchange: &'life2 mut silk/http_client.Exchange<'exchange, P>, maxWireBytes: u64, deadline: silk/option.Option<silk/system_clock.Instant>) -> DiscardOutcome ! ClientError | OutOfMemoryError ? &mut MonotonicClock | &mut Allocator | &mut Random where &mut P provides &HttpTransport from &mut HttpTransport | &mut MonotonicClock | &mut Allocator | &mut Random

Discards response framing up to one aggregate wire-byte limit and reports whether it completed.

When to use

Use this operation when a caller can continue after the discard reaches its cap.

Details

The operation uses the smaller caller limit and Limits.maxDiscardWireBytes. The limit includes payload and framing bytes. Its explicit cleanup deadline is clamped to the exchange's unchanged operation deadline. Completed permits a later finishResponse call. CapReached leaves the exchange incomplete and removes reuse authority.

Gotchas

Malformed framing and read, deadline, allocation, or transport failures remain typed failures.

drainAndFinishAtMost

pub effect<'env> fn drainAndFinishAtMost<'exchange: 'env, P: 'env, 'life2: 'env, 'env>(exchange: &'life2 mut silk/http_client.Exchange<'exchange, P>, maxWireBytes: u64, deadline: Instant) -> DiscardOutcome ! ClientError | OutOfMemoryError ? &mut MonotonicClock | &mut Allocator | &mut Random where &mut P provides &HttpTransport from &mut HttpTransport | &mut MonotonicClock | &mut Allocator | &mut Random

Drains and finishes the selected response under one finite aggregate wire-byte limit.

When to use

Use this operation inside the live exchange when a response must complete before connection reuse. The standard client limit is 65536 bytes, and the maximum admitted limit is 1048576.

Details

The operation uses the smaller caller limit and Limits.maxDiscardWireBytes. The limit counts payload, framing, and trailers. The finite deadline is clamped to the request deadline. If a content decoder was selected, the operation validates it before it calls finishResponse.

Gotchas

CapReached leaves the exchange incomplete. Timeout, malformed framing, read, allocation, transport, and content-decoder failures remain their original typed failures.

discardRemaining

pub effect<'env> fn discardRemaining<'exchange: 'env, P: 'env, 'life2: 'env, 'env>(exchange: &'life2 mut silk/http_client.Exchange<'exchange, P>, maxWireBytes: u64) -> () ! ClientError | OutOfMemoryError ? &mut MonotonicClock | &mut Allocator | &mut Random where &mut P provides &HttpTransport from &mut HttpTransport | &mut MonotonicClock | &mut Allocator | &mut Random

Discards response framing under the smaller caller and client wire budget, without consuming a subsequent message. A deadline, limit, framing, or transport failure permanently removes reuse authority.

trailers

pub effect<'env> fn trailers<'head: 'env, 'exchange: 'env, P: 'env, 'env>(exchange: &'head silk/http_client.Exchange<'exchange, P>) -> silk/option.Option<silk/http_body.Trailers<'head>> ! ClientError

Returns completed chunk trailers borrowed exclusively from the active exchange.

finishResponse

pub effect<'env> fn finishResponse<'exchange: 'env, P: 'env, 'life2: 'env, 'env>(exchange: &'life2 mut silk/http_client.Exchange<'exchange, P>) -> () ! ClientError

Completes the response only after framing proves its boundary; never drains unread bytes.

abort

pub fn abort<'exchange, P, 'life2>(exchange: &'life2 mut silk/http_client.Exchange<'exchange, P>) -> ()

Removes reuse authority immediately without transport output or a hidden drain.

Tunnel

pub struct Tunnel<'tunnel, P>

An exclusive non-HTTP channel that reads the buffered response suffix first.

Method Tunnel.transferByteDuplex

pub effect<'env> fn transferByteDuplex<'tunnel: 'env, P: 'env, 'transfer: 'env, 'callback: 'env, A, E, ?CallbackRequirements, 'env>(self: &'transfer mut Tunnel<'tunnel, P>, callback: for<'call, 'duplexView: 'call> once fn<'callback>(&'call mut silk/http_client.TransferredTunnel<'duplexView, P>) -> once Effect<'call & 'callback; A ! E ? CallbackRequirements>) -> A ! E | ClientError ? CallbackRequirements where &mut P provides &ByteDuplex from &mut ByteDuplex, CallbackRequirements in Without<CallbackRequirements, &ByteDuplex>

Transfers the exact tunnel provider and retained input suffix to one scoped byte duplex.

Details

This operation allocates no memory. It constructs the complete duplex before the HTTP owner transfers its physical close authority. The callback owns that authority until cleanup. Cleanup closes the duplex after success, typed failure, or structured cancellation.

Gotchas

After scoped finalization, a repeated transfer returns InvalidState and leaves the existing Closed authority unchanged.

Method Tunnel.readSome

pub effect<'env> fn readSome<'tunnel: 'env, P: 'env, 'life2: 'env, 'life3: 'env, 'env>(self: &'life2 mut Tunnel<'tunnel, P>, output: &'life3 mut [u8], requestedDeadline: silk/option.Option<silk/system_clock.Instant>) -> ReadTransfer ! ClientError | OutOfMemoryError ? &mut MonotonicClock | &mut Allocator | &mut Random where &mut P provides &HttpTransport from &mut HttpTransport | &mut MonotonicClock | &mut Allocator | &mut Random

Reads the retained tunnel suffix before asking the underlying transport for more input.

Method Tunnel.writeSome

pub effect<'env> fn writeSome<'tunnel: 'env, P: 'env, 'life2: 'env, 'life3: 'env, 'env>(self: &'life2 mut Tunnel<'tunnel, P>, input: &'life3 [u8], requestedDeadline: silk/option.Option<silk/system_clock.Instant>) -> usize ! ClientError | OutOfMemoryError ? &mut MonotonicClock | &mut Allocator | &mut Random where &mut P provides &HttpTransport from &mut HttpTransport | &mut MonotonicClock | &mut Allocator | &mut Random

Writes one tunnel prefix under the caller's absolute deadline.

TransferredTunnel

pub struct TransferredTunnel<'tunnel, P>

One transferred tunnel that owns the connection's byte transport and retained input suffix.

Details

Reads use the retained suffix before the provider. All deadlines are clamped to the exchange deadline. Complete close is terminal and attempts the concrete provider close at most one time.

withTunnel

pub effect<'env> fn withTunnel<'tunnel: 'env, 'exchange: 'tunnel + 'env, 'callback: 'env, P: 'env, A, E, ?R, 'env>(exchange: &'tunnel mut silk/http_client.Exchange<'exchange, P>, callback: for<'call, 'tunnelView: 'call> once fn<'callback>(&'call mut silk/http_client.Tunnel<'tunnelView, P>) -> once Effect<'call & 'callback; A ! E ? R>) -> A ! E | ClientError ? R

Hands successful CONNECT to one scoped tunnel callback and permanently consumes HTTP reuse authority.

Implementation ByteDuplex for silk/http_client.TransferredTunnel<'tunnel, P>

impl ByteDuplex for silk/http_client.TransferredTunnel<'tunnel, P>

Operation readSomeRaw

readSomeRaw = TransferredTunnel.read

Operation writeSomeRaw

writeSomeRaw = TransferredTunnel.write

Operation flushRaw

flushRaw = TransferredTunnel.flushOutput

Operation shutdownWriteRaw

shutdownWriteRaw = TransferredTunnel.shutdownOutput

Operation closeRaw

closeRaw = TransferredTunnel.closeTransport

beginContent

pub effect<'env> fn beginContent<'head: 'env, 'exchange: 'head + 'env, P: 'env, 'env>(exchange: &'head mut silk/http_client.Exchange<'exchange, P>, mode: ContentMode, limits: ContentLimits) -> AppliedPlan ! ClientError | silk/http_content.ContentError<'head> | OutOfMemoryError ? &mut Allocator | &mut MonotonicClock

Selects one content pipeline from this exchange's current head before a nonempty raw read or a discard.

Details

Planning errors borrow the head and must be handled before the exchange is used again. The returned copy records the applied representation policy without exposing the affine decoder.

readContentSome

pub effect<'env> fn readContentSome<'exchange: 'env, P: 'env, 'life2: 'env, 'life3: 'env, 'env>(exchange: &'life2 mut silk/http_client.Exchange<'exchange, P>, output: &'life3 mut [u8]) -> ContentProgress ! ClientError | OutOfMemoryError ? &mut MonotonicClock | &mut Allocator | &mut Random where &mut P provides &HttpTransport from &mut HttpTransport | &mut MonotonicClock | &mut Allocator | &mut Random

Reads content-decoded bytes through the same rich transport and absolute deadline as the exchange. Returned bytes remain provisional until successful content and framing completion.

On this page

DetailsConnectionPhaseReadyActiveClosedExchangePhasePreparedAwaitContinueUploadAwaitResponseResponseTunnelFinishedAbortedContinuePolicyDisabledRequire100Field deadlineRequestOptionsField deadlineField continuePolicyAssociated function RequestOptions.defaultsLimitsField headField requestBodyField responseBodyField readCapacityField writeCapacityField maxRequestsField maxInformationalResponsesField maxInformationalWireBytesField maxDiscardWireBytesAssociated function Limits.defaultsImplementation Copy for LimitsClientErrorContentField errorHeadField errorBodyField errorTransportField errorOutputField errorField progressOutputTimeoutField progressOutputAllocationField errorField progressInvalidStateInvalidRequestInvalidLimitsLimitExceededTruncatedHeadUnsupportedUpgradeContinueTimeoutTimeoutvalidateLimitsDetailsDiscardOutcomeCompletedCapReachedReuseEligibilityEligibleNotReadyNotOwnedRequestLimitRetainedInputField bytesImplementation Copy for ReuseEligibilityWriteProgressField consumedField writtenField totalPayloadField totalWireImplementation Copy for WriteProgressConnectionMethod Connection.phaseMethod Connection.unreadMethod Connection.transportContextreuseEligibilityDetailsTransportContextField transportExchangeMethod Exchange.phaseMethod Exchange.headConnectionHandlerOperation handleRouteProtocolHttp10OptionalHttp11RequiredHttp11RouteSettingsField httpField requestField maxRequestHeadBytesField maxProxyCredentialBytesField protocolField tlsField handshakeDurationNanosecondsImplementation Copy for RouteSettingsAcquiredRouteContextOperation useRouteClientOperation settingsOperation acquireRouteTransportRouteHandlerOperation handleImplementation HttpTransport for silk/http_client.RouteTransport<'transport, 'provider, 'tunnel, P>Operation readSomeRawOperation writeSomeRawOperation flushOperation closewithRouteDetailsmakeOwnedwithOwnedwithConnectedclosewithExchangesendwriteSomefinishRequestreceivereceiveFinalDetailsreadSomediscardRemainingAtMostWhen to useDetailsGotchasdrainAndFinishAtMostWhen to useDetailsGotchasdiscardRemainingtrailersfinishResponseabortTunnelMethod Tunnel.transferByteDuplexDetailsGotchasMethod Tunnel.readSomeMethod Tunnel.writeSomeTransferredTunnelDetailswithTunnelImplementation ByteDuplex for silk/http_client.TransferredTunnel<'tunnel, P>Operation readSomeRawOperation writeSomeRawOperation flushRawOperation shutdownWriteRawOperation closeRawbeginContentDetailsreadContentSome