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 ConnectionPhaseThe exclusive connection state.
Ready
Ready = 0Admits one new exchange.
Active
Active = 1Has an active exchange.
Closed
Closed = 2Cannot perform another HTTP exchange.
ExchangePhase
pub enum ExchangePhaseThe next permitted exchange operation.
Prepared
Prepared = 0Permits sending the validated request head.
AwaitContinue
AwaitContinue = 1Requires response heads until 100 or an early final response.
Upload
Upload = 2Permits request body writes and request finish.
AwaitResponse
AwaitResponse = 3Permits receiving response heads.
Response
Response = 4Permits response body reads.
Tunnel
Tunnel = 5Permits an exclusive tunnel handoff.
Finished
Finished = 6Records complete message boundaries.
Aborted
Aborted = 7Forbids further exchange operations.
ContinuePolicy
pub union ContinuePolicyThe explicit upload admission policy.
Disabled
ContinuePolicy.Disabled: ContinuePolicyCompletes upload before receiving response heads.
Require100
ContinuePolicy.Require100 { deadline: Instant }: ContinuePolicyWaits for 100 under a finite absolute deadline, without fallback.
Field deadline
pub deadline: InstantThe absolute monotonic continue deadline, clamped to the overall deadline.
RequestOptions
pub struct RequestOptionsDeadlines 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: ContinuePolicyThe selected expectation policy, matching the prepared request.
Associated function RequestOptions.defaults
pub fn defaults() -> RequestOptionsReturns an unbounded overall request deadline with upload-before-response behavior.
Limits
pub struct LimitsFinite connection and message storage and wire budgets.
Field head
pub head: HeadLimitsParser limits for request and response heads.
Field requestBody
pub requestBody: BodyLimitsIndependent request body limits.
Field responseBody
pub responseBody: BodyLimitsIndependent response body limits.
Field readCapacity
pub readCapacity: usizePositive input buffer capacity.
Field writeCapacity
pub writeCapacity: usizePositive framing output scratch capacity.
Field maxRequests
pub maxRequests: usizeMaximum requests admitted on this connection.
Field maxInformationalResponses
pub maxInformationalResponses: usizeMaximum informational heads per exchange; use 16 for the standard default.
Field maxInformationalWireBytes
pub maxInformationalWireBytes: u64Maximum aggregate informational head wire bytes; use 65536 for the standard default.
Field maxDiscardWireBytes
pub maxDiscardWireBytes: u64Maximum wire bytes consumed by one explicit discard or drain operation; at most 1048576.
Associated function Limits.defaults
pub fn defaults() -> LimitsReturns finite standard limits, including 16 informational heads and 65536 informational wire bytes.
Implementation Copy for Limits
impl Copy for LimitsClientError
pub union ClientErrorA typed protocol, stage, budget, or transport failure.
Content
ClientError.Content { error: silk/http_content.ContentError<'static> }: ClientErrorPreserves 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.
Head
ClientError.Head { error: ParseError }: ClientErrorPreserves a head parser failure.
Field error
pub error: ParseErrorThe underlying head failure.
Body
ClientError.Body { error: BodyError }: ClientErrorPreserves framing failure and exact committed coordinates.
Field error
pub error: BodyErrorThe underlying body failure.
Transport
ClientError.Transport { error: TransportError }: ClientErrorPreserves plain or secured transport failure.
Field error
pub error: TransportErrorThe underlying transport failure.
Output
ClientError.Output { error: TransportError, progress: WriteProgress }: ClientErrorRecords framed output accepted before the transport failed.
Field error
pub error: TransportErrorThe underlying transport failure.
Field progress
pub progress: WriteProgressPayload and wire progress for the failed call.
OutputTimeout
ClientError.OutputTimeout { progress: WriteProgress }: ClientErrorRecords a client deadline expiring after payload or wire progress.
Field progress
pub progress: WriteProgressThe exact accepted payload and committed wire coordinates.
OutputAllocation
ClientError.OutputAllocation { error: OutOfMemoryError, progress: WriteProgress }: ClientErrorRecords payload accepted by framing before a transport allocation failed.
Field error
pub error: OutOfMemoryErrorThe allocator failure from the transport.
Field progress
pub progress: WriteProgressThe exact payload and committed wire coordinates.
InvalidState
ClientError.InvalidState: ClientErrorRejects an operation before I/O when its stage is invalid.
InvalidRequest
ClientError.InvalidRequest: ClientErrorRejects incompatible body framing or expectation policy before I/O.
InvalidLimits
ClientError.InvalidLimits: ClientErrorRejects zero buffer capacities before allocation.
LimitExceeded
ClientError.LimitExceeded: ClientErrorReports a finite informational or connection budget exhaustion.
TruncatedHead
ClientError.TruncatedHead: ClientErrorReports response input ending before a complete head.
UnsupportedUpgrade
ClientError.UnsupportedUpgrade: ClientErrorRejects status 101 without protocol handoff.
ContinueTimeout
ClientError.ContinueTimeout: ClientErrorReports expiry while waiting for permission to upload.
Timeout
ClientError.Timeout: ClientErrorReports 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 DiscardOutcomeThe result of a bounded response-framing discard.
Completed
Completed = 0The complete response boundary was reached within the limit.
CapReached
CapReached = 1The next response-framing byte would exceed the limit.
ReuseEligibility
pub union ReuseEligibilityWhether one owned connection can return to an idle pool.
Eligible
ReuseEligibility.Eligible: ReuseEligibilityThe connection has complete persistent boundaries and can return to an idle pool.
NotReady
ReuseEligibility.NotReady: ReuseEligibilityThe connection is not ready after one complete reusable exchange.
NotOwned
ReuseEligibility.NotOwned: ReuseEligibilityThe connection no longer owns armed physical close authority.
RequestLimit
ReuseEligibility.RequestLimit: ReuseEligibilityThe connection has reached its finite request-count limit.
RetainedInput
ReuseEligibility.RetainedInput { bytes: usize }: ReuseEligibilityThe connection retains bytes after the complete response boundary.
Field bytes
pub bytes: usizeThe exact retained byte count.
Implementation Copy for ReuseEligibility
impl Copy for ReuseEligibilityWriteProgress
pub struct WriteProgressExact accepted payload and transport wire prefixes for one write call.
Field consumed
pub consumed: usizePayload prefix accepted by the framing encoder.
Field written
pub written: usizeFramed prefix committed to the transport in this call.
Field totalPayload
pub totalPayload: u64Cumulative encoded payload bytes.
Field totalWire
pub totalWire: u64Cumulative encoded wire bytes.
Implementation Copy for WriteProgress
impl Copy for WriteProgressConnection
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>) -> ConnectionPhaseReturns the current logical connection phase.
Method Connection.unread
pub fn unread<P, 'life1>(self: &'life1 Connection<P>) -> usizeReturns 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>) -> ReuseEligibilityReturns 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 PThe 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>) -> ExchangePhaseReturns 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> ! ClientErrorBorrows 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 HttpTransportRuns inside an exclusive connection scope and preserves caller channels.
RouteProtocol
pub enum RouteProtocolThe HTTP version and TLS application-protocol policy for one routed scope.
Http10
Http10 = 0Uses HTTP/1.0 and sends no TLS application-protocol extension.
OptionalHttp11
OptionalHttp11 = 1Uses HTTP/1.1 and permits the TLS peer to omit application-protocol selection.
RequiredHttp11
RequiredHttp11 = 2Uses HTTP/1.1 and requires the TLS peer to select http/1.1.
RouteSettings
pub struct RouteSettingsComplete finite settings for one target-neutral routed HTTP scope.
Field http
pub http: LimitsConnection, parser, buffering, and message limits.
Field request
pub request: HeaderLimitsRequest-head value limits used for the generated CONNECT request.
Field maxRequestHeadBytes
pub maxRequestHeadBytes: usizeMaximum owned bytes in the generated CONNECT head.
Field maxProxyCredentialBytes
pub maxProxyCredentialBytes: usizeMaximum owned proxy-credential bytes in the generated CONNECT head.
Field protocol
pub protocol: RouteProtocolHTTP version and TLS application-protocol policy.
Field tls
pub tls: ClientLimitsTLS client protocol limits.
Field handshakeDurationNanoseconds
pub handshakeDurationNanoseconds: u64Finite TLS handshake duration in nanoseconds.
Implementation Copy for RouteSettings
impl Copy for RouteSettingsAcquiredRouteContext
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) -> RouteSettingsReturns 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 ByteDuplexRuns 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.readOperation writeSomeRaw
writeSomeRaw = RouteTransport.writeOperation flush
flush = RouteTransport.flushOutputOperation close
close = RouteTransport.closeTransportwithRoute
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 HttpTransportOwns 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 HttpTransportLends 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 HttpTransportLends 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 HttpTransportCloses 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 AllocatorLends 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 RandomSends 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 RandomAccepts 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 RandomCompletes 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 RandomReceives 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 RandomReceives 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 RandomReads 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 RandomDiscards 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 RandomDrains 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 RandomDiscards 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>> ! ClientErrorReturns 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>) -> () ! ClientErrorCompletes 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 RandomReads 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 RandomWrites 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 ? RHands 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.readOperation writeSomeRaw
writeSomeRaw = TransferredTunnel.writeOperation flushRaw
flushRaw = TransferredTunnel.flushOutputOperation shutdownWriteRaw
shutdownWriteRaw = TransferredTunnel.shutdownOutputOperation closeRaw
closeRaw = TransferredTunnel.closeTransportbeginContent
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 MonotonicClockSelects 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 RandomReads content-decoded bytes through the same rich transport and absolute deadline as the exchange. Returned bytes remain provisional until successful content and framing completion.