~/bend-docscommunity

http.bend relies on unsafe/foreign

raw source on the hub · import bend-kit-http@0.41.0.0/http.bend as Http

HTTP/1.1 and HTTP/2 client, with an HTTP/1.1 server. Source: https://github.com/paymog/bend-kit/tree/main/http

16 imports
import Base
import ./admission.bend as Admission
import ./completion.bend as Completion
import bend-kit-wire@0.4.8.1/wire.bend as Wire
import bend-kit-http2@0.5.0.2/http2.bend as H2
import bend-kit-http2@0.5.0.2/hpack.bend as Hpack
import bend-kit-bytes@0.3.3.1/bytes.bend as HBytes
import bend-kit-time@0.3.0.2/pure.bend as Time
import bend-kit-time@0.3.0.2/time.bend as Clock
import ./pure.bend as Pure
import bend-kit-concurrency@0.2.0.0/concurrency.bend as Conc
import bend-kit-url@0.4.1.0/url.bend as Url
import bend-kit-json@0.7.3.0/json.bend as Json
import bend-kit-bytes@0.3.3.1/bytes.bend as Bytes
import bend-kit-dns@0.7.1.2/dns.bend as Dns
import bend-kit-zlib@0.6.0.0/native.bend as ZNative

Types

type Reply source · line 40 · raw

Type

type Conn source · line 142 · raw

Type

Paths to a PEM client chain and its private key for mutual TLS.

type H2Reader source · line 146 · raw

Type

type H2Step source · line 149 · raw

Type

type Pool source · line 153 · raw

Type

type Dial source · line 354 · raw

Type

ponytail: addresses are tried in order, not raced; a broken first route can consume the step timeout.

type Took source · line 907 · raw

Type

type Hops source · line 1169 · raw

Type

type StreamWire source · line 1513 · raw

Type

Streaming (a body read or sent in pieces). A decoded stream owns its decoders. What the next read returns: read more, a raw piece, a decoded piece, the end, or an error.

type Stream source · line 1519 · raw

Type

back: the pool key, while the connection can take another request after this body.

type Fed source · line 1539 · raw

Type

type Sn source · line 1973 · raw

Type

Go: the next request. Drop: close this stream, then go on. Done: the answer.

type StreamHops source · line 2008 · raw

Type

The redirect loop's state for a stream: what to do next, the client identity, the jar, and the CA file.

type Opened source · line 2057 · raw

Type

type Server source · line 2635 · raw

@-C:Data -> Type

Finite positive settings, not zero/unlimited sentinels.

type ServerStats source · line 2688 · raw

Data

Copyable read-only observations remain usable while server.run owns the listener.

type ServerControl source · line 2710 · raw

Data

type AcceptStep source · line 2764 · raw

@-C:Data -> Type

One accepting step, so the caller retains explicit listener ownership.

type ServerLoop source · line 2811 · raw

@-C:Data -> Type

type Writer source · line 3039 · raw

Type

type WriteHead source · line 3042 · raw

@-S:Type -> Type

Definitions

def clock.instant source · line 20 · raw

@v:0xb11aca60dbb10f10d8f37cc3807477a2/time.Instant -> 0xb11aca60dbb10f10d8f37cc3807477a2/pure.Instant

def clock.duration source · line 25 · raw

@v:0xb11aca60dbb10f10d8f37cc3807477a2/time.Duration -> 0xb11aca60dbb10f10d8f37cc3807477a2/pure.Duration

def clock.now source · line 30 · raw

IO(0xb11aca60dbb10f10d8f37cc3807477a2/pure.Instant)

def clock.mono source · line 35 · raw

IO(0xb11aca60dbb10f10d8f37cc3807477a2/pure.Duration)

def io.recv.words source · line 48 · raw

@tls:Bool -> @s:Socket -> @max:U32 -> @ms:U32 -> IO(Pair(Socket, Result<&1, &1, Pair(U32, String), Pair(U32, Array<U32>)>))

The body type and its conversions, so a caller needs no bytes import.

def io.send.words source · line 55 · raw

@tls:Bool -> @s:Socket -> @+len:U32 -> @buf:Array<U32> -> IO(Pair(Socket, Result<&1, &1, Pair(U32, String), Unit>))

def io.send.bytes source · line 62 · raw

@tls:Bool -> @s:Socket -> @b:0xec25e4adfb02e59e4b817801115988ee/bytes.Bytes -> IO(Pair(Socket, Result<&1, &1, Pair(U32, String), Unit>))

def io.close source · line 66 · raw

@tls:Bool -> @s:Socket -> IO(Unit)

def fetch.close source · line 73 · raw

@tls:Bool -> @s:Socket -> @r:Result<&1, &1, 0xc850b7230535f08df98532e8cb531076/pure.Err, 0xc850b7230535f08df98532e8cb531076/pure.Res> -> IO(Result<&1, &1, 0xc850b7230535f08df98532e8cb531076/pure.Err, 0xc850b7230535f08df98532e8cb531076/pure.Res>)

def fetch.bad source · line 80 · raw

@tls:Bool -> @s:Socket -> @e:Maybe<&2, 0xc850b7230535f08df98532e8cb531076/pure.Err> -> IO(Result<&1, &1, 0xc850b7230535f08df98532e8cb531076/pure.Err, 0xc850b7230535f08df98532e8cb531076/pure.Res>)

none: no response byte arrived, so an idempotent request may be retried (RFC 9112 §9.3.1). sock: the socket, when it can take another request.

def fetch.shut source · line 87 · raw

@tls:Bool -> @s:Socket -> @r:Result<&1, &1, 0xc850b7230535f08df98532e8cb531076/pure.Err, 0xc850b7230535f08df98532e8cb531076/pure.Res> -> @none:Bool -> IO(0xc850b7230535f08df98532e8cb531076/pure.Out)

def fetch.hold.go source · line 92 · raw

@tls:Bool -> @s:Socket -> @res:0xc850b7230535f08df98532e8cb531076/pure.Res -> @left:Maybe<&1, 0xec25e4adfb02e59e4b817801115988ee/bytes.Bytes> -> IO(0xc850b7230535f08df98532e8cb531076/pure.Out)

def fetch.hold source · line 99 · raw

@tls:Bool -> @close:Bool -> @s:Socket -> @res:0xc850b7230535f08df98532e8cb531076/pure.Res -> @left:Maybe<&1, 0xec25e4adfb02e59e4b817801115988ee/bytes.Bytes> -> IO(0xc850b7230535f08df98532e8cb531076/pure.Out)

def fetch.failout source · line 103 · raw

@tls:Bool -> @s:Socket -> @e:Maybe<&2, 0xc850b7230535f08df98532e8cb531076/pure.Err> -> @none:Bool -> IO(0xc850b7230535f08df98532e8cb531076/pure.Out)

def exchange.sent source · line 123 · raw

@+tls:Bool -> @+ms:U32 -> @+close:Bool -> @+head:Bool -> @m:Pair(Socket, Result<&1, &1, Pair(U32, String), Unit>) -> IO(0xc850b7230535f08df98532e8cb531076/pure.Out)

def exchange.go source · line 131 · raw

@+tls:Bool -> @+ms:U32 -> @+close:Bool -> @+head:Bool -> @s:Socket -> @wire:0xec25e4adfb02e59e4b817801115988ee/bytes.Bytes -> IO(0xc850b7230535f08df98532e8cb531076/pure.Out)

def exchange source · line 136 · raw

@+tls:Bool -> @+ms:U32 -> @+close:Bool -> @+head:Bool -> @s:Socket -> @wire:0xec25e4adfb02e59e4b817801115988ee/bytes.Bytes -> IO(Pair(Maybe<&1, Socket>, Pair(Result<&1, &1, 0xc850b7230535f08df98532e8cb531076/pure.Err, 0xc850b7230535f08df98532e8cb531076/pure.Res>, 0xec25e4adfb02e59e4b817801115988ee/bytes.Bytes)))

def pool.new.with source · line 156 · raw

@+cap:U32 -> Pool

def pool.new source · line 160 · raw

Pool

Up to 8 idle sockets per origin.

def pool.take.of source · line 163 · raw

@+cap:U32 -> @+key:String -> @r:Pair(Map<&1, List<&1, Conn>>, Maybe<&1, List<&1, Conn>>) -> Pair(Pool, Maybe<&1, Conn>)

def pool.take source · line 176 · raw

@p:Pool -> @+key:String -> Pair(Pool, Maybe<&1, Conn>)

The socket given back last.

def conn.close source · line 180 · raw

@c:Conn -> IO(Unit)

def conns.cut source · line 188 · raw

@xs:List<&1, Conn> -> @n:Nat -> IO(List<&1, Conn>)

The first n sockets; the rest are closed.

def pool.give.of source · line 203 · raw

@+cap:U32 -> @+key:String -> @c:Conn -> @limit:Nat -> @r:Pair(Map<&1, List<&1, Conn>>, Maybe<&1, List<&1, Conn>>) -> IO(Pool)

def pool.give source · line 211 · raw

@p:Pool -> @+key:String -> @c:Conn -> IO(Pool)

Past the limit (cap for HTTP/1.1, one session for HTTP/2), close the oldest idle connection.

def pool.close.go source · line 220 · raw

@xs:List<&1, List<&1, Conn>> -> IO(Unit)

def pool.close source · line 229 · raw

@p:Pool -> IO(Unit)

def conn.tls source · line 234 · raw

@m:Pair(Socket, Result<&1, &1, Pair(U32, String), Unit>) -> IO(Result<&1, &1, 0xc850b7230535f08df98532e8cb531076/pure.Err, Conn>)

RFC 9110 §9.2.2

def conn.h2.sent source · line 244 · raw

@client:0xbfcf01f5908bfcd8a7e6b4ce550a378b/http2.Client -> @r:Pair(Socket, Result<&1, &1, Pair(U32, String), Unit>) -> IO(Result<&1, &1, 0xc850b7230535f08df98532e8cb531076/pure.Err, Conn>)

def conn.h2.start source · line 254 · raw

@s:Socket -> @r:Pair(0xbfcf01f5908bfcd8a7e6b4ce550a378b/http2.Client, 0xec25e4adfb02e59e4b817801115988ee/bytes.Bytes) -> IO(Result<&1, &1, 0xc850b7230535f08df98532e8cb531076/pure.Err, Conn>)

def conn.tls.protocol source · line 260 · raw

@proto:String -> @s:Socket -> IO(Result<&1, &1, 0xc850b7230535f08df98532e8cb531076/pure.Err, Conn>)

def conn.tls.alpn source · line 273 · raw

@m:Pair(Socket, Result<&1, &1, Pair(U32, String), String>) -> IO(Result<&1, &1, 0xc850b7230535f08df98532e8cb531076/pure.Err, Conn>)

def conn.secure.store source · line 283 · raw

@offer:Bool -> @s:Socket -> @host:String -> @+ms:U32 -> IO(Result<&1, &1, 0xc850b7230535f08df98532e8cb531076/pure.Err, Conn>)

def conn.secure.file source · line 296 · raw

@offer:Bool -> @s:Socket -> @host:String -> @+ms:U32 -> @+ca:String -> IO(Result<&1, &1, 0xc850b7230535f08df98532e8cb531076/pure.Err, Conn>)

def conn.secure.no.cert source · line 310 · raw

@empty:Bool -> @offer:Bool -> @s:Socket -> @host:String -> @+ms:U32 -> @+ca:String -> IO(Result<&1, &1, 0xc850b7230535f08df98532e8cb531076/pure.Err, Conn>)

def conn.secure.tls source · line 318 · raw

@cert:Maybe<&2, 0xc850b7230535f08df98532e8cb531076/pure.Cert> -> @s:Socket -> @host:String -> @+ms:U32 -> @offer:Bool -> @+ca:String -> IO(Result<&1, &1, 0xc850b7230535f08df98532e8cb531076/pure.Err, Conn>)

def conn.secure source · line 330 · raw

@+ms:U32 -> @sni:String -> @s:Socket -> @tls:Bool -> @cert:Maybe<&2, 0xc850b7230535f08df98532e8cb531076/pure.Cert> -> @offer:Bool -> @+ca:String -> IO(Result<&1, &1, 0xc850b7230535f08df98532e8cb531076/pure.Err, Conn>)

A failed handshake is an error, never plaintext.

def conn.made source · line 338 · raw

@+ms:U32 -> @sni:String -> @tls:Bool -> @cert:Maybe<&2, 0xc850b7230535f08df98532e8cb531076/pure.Cert> -> @offer:Bool -> @+ca:String -> @r:Result<&1, &1, Pair(U32, String), Socket> -> IO(Result<&1, &1, 0xc850b7230535f08df98532e8cb531076/pure.Err, Conn>)

def conn.open source · line 347 · raw

@+tls:Bool -> @+ms:U32 -> @sni:String -> @ip:String -> @port:U32 -> IO(Result<&1, &1, 0xc850b7230535f08df98532e8cb531076/pure.Err, Conn>)

def conn.dial.time source · line 357 · raw

@+ip:String -> @+port:U32 -> @+deadline:Nat -> @now:Nat -> @expired:Bool -> IO(Result<&1, &1, Pair(U32, String), Socket>)

def conn.dial.with source · line 365 · raw

@+ip:String -> @+port:U32 -> @+ms:U32 -> @+deadline:Nat -> @+now:Nat -> @unlimited:Bool -> IO(Result<&1, &1, Pair(U32, String), Socket>)

def conn.dial.try source · line 373 · raw

@+ip:String -> @+port:U32 -> @+ms:U32 -> @+deadline:Nat -> IO(Result<&1, &1, Pair(U32, String), Socket>)

def conn.dial.after source · line 379 · raw

@r:Result<&1, &1, Pair(U32, String), Socket> -> @ip:String -> @+port:U32 -> @+ms:U32 -> @+deadline:Nat -> IO(Result<&1, &1, Pair(U32, String), Socket>)

def conn.dial.more source · line 387 · raw

@prev:IO(Result<&1, &1, Pair(U32, String), Socket>) -> @ip:String -> @+port:U32 -> @+ms:U32 -> @+deadline:Nat -> IO(Result<&1, &1, Pair(U32, String), Socket>)

def conn.dial.fold source · line 393 · raw

@d:Dial -> @ip:String -> Dial

def conn.dial.run source · line 397 · raw

@d:Dial -> IO(Result<&1, &1, Pair(U32, String), Socket>)

def conn.dial.all source · line 401 · raw

@+port:U32 -> @+ms:U32 -> @+start:Nat -> @first:String -> @rest:List<&2, String> -> IO(Result<&1, &1, Pair(U32, String), Socket>)

def conn.open.all source · line 411 · raw

@+tls:Bool -> @+ms:U32 -> @+host:String -> @+port:U32 -> @ips:List<&2, String> -> @cert:Maybe<&2, 0xc850b7230535f08df98532e8cb531076/pure.Cert> -> @offer:Bool -> @+ca:String -> IO(Result<&1, &1, 0xc850b7230535f08df98532e8cb531076/pure.Err, Conn>)

def proxy.env.lower source · line 423 · raw

@r:Result<&1, &1, Pair(U32, String), String> -> @upper:String -> IO(String)

def proxy.env source · line 433 · raw

@lower:String -> @upper:String -> IO(String)

def proxy.select source · line 438 · raw

@+scheme:String -> @+host:String -> @+port:U32 -> IO(Maybe<&2, 0xc850b7230535f08df98532e8cb531076/pure.Proxy>)

def h2.header.values source · line 447 · raw

@+name:String -> @+mode:U32 -> @vs:List<&2, String> -> List<&2, 0xbfcf01f5908bfcd8a7e6b4ce550a378b/hpack.Field>

def h2.header.item source · line 454 · raw

@skip:Bool -> @+name:String -> @vs:List<&2, String> -> @tail:List<&2, 0xbfcf01f5908bfcd8a7e6b4ce550a378b/hpack.Field> -> List<&2, 0xbfcf01f5908bfcd8a7e6b4ce550a378b/hpack.Field>

def h2.header.items source · line 462 · raw

@xs:List<&2, Sigma<&2, &2, String, _ => List<&2, String>>> -> @+nominated:List<&2, String> -> List<&2, 0xbfcf01f5908bfcd8a7e6b4ce550a378b/hpack.Field>

def h2.request.fields source · line 472 · raw

@+method:String -> @target:String -> @authority:String -> @headers:Map<&2, List<&2, String>> -> List<&2, 0xbfcf01f5908bfcd8a7e6b4ce550a378b/hpack.Field>

def h2.response.status source · line 480 · raw

@xs:List<&2, 0xbfcf01f5908bfcd8a7e6b4ce550a378b/hpack.Field> -> Maybe<&2, U32>

def h2.response.headers source · line 491 · raw

@xs:List<&2, 0xbfcf01f5908bfcd8a7e6b4ce550a378b/hpack.Field> -> @acc:Map<&2, List<&2, String>> -> Map<&2, List<&2, String>>

def h2.response.final source · line 503 · raw

@interim:Bool -> @+status:U32 -> @headers:List<&2, 0xbfcf01f5908bfcd8a7e6b4ce550a378b/hpack.Field> -> @body:0xec25e4adfb02e59e4b817801115988ee/bytes.Bytes -> Result<&1, &1, 0xc850b7230535f08df98532e8cb531076/pure.Err, Maybe<&1, 0xc850b7230535f08df98532e8cb531076/pure.Res>>

def h2.response.valid source · line 512 · raw

@valid:Bool -> @+status:U32 -> @headers:List<&2, 0xbfcf01f5908bfcd8a7e6b4ce550a378b/hpack.Field> -> @body:0xec25e4adfb02e59e4b817801115988ee/bytes.Bytes -> Result<&1, &1, 0xc850b7230535f08df98532e8cb531076/pure.Err, Maybe<&1, 0xc850b7230535f08df98532e8cb531076/pure.Res>>

def h2.response.parsed source · line 520 · raw

@m:Maybe<&2, U32> -> @headers:List<&2, 0xbfcf01f5908bfcd8a7e6b4ce550a378b/hpack.Field> -> @body:0xec25e4adfb02e59e4b817801115988ee/bytes.Bytes -> Result<&1, &1, 0xc850b7230535f08df98532e8cb531076/pure.Err, Maybe<&1, 0xc850b7230535f08df98532e8cb531076/pure.Res>>

def h2.response source · line 529 · raw

@+fields:List<&2, 0xbfcf01f5908bfcd8a7e6b4ce550a378b/hpack.Field> -> @body:0xec25e4adfb02e59e4b817801115988ee/bytes.Bytes -> Result<&1, &1, 0xc850b7230535f08df98532e8cb531076/pure.Err, Maybe<&1, 0xc850b7230535f08df98532e8cb531076/pure.Res>>

def h2.send.report source · line 534 · raw

@r:Pair(Socket, Result<&1, &1, Pair(U32, String), Unit>) -> IO(Result<&1, &1, 0xc850b7230535f08df98532e8cb531076/pure.Err, Socket>)

def h2.send.one source · line 545 · raw

@prev:Result<&1, &1, 0xc850b7230535f08df98532e8cb531076/pure.Err, Socket> -> @b:0xec25e4adfb02e59e4b817801115988ee/bytes.Bytes -> IO(Result<&1, &1, 0xc850b7230535f08df98532e8cb531076/pure.Err, Socket>)

def h2.send.fold source · line 556 · raw

@prev:IO(Result<&1, &1, 0xc850b7230535f08df98532e8cb531076/pure.Err, Socket>) -> @b:0xec25e4adfb02e59e4b817801115988ee/bytes.Bytes -> IO(Result<&1, &1, 0xc850b7230535f08df98532e8cb531076/pure.Err, Socket>)

def h2.send source · line 562 · raw

@xs:List<&1, 0xec25e4adfb02e59e4b817801115988ee/bytes.Bytes> -> @s:Socket -> IO(Result<&1, &1, 0xc850b7230535f08df98532e8cb531076/pure.Err, Socket>)

def h2.reader.fail source · line 566 · raw

@s:Socket -> @e:0xc850b7230535f08df98532e8cb531076/pure.Err -> IO(Result<&1, &1, 0xc850b7230535f08df98532e8cb531076/pure.Err, Pair(H2Reader, 0xbfcf01f5908bfcd8a7e6b4ce550a378b/http2.ClientEvent)>)

def h2.reader.sent source · line 572 · raw

@+id:U32 -> @client:0xbfcf01f5908bfcd8a7e6b4ce550a378b/http2.Client -> @events:List<&1, 0xbfcf01f5908bfcd8a7e6b4ce550a378b/http2.ClientEvent> -> @sent:Result<&1, &1, 0xc850b7230535f08df98532e8cb531076/pure.Err, Socket> -> Result<&1, &1, 0xc850b7230535f08df98532e8cb531076/pure.Err, H2Reader>

def h2.reader.reply source · line 580 · raw

@s:Socket -> @+id:U32 -> @reply:0xbfcf01f5908bfcd8a7e6b4ce550a378b/http2.Reply -> IO(Result<&1, &1, 0xc850b7230535f08df98532e8cb531076/pure.Err, H2Reader>)

def h2.reader.received source · line 592 · raw

@client:0xbfcf01f5908bfcd8a7e6b4ce550a378b/http2.Client -> @+id:U32 -> @got:Pair(Socket, Result<&1, &1, Pair(U32, String), Pair(U32, Array<U32>)>) -> IO(Result<&1, &1, 0xc850b7230535f08df98532e8cb531076/pure.Err, H2Reader>)

def h2.event.for source · line 607 · raw

@+want:U32 -> @event:0xbfcf01f5908bfcd8a7e6b4ce550a378b/http2.ClientEvent -> Pair(Bool, 0xbfcf01f5908bfcd8a7e6b4ce550a378b/http2.ClientEvent)

def h2.reader.selected source · line 626 · raw

@selected:Pair(Bool, 0xbfcf01f5908bfcd8a7e6b4ce550a378b/http2.ClientEvent) -> @reader:H2Reader -> IO(Result<&1, &1, 0xc850b7230535f08df98532e8cb531076/pure.Err, Pair(H2Reader, 0xbfcf01f5908bfcd8a7e6b4ce550a378b/http2.ClientEvent)>)

def h2.reader.next source · line 635 · raw

@n:Nat -> @r:Result<&1, &1, 0xc850b7230535f08df98532e8cb531076/pure.Err, H2Reader> -> @+ms:U32 -> IO(Result<&1, &1, 0xc850b7230535f08df98532e8cb531076/pure.Err, Pair(H2Reader, 0xbfcf01f5908bfcd8a7e6b4ce550a378b/http2.ClientEvent)>)

def h2.reader.start source · line 651 · raw

@s:Socket -> @client:0xbfcf01f5908bfcd8a7e6b4ce550a378b/http2.Client -> @request:0xc850b7230535f08df98532e8cb531076/pure.Send -> IO(Result<&1, &1, 0xc850b7230535f08df98532e8cb531076/pure.Err, H2Reader>)

def h2.buffered.fail source · line 662 · raw

@reader:H2Reader -> @e:0xc850b7230535f08df98532e8cb531076/pure.Err -> IO(Result<&1, &1, 0xc850b7230535f08df98532e8cb531076/pure.Err, Pair(Conn, 0xc850b7230535f08df98532e8cb531076/pure.Res)>)

def h2.buffered.done source · line 668 · raw

@res:Maybe<&1, 0xc850b7230535f08df98532e8cb531076/pure.Res> -> @reader:H2Reader -> @parts:List<&1, 0xec25e4adfb02e59e4b817801115988ee/bytes.Bytes> -> IO(Result<&1, &1, 0xc850b7230535f08df98532e8cb531076/pure.Err, Pair(Conn, 0xc850b7230535f08df98532e8cb531076/pure.Res)>)

def h2.buffered.head source · line 678 · raw

@fields:List<&2, 0xbfcf01f5908bfcd8a7e6b4ce550a378b/hpack.Field> -> Maybe<&1, 0xc850b7230535f08df98532e8cb531076/pure.Res>

def h2.buffered.loop source · line 681 · raw

@n:Nat -> @+ms:U32 -> @over:Bool -> @step:H2Step -> @res:Maybe<&1, 0xc850b7230535f08df98532e8cb531076/pure.Res> -> @parts:List<&1, 0xec25e4adfb02e59e4b817801115988ee/bytes.Bytes> -> @+used:U32 -> IO(Result<&1, &1, 0xc850b7230535f08df98532e8cb531076/pure.Err, Pair(Conn, 0xc850b7230535f08df98532e8cb531076/pure.Res)>)

def h2.buffered.start source · line 716 · raw

@start:Result<&1, &1, 0xc850b7230535f08df98532e8cb531076/pure.Err, H2Reader> -> @+ms:U32 -> IO(Result<&1, &1, 0xc850b7230535f08df98532e8cb531076/pure.Err, Pair(Conn, 0xc850b7230535f08df98532e8cb531076/pure.Res)>)

def h2.exchange source · line 725 · raw

@s:Socket -> @client:0xbfcf01f5908bfcd8a7e6b4ce550a378b/http2.Client -> @+ms:U32 -> @request:0xc850b7230535f08df98532e8cb531076/pure.Send -> IO(Result<&1, &1, 0xc850b7230535f08df98532e8cb531076/pure.Err, Pair(Conn, 0xc850b7230535f08df98532e8cb531076/pure.Res)>)

def proxy.connect.fail source · line 731 · raw

@s:Socket -> @e:0xc850b7230535f08df98532e8cb531076/pure.Err -> IO(Result<&1, &1, 0xc850b7230535f08df98532e8cb531076/pure.Err, Conn>)

def proxy.connect.extra source · line 736 · raw

@m:Maybe<&2, String> -> @s:Socket -> @+ms:U32 -> @sni:String -> @cert:Maybe<&2, 0xc850b7230535f08df98532e8cb531076/pure.Cert> -> @+ca:String -> IO(Result<&1, &1, 0xc850b7230535f08df98532e8cb531076/pure.Err, Conn>)

def proxy.connect.status source · line 748 · raw

@ok:Bool -> @+status:U32 -> @raw:String -> @s:Socket -> @+ms:U32 -> @sni:String -> @cert:Maybe<&2, 0xc850b7230535f08df98532e8cb531076/pure.Cert> -> @+ca:String -> IO(Result<&1, &1, 0xc850b7230535f08df98532e8cb531076/pure.Err, Conn>)

def proxy.connect.finish source · line 757 · raw

@res:0xc850b7230535f08df98532e8cb531076/pure.Res -> @raw:String -> @s:Socket -> @+ms:U32 -> @sni:String -> @cert:Maybe<&2, 0xc850b7230535f08df98532e8cb531076/pure.Cert> -> @+ca:String -> IO(Result<&1, &1, 0xc850b7230535f08df98532e8cb531076/pure.Err, Conn>)

def proxy.connect.loop source · line 763 · raw

@n:Nat -> @step:0xc850b7230535f08df98532e8cb531076/pure.TunnelStep -> @+ms:U32 -> @+sni:String -> @+cert:Maybe<&2, 0xc850b7230535f08df98532e8cb531076/pure.Cert> -> @+ca:String -> IO(Result<&1, &1, 0xc850b7230535f08df98532e8cb531076/pure.Err, Conn>)

def proxy.connect.sent source · line 801 · raw

@r:Pair(Socket, Result<&1, &1, Pair(U32, String), Unit>) -> @+ms:U32 -> @sni:String -> @cert:Maybe<&2, 0xc850b7230535f08df98532e8cb531076/pure.Cert> -> @+ca:String -> IO(Result<&1, &1, 0xc850b7230535f08df98532e8cb531076/pure.Err, Conn>)

def proxy.connect source · line 811 · raw

@s:Socket -> @+ms:U32 -> @sni:String -> @authority:String -> @authorization:String -> @cert:Maybe<&2, 0xc850b7230535f08df98532e8cb531076/pure.Cert> -> @+ca:String -> IO(Result<&1, &1, 0xc850b7230535f08df98532e8cb531076/pure.Err, Conn>)

def proxy.route.tls source · line 819 · raw

@tls:Bool -> @s:Socket -> @+ms:U32 -> @sni:String -> @authority:String -> @authorization:String -> @cert:Maybe<&2, 0xc850b7230535f08df98532e8cb531076/pure.Cert> -> @+ca:String -> IO(Result<&1, &1, 0xc850b7230535f08df98532e8cb531076/pure.Err, Conn>)

def proxy.route.connected source · line 828 · raw

@tls:Bool -> @+ms:U32 -> @sni:String -> @authority:String -> @authorization:String -> @cert:Maybe<&2, 0xc850b7230535f08df98532e8cb531076/pure.Cert> -> @+ca:String -> @r:Result<&1, &1, 0xc850b7230535f08df98532e8cb531076/pure.Err, Conn> -> IO(Result<&1, &1, 0xc850b7230535f08df98532e8cb531076/pure.Err, Conn>)

def proxy.route.open source · line 843 · raw

@+ms:U32 -> @+tls:Bool -> @+host:String -> @+port:U32 -> @+sni:String -> @+authority:String -> @+authorization:String -> @cert:Maybe<&2, 0xc850b7230535f08df98532e8cb531076/pure.Cert> -> @+ca:String -> IO(Result<&1, &1, 0xc850b7230535f08df98532e8cb531076/pure.Err, Conn>)

def route.open source · line 853 · raw

@+ms:U32 -> @offer:Bool -> @route:0xc850b7230535f08df98532e8cb531076/pure.Route -> IO(Result<&1, &1, 0xc850b7230535f08df98532e8cb531076/pure.Err, Conn>)

offer: send the h2 ALPN offer on a direct TLS connection.

def conn.ex.h1 source · line 862 · raw

@+tls:Bool -> @s:Socket -> @+ms:U32 -> @request:0xc850b7230535f08df98532e8cb531076/pure.Send -> IO(0xc850b7230535f08df98532e8cb531076/pure.Out)

def pool.keep.s source · line 868 · raw

@p:Pool -> @+key:String -> @+tls:Bool -> @res:0xc850b7230535f08df98532e8cb531076/pure.Res -> @s:Socket -> @clean:Bool -> IO(Pair(Pool, Result<&1, &1, 0xc850b7230535f08df98532e8cb531076/pure.Err, 0xc850b7230535f08df98532e8cb531076/pure.Res>))

A socket with bytes past the response is out of step with the server, so it is closed.

def pool.keep.m source · line 879 · raw

@p:Pool -> @+key:String -> @+tls:Bool -> @res:0xc850b7230535f08df98532e8cb531076/pure.Res -> @+clean:Bool -> @sock:Maybe<&1, Socket> -> IO(Pair(Pool, Result<&1, &1, 0xc850b7230535f08df98532e8cb531076/pure.Err, 0xc850b7230535f08df98532e8cb531076/pure.Res>))

def pool.keep source · line 886 · raw

@p:Pool -> @+key:String -> @+tls:Bool -> @res:0xc850b7230535f08df98532e8cb531076/pure.Res -> @sock:Maybe<&1, Socket> -> @rest:0xec25e4adfb02e59e4b817801115988ee/bytes.Bytes -> IO(Pair(Pool, Result<&1, &1, 0xc850b7230535f08df98532e8cb531076/pure.Err, 0xc850b7230535f08df98532e8cb531076/pure.Res>))

def pool.after source · line 890 · raw

@p:Pool -> @+key:String -> @+tls:Bool -> @o:0xc850b7230535f08df98532e8cb531076/pure.Out -> IO(Pair(Pool, Result<&1, &1, 0xc850b7230535f08df98532e8cb531076/pure.Err, 0xc850b7230535f08df98532e8cb531076/pure.Res>))

def pool.h2.reusable source · line 897 · raw

@c:Conn -> Pair(Bool, Conn)

def took.of source · line 912 · raw

@pm:Pair(Pool, Maybe<&1, Conn>) -> Pair(Pool, Took)

def took.seen source · line 920 · raw

@+tls:Bool -> @r:Pair(Socket, Bool) -> Took

def h2.idle.kept source · line 925 · raw

@state:Pair(Bool, Conn) -> Took

A live session goes back to the peek; a session with GOAWAY is closed.

def h2.idle.sent source · line 933 · raw

@client:0xbfcf01f5908bfcd8a7e6b4ce550a378b/http2.Client -> @sent:Result<&1, &1, 0xc850b7230535f08df98532e8cb531076/pure.Err, Socket> -> Took

def h2.idle.reply source · line 940 · raw

@s:Socket -> @reply:0xbfcf01f5908bfcd8a7e6b4ce550a378b/http2.Reply -> IO(Took)

def h2.idle.read source · line 949 · raw

@client:0xbfcf01f5908bfcd8a7e6b4ce550a378b/http2.Client -> @got:Pair(Socket, Result<&1, &1, Pair(U32, String), Pair(U32, Array<U32>)>) -> IO(Took)

def h2.idle.peek source · line 960 · raw

@client:0xbfcf01f5908bfcd8a7e6b4ce550a378b/http2.Client -> @r:Pair(Socket, Bool) -> IO(Took)

Waiting bytes may be PING, SETTINGS, or GOAWAY frames, so the client reads them; EOF fails the read.

def conn.idle source · line 971 · raw

@c:Conn -> IO(Took)

def pool.take.go source · line 983 · raw

@n:Nat -> @+key:String -> @pt:Pair(Pool, Took) -> IO(Pair(Pool, Maybe<&1, Conn>))

Each idle socket takes two steps: the peek, then the close and the next take. Each read of HTTP/2 frames takes one more.

def pool.take.live source · line 1007 · raw

@p:Pool -> @+key:String -> IO(Pair(Pool, Maybe<&1, Conn>))

pool.take, but an idle connection that the peer closed, or an HTTP/1.1 socket with bytes waiting, is closed, and the next one is tried.

def pool.h2.keep source · line 1011 · raw

@p:Pool -> @+key:String -> @res:0xc850b7230535f08df98532e8cb531076/pure.Res -> @state:Pair(Bool, Conn) -> IO(Pair(Pool, Result<&1, &1, 0xc850b7230535f08df98532e8cb531076/pure.Err, 0xc850b7230535f08df98532e8cb531076/pure.Res>))

def pool.h2.result source · line 1024 · raw

@p:Pool -> @+key:String -> @r:Result<&1, &1, 0xc850b7230535f08df98532e8cb531076/pure.Err, Pair(Conn, 0xc850b7230535f08df98532e8cb531076/pure.Res)> -> IO(Pair(Pool, Result<&1, &1, 0xc850b7230535f08df98532e8cb531076/pure.Err, 0xc850b7230535f08df98532e8cb531076/pure.Res>))

def pool.h2.ex source · line 1032 · raw

@p:Pool -> @+key:String -> @+ms:U32 -> @request:0xc850b7230535f08df98532e8cb531076/pure.Send -> @s:Socket -> @client:0xbfcf01f5908bfcd8a7e6b4ce550a378b/http2.Client -> IO(Pair(Pool, Result<&1, &1, 0xc850b7230535f08df98532e8cb531076/pure.Err, 0xc850b7230535f08df98532e8cb531076/pure.Res>))

def pool.fresh.conn source · line 1038 · raw

@p:Pool -> @+key:String -> @+ms:U32 -> @request:0xc850b7230535f08df98532e8cb531076/pure.Send -> @r:Result<&1, &1, 0xc850b7230535f08df98532e8cb531076/pure.Err, Conn> -> IO(Pair(Pool, Result<&1, &1, 0xc850b7230535f08df98532e8cb531076/pure.Err, 0xc850b7230535f08df98532e8cb531076/pure.Res>))

def pool.fresh source · line 1052 · raw

@p:Pool -> @+key:String -> @+ms:U32 -> @request:0xc850b7230535f08df98532e8cb531076/pure.Send -> @route:0xc850b7230535f08df98532e8cb531076/pure.Route -> IO(Pair(Pool, Result<&1, &1, 0xc850b7230535f08df98532e8cb531076/pure.Err, 0xc850b7230535f08df98532e8cb531076/pure.Res>))

def pool.stale source · line 1059 · raw

@p:Pool -> @+key:String -> @+ms:U32 -> @request:0xc850b7230535f08df98532e8cb531076/pure.Send -> @e:0xc850b7230535f08df98532e8cb531076/pure.Err -> @again:Bool -> @route:0xc850b7230535f08df98532e8cb531076/pure.Route -> IO(Pair(Pool, Result<&1, &1, 0xc850b7230535f08df98532e8cb531076/pure.Err, 0xc850b7230535f08df98532e8cb531076/pure.Res>))

A reused socket the server already closed fails before any response byte.

def pool.reused source · line 1068 · raw

@p:Pool -> @+key:String -> @+tls:Bool -> @+ms:U32 -> @+idem:Bool -> @spare:0xc850b7230535f08df98532e8cb531076/pure.Send -> @o:0xc850b7230535f08df98532e8cb531076/pure.Out -> @route:0xc850b7230535f08df98532e8cb531076/pure.Route -> IO(Pair(Pool, Result<&1, &1, 0xc850b7230535f08df98532e8cb531076/pure.Err, 0xc850b7230535f08df98532e8cb531076/pure.Res>))

def pool.idle.h1.bodies source · line 1078 · raw

@p:Pool -> @+key:String -> @+tls:Bool -> @+ms:U32 -> @+idem:Bool -> @s:Socket -> @+method:String -> @+target:String -> @+authority:String -> @+headers:Map<&2, List<&2, String>> -> @r:Pair(0xec25e4adfb02e59e4b817801115988ee/bytes.Bytes, 0xec25e4adfb02e59e4b817801115988ee/bytes.Bytes) -> @route:0xc850b7230535f08df98532e8cb531076/pure.Route -> IO(Pair(Pool, Result<&1, &1, 0xc850b7230535f08df98532e8cb531076/pure.Err, 0xc850b7230535f08df98532e8cb531076/pure.Res>))

Copy only the reused HTTP/1.1 request body, for a stale-socket retry.

def pool.idle.h1 source · line 1088 · raw

@p:Pool -> @+key:String -> @+tls:Bool -> @+ms:U32 -> @+idem:Bool -> @s:Socket -> @request:0xc850b7230535f08df98532e8cb531076/pure.Send -> @route:0xc850b7230535f08df98532e8cb531076/pure.Route -> IO(Pair(Pool, Result<&1, &1, 0xc850b7230535f08df98532e8cb531076/pure.Err, 0xc850b7230535f08df98532e8cb531076/pure.Res>))

def pool.idle.reuse source · line 1095 · raw

@p:Pool -> @+key:String -> @+ms:U32 -> @+idem:Bool -> @c:Conn -> @request:0xc850b7230535f08df98532e8cb531076/pure.Send -> @route:0xc850b7230535f08df98532e8cb531076/pure.Route -> IO(Pair(Pool, Result<&1, &1, 0xc850b7230535f08df98532e8cb531076/pure.Err, 0xc850b7230535f08df98532e8cb531076/pure.Res>))

def pool.idle source · line 1104 · raw

@taken:Pair(Pool, Maybe<&1, Conn>) -> @+key:String -> @+ms:U32 -> @+idem:Bool -> @request:0xc850b7230535f08df98532e8cb531076/pure.Send -> @route:0xc850b7230535f08df98532e8cb531076/pure.Route -> IO(Pair(Pool, Result<&1, &1, 0xc850b7230535f08df98532e8cb531076/pure.Err, 0xc850b7230535f08df98532e8cb531076/pure.Res>))

def pool.origin.route source · line 1114 · raw

@p:Pool -> @+method:String -> @+ms:U32 -> @r:Pair(String, Pair(0xc850b7230535f08df98532e8cb531076/pure.Send, 0xc850b7230535f08df98532e8cb531076/pure.Route)) -> IO(Pair(Pool, Result<&1, &1, 0xc850b7230535f08df98532e8cb531076/pure.Err, 0xc850b7230535f08df98532e8cb531076/pure.Res>))

def pool.origin.choice source · line 1121 · raw

@p:Pool -> @+method:String -> @ms:U32 -> @headers:Map<&2, List<&2, String>> -> @body:0xec25e4adfb02e59e4b817801115988ee/bytes.Bytes -> @hf:String -> @scheme:String -> @host:String -> @port:U32 -> @target:String -> @cert:Maybe<&2, 0xc850b7230535f08df98532e8cb531076/pure.Cert> -> @+ca:String -> @choice:Maybe<&2, 0xc850b7230535f08df98532e8cb531076/pure.Proxy> -> IO(Pair(Pool, Result<&1, &1, 0xc850b7230535f08df98532e8cb531076/pure.Err, 0xc850b7230535f08df98532e8cb531076/pure.Res>))

def pool.origin source · line 1133 · raw

@p:Pool -> @method:String -> @ms:U32 -> @headers:Map<&2, List<&2, String>> -> @body:0xec25e4adfb02e59e4b817801115988ee/bytes.Bytes -> @hf:String -> @a:0x1f2d80f53f971b16c6de6a65cb1918ae/url.Abs -> @known:Bool -> @cert:Maybe<&2, 0xc850b7230535f08df98532e8cb531076/pure.Cert> -> @+ca:String -> @choice:Maybe<&2, 0xc850b7230535f08df98532e8cb531076/pure.Proxy> -> IO(Pair(Pool, Result<&1, &1, 0xc850b7230535f08df98532e8cb531076/pure.Err, 0xc850b7230535f08df98532e8cb531076/pure.Res>))

def pool.one.back source · line 1146 · raw

@h:0xc850b7230535f08df98532e8cb531076/pure.Hop -> @pr:Pair(Pool, Result<&1, &1, 0xc850b7230535f08df98532e8cb531076/pure.Err, 0xc850b7230535f08df98532e8cb531076/pure.Res>) -> Pair(Pool, Pair(Result<&1, &1, 0xc850b7230535f08df98532e8cb531076/pure.Err, 0xc850b7230535f08df98532e8cb531076/pure.Res>, 0xc850b7230535f08df98532e8cb531076/pure.Hop))

def pool.one.of source · line 1151 · raw

@p:Pool -> @+method:String -> @+url:0x1f2d80f53f971b16c6de6a65cb1918ae/url.Abs -> @headers:Map<&2, List<&2, String>> -> @sent:Map<&2, List<&2, String>> -> @+ms:U32 -> @r:Pair(0xec25e4adfb02e59e4b817801115988ee/bytes.Bytes, 0xec25e4adfb02e59e4b817801115988ee/bytes.Bytes) -> @cert:Maybe<&2, 0xc850b7230535f08df98532e8cb531076/pure.Cert> -> @+ca:String -> IO(Pair(Pool, Pair(Result<&1, &1, 0xc850b7230535f08df98532e8cb531076/pure.Err, 0xc850b7230535f08df98532e8cb531076/pure.Res>, 0xc850b7230535f08df98532e8cb531076/pure.Hop)))

sent is headers plus any jar cookies; the hop keeps headers, so cookies never pile up across hops.

def pool.one source · line 1165 · raw

@p:Pool -> @h:0xc850b7230535f08df98532e8cb531076/pure.Hop -> @+ms:U32 -> @cert:Maybe<&2, 0xc850b7230535f08df98532e8cb531076/pure.Cert> -> @+ca:String -> @jar:Maybe<&2, 0xc850b7230535f08df98532e8cb531076/pure.Jar> -> IO(Pair(Pool, Pair(Result<&1, &1, 0xc850b7230535f08df98532e8cb531076/pure.Err, 0xc850b7230535f08df98532e8cb531076/pure.Res>, 0xc850b7230535f08df98532e8cb531076/pure.Hop)))

One request, on an idle socket to its origin when the pool has one. The hop comes back for the redirect.

def pool.next.move source · line 1172 · raw

@p:Pool -> @jar:Maybe<&2, 0xc850b7230535f08df98532e8cb531076/pure.Jar> -> @nt:Pair(0xc850b7230535f08df98532e8cb531076/pure.Next, Pair(Maybe<&2, 0xc850b7230535f08df98532e8cb531076/pure.Cert>, String)) -> Hops

def pool.next.of source · line 1176 · raw

@+mode:0xc850b7230535f08df98532e8cb531076/pure.Mode -> @left:Nat -> @cert:Maybe<&2, 0xc850b7230535f08df98532e8cb531076/pure.Cert> -> @+ca:String -> @p:Pool -> @+url:0x1f2d80f53f971b16c6de6a65cb1918ae/url.Abs -> @h:0xc850b7230535f08df98532e8cb531076/pure.Hop -> @r:Pair(Maybe<&2, 0xc850b7230535f08df98532e8cb531076/pure.Jar>, Result<&1, &1, 0xc850b7230535f08df98532e8cb531076/pure.Err, 0xc850b7230535f08df98532e8cb531076/pure.Res>) -> Hops

def pool.next source · line 1181 · raw

@+mode:0xc850b7230535f08df98532e8cb531076/pure.Mode -> @left:Nat -> @cert:Maybe<&2, 0xc850b7230535f08df98532e8cb531076/pure.Cert> -> @+ca:String -> @jar:Maybe<&2, 0xc850b7230535f08df98532e8cb531076/pure.Jar> -> @x:Pair(Pool, Pair(Result<&1, &1, 0xc850b7230535f08df98532e8cb531076/pure.Err, 0xc850b7230535f08df98532e8cb531076/pure.Res>, 0xc850b7230535f08df98532e8cb531076/pure.Hop)) -> Hops

The jar takes the response's Set-Cookie fields first, redirect or not.

def pool.hops.one source · line 1186 · raw

@+mode:0xc850b7230535f08df98532e8cb531076/pure.Mode -> @+ms:U32 -> @+cert:Maybe<&2, 0xc850b7230535f08df98532e8cb531076/pure.Cert> -> @+ca:String -> @+jar:Maybe<&2, 0xc850b7230535f08df98532e8cb531076/pure.Jar> -> @p:Pool -> @h:0xc850b7230535f08df98532e8cb531076/pure.Hop -> @left:Nat -> IO(Hops)

def ce.io.deflate source · line 1212 · raw

@on:Bool -> @b:0xec25e4adfb02e59e4b817801115988ee/bytes.Bytes -> IO(Maybe<&1, 0xec25e4adfb02e59e4b817801115988ee/bytes.Bytes>)

def ce.io.zstd source · line 1219 · raw

@on:Bool -> @+c:String -> @b:0xec25e4adfb02e59e4b817801115988ee/bytes.Bytes -> IO(Maybe<&1, 0xec25e4adfb02e59e4b817801115988ee/bytes.Bytes>)

def ce.io.br source · line 1226 · raw

@on:Bool -> @+c:String -> @b:0xec25e4adfb02e59e4b817801115988ee/bytes.Bytes -> IO(Maybe<&1, 0xec25e4adfb02e59e4b817801115988ee/bytes.Bytes>)

def ce.io.gz source · line 1234 · raw

@on:Bool -> @+c:String -> @b:0xec25e4adfb02e59e4b817801115988ee/bytes.Bytes -> IO(Maybe<&1, 0xec25e4adfb02e59e4b817801115988ee/bytes.Bytes>)

One known coding undone: gzip, x-gzip, br, zstd, deflate, or identity.

def ce.io.go source · line 1241 · raw

@cs:List<&2, String> -> @m:Maybe<&1, 0xec25e4adfb02e59e4b817801115988ee/bytes.Bytes> -> IO(Maybe<&1, 0xec25e4adfb02e59e4b817801115988ee/bytes.Bytes>)

def decoded.io.run source · line 1258 · raw

@known:Bool -> @+status:U32 -> @+headers:Map<&2, List<&2, String>> -> @body:0xec25e4adfb02e59e4b817801115988ee/bytes.Bytes -> @cs:List<&2, String> -> IO(Result<&1, &1, 0xc850b7230535f08df98532e8cb531076/pure.Err, 0xc850b7230535f08df98532e8cb531076/pure.Res>)

def decoded.io.go source · line 1267 · raw

@empty:Bool -> @+enc:String -> @+status:U32 -> @+headers:Map<&2, List<&2, String>> -> @body:0xec25e4adfb02e59e4b817801115988ee/bytes.Bytes -> IO(Result<&1, &1, 0xc850b7230535f08df98532e8cb531076/pure.Err, 0xc850b7230535f08df98532e8cb531076/pure.Res>)

def decoded.io source · line 1276 · raw

@+enc:String -> @res:0xc850b7230535f08df98532e8cb531076/pure.Res -> IO(Result<&1, &1, 0xc850b7230535f08df98532e8cb531076/pure.Err, 0xc850b7230535f08df98532e8cb531076/pure.Res>)

decoded through the C libraries, for the codings in enc. A body with any other coding stays as sent.

def codings source · line 1287 · raw

IO(String)

def fetch.final source · line 1294 · raw

@+enc:String -> @r:Result<&1, &1, 0xc850b7230535f08df98532e8cb531076/pure.Err, 0xc850b7230535f08df98532e8cb531076/pure.Res> -> IO(Result<&1, &1, 0xc850b7230535f08df98532e8cb531076/pure.Err, 0xc850b7230535f08df98532e8cb531076/pure.Res>)

The final response of a fetch, after redirects.

def pool.final source · line 1301 · raw

@+enc:String -> @pr:Pair(Pool, Pair(Result<&1, &1, 0xc850b7230535f08df98532e8cb531076/pure.Err, 0xc850b7230535f08df98532e8cb531076/pure.Res>, Maybe<&2, 0xc850b7230535f08df98532e8cb531076/pure.Jar>)) -> IO(Pair(Pool, Result<&1, &1, 0xc850b7230535f08df98532e8cb531076/pure.Err, 0xc850b7230535f08df98532e8cb531076/pure.Res>))

def pool.how.enc source · line 1307 · raw

@+enc:String -> @p:Pool -> @method:String -> @url:String -> @headers:Map<&2, List<&2, String>> -> @body:0xec25e4adfb02e59e4b817801115988ee/bytes.Bytes -> @ms:U32 -> @mode:0xc850b7230535f08df98532e8cb531076/pure.Mode -> @cert:Maybe<&2, 0xc850b7230535f08df98532e8cb531076/pure.Cert> -> @+ca:String -> IO(Pair(Pool, Result<&1, &1, 0xc850b7230535f08df98532e8cb531076/pure.Err, 0xc850b7230535f08df98532e8cb531076/pure.Res>))

def pool.how.cert source · line 1312 · raw

@p:Pool -> @method:String -> @url:String -> @headers:Map<&2, List<&2, String>> -> @body:0xec25e4adfb02e59e4b817801115988ee/bytes.Bytes -> @ms:U32 -> @mode:0xc850b7230535f08df98532e8cb531076/pure.Mode -> @cert:Maybe<&2, 0xc850b7230535f08df98532e8cb531076/pure.Cert> -> IO(Pair(Pool, Result<&1, &1, 0xc850b7230535f08df98532e8cb531076/pure.Err, 0xc850b7230535f08df98532e8cb531076/pure.Res>))

def pool.how source · line 1320 · raw

@p:Pool -> @method:String -> @url:String -> @headers:Map<&2, List<&2, String>> -> @body:0xec25e4adfb02e59e4b817801115988ee/bytes.Bytes -> @ms:U32 -> @mode:0xc850b7230535f08df98532e8cb531076/pure.Mode -> IO(Pair(Pool, Result<&1, &1, 0xc850b7230535f08df98532e8cb531076/pure.Err, 0xc850b7230535f08df98532e8cb531076/pure.Res>))

pool.how(p, "GET", "https://example.com/x?y=1", headers, body, ms, mode) follows redirects on p's idle sockets. Fail is a bad URL, a failed lookup, connect, handshake, send, read, a malformed response, more than 20 redirects, or a step past ms. Bodies are bytes.

def pool.fetch.with source · line 1323 · raw

@p:Pool -> @method:String -> @url:String -> @headers:Map<&2, List<&2, String>> -> @body:0xec25e4adfb02e59e4b817801115988ee/bytes.Bytes -> @ms:U32 -> IO(Pair(Pool, Result<&1, &1, 0xc850b7230535f08df98532e8cb531076/pure.Err, 0xc850b7230535f08df98532e8cb531076/pure.Res>))

def pool.fetch source · line 1326 · raw

@p:Pool -> @method:String -> @url:String -> @headers:Map<&2, List<&2, String>> -> @body:0xec25e4adfb02e59e4b817801115988ee/bytes.Bytes -> IO(Pair(Pool, Result<&1, &1, 0xc850b7230535f08df98532e8cb531076/pure.Err, 0xc850b7230535f08df98532e8cb531076/pure.Res>))

def pool.fetch.cert.with source · line 1329 · raw

@p:Pool -> @method:String -> @url:String -> @headers:Map<&2, List<&2, String>> -> @body:0xec25e4adfb02e59e4b817801115988ee/bytes.Bytes -> @chain:String -> @key:String -> @ms:U32 -> IO(Pair(Pool, Result<&1, &1, 0xc850b7230535f08df98532e8cb531076/pure.Err, 0xc850b7230535f08df98532e8cb531076/pure.Res>))

def pool.fetch.cert source · line 1332 · raw

@p:Pool -> @method:String -> @url:String -> @headers:Map<&2, List<&2, String>> -> @body:0xec25e4adfb02e59e4b817801115988ee/bytes.Bytes -> @chain:String -> @key:String -> IO(Pair(Pool, Result<&1, &1, 0xc850b7230535f08df98532e8cb531076/pure.Err, 0xc850b7230535f08df98532e8cb531076/pure.Res>))

def pool.fetch.ca.with source · line 1335 · raw

@p:Pool -> @method:String -> @url:String -> @headers:Map<&2, List<&2, String>> -> @body:0xec25e4adfb02e59e4b817801115988ee/bytes.Bytes -> @ca:String -> @ms:U32 -> IO(Pair(Pool, Result<&1, &1, 0xc850b7230535f08df98532e8cb531076/pure.Err, 0xc850b7230535f08df98532e8cb531076/pure.Res>))

def pool.fetch.ca source · line 1340 · raw

@p:Pool -> @method:String -> @url:String -> @headers:Map<&2, List<&2, String>> -> @body:0xec25e4adfb02e59e4b817801115988ee/bytes.Bytes -> @ca:String -> IO(Pair(Pool, Result<&1, &1, 0xc850b7230535f08df98532e8cb531076/pure.Err, 0xc850b7230535f08df98532e8cb531076/pure.Res>))

def fetch.all.job source · line 1344 · raw

@p:Pool -> @f:0xc850b7230535f08df98532e8cb531076/pure.Fetch -> IO(Pair(Pool, Result<&1, &1, 0xc850b7230535f08df98532e8cb531076/pure.Err, 0xc850b7230535f08df98532e8cb531076/pure.Res>))

One request for fetch.all: the arguments of fetch, as a record.

def fetch.all.pools source · line 1348 · raw

@n:Nat -> List<&1, Pool>

def fetch.all.close source · line 1355 · raw

@ps:List<&1, Pool> -> IO(Unit)

def fetch.all.done source · line 1364 · raw

@r:Pair(List<&1, Pool>, List<&1, Result<&1, &1, 0xc850b7230535f08df98532e8cb531076/pure.Err, 0xc850b7230535f08df98532e8cb531076/pure.Res>>) -> IO(List<&1, Result<&1, &1, 0xc850b7230535f08df98532e8cb531076/pure.Err, 0xc850b7230535f08df98532e8cb531076/pure.Res>>)

def fetch.all.go source · line 1371 · raw

@xs:List<&1, 0xc850b7230535f08df98532e8cb531076/pure.Fetch> -> @+workers:Nat -> IO(List<&1, Result<&1, &1, 0xc850b7230535f08df98532e8cb531076/pure.Err, 0xc850b7230535f08df98532e8cb531076/pure.Res>>)

No requests start no workers, since Conc.pool needs at least one.

def fetch.all.of source · line 1381 · raw

@+n:U32 -> @nx:Pair(Nat, List<&1, 0xc850b7230535f08df98532e8cb531076/pure.Fetch>) -> IO(List<&1, Result<&1, &1, 0xc850b7230535f08df98532e8cb531076/pure.Err, 0xc850b7230535f08df98532e8cb531076/pure.Res>>)

def fetch.all source · line 1389 · raw

@reqs:List<&1, 0xc850b7230535f08df98532e8cb531076/pure.Fetch> -> @+n:U32 -> IO(List<&1, Result<&1, &1, 0xc850b7230535f08df98532e8cb531076/pure.Err, 0xc850b7230535f08df98532e8cb531076/pure.Res>>)

Each request as fetch would make it, on at most n workers (0 counts as 1, and never more workers than requests). Each worker owns its own Pool, so an idle socket is reused only by the worker that opened it; every pool is closed at the end. Results come back in the order of reqs.

def pool.jar.final source · line 1393 · raw

@+enc:String -> @j:0xc850b7230535f08df98532e8cb531076/pure.Jar -> @pr:Pair(Pool, Pair(Result<&1, &1, 0xc850b7230535f08df98532e8cb531076/pure.Err, 0xc850b7230535f08df98532e8cb531076/pure.Res>, Maybe<&2, 0xc850b7230535f08df98532e8cb531076/pure.Jar>)) -> IO(Pair(Pool, Pair(0xc850b7230535f08df98532e8cb531076/pure.Jar, Result<&1, &1, 0xc850b7230535f08df98532e8cb531076/pure.Err, 0xc850b7230535f08df98532e8cb531076/pure.Res>)))

The hops always hand the jar back; j is only the type's fallback.

def pool.jar.enc source · line 1399 · raw

@+enc:String -> @p:Pool -> @+j:0xc850b7230535f08df98532e8cb531076/pure.Jar -> @method:String -> @url:String -> @headers:Map<&2, List<&2, String>> -> @body:0xec25e4adfb02e59e4b817801115988ee/bytes.Bytes -> IO(Pair(Pool, Pair(0xc850b7230535f08df98532e8cb531076/pure.Jar, Result<&1, &1, 0xc850b7230535f08df98532e8cb531076/pure.Err, 0xc850b7230535f08df98532e8cb531076/pure.Res>)))

def pool.fetch.jar source · line 1407 · raw

@p:Pool -> @j:0xc850b7230535f08df98532e8cb531076/pure.Jar -> @method:String -> @url:String -> @headers:Map<&2, List<&2, String>> -> @body:0xec25e4adfb02e59e4b817801115988ee/bytes.Bytes -> IO(Pair(Pool, Pair(0xc850b7230535f08df98532e8cb531076/pure.Jar, Result<&1, &1, 0xc850b7230535f08df98532e8cb531076/pure.Err, 0xc850b7230535f08df98532e8cb531076/pure.Res>)))

pool.fetch with a cookie jar (RFC 6265bis). Before every hop, redirects included, the jar's cookies for that URL join the request's cookie field; after every response, redirects included, its Set-Cookie fields go into the jar. The jar's clock is the caller's: advance it with jar.at.

def fetch.end source · line 1411 · raw

@pr:Pair(Pool, Result<&1, &1, 0xc850b7230535f08df98532e8cb531076/pure.Err, 0xc850b7230535f08df98532e8cb531076/pure.Res>) -> IO(Result<&1, &1, 0xc850b7230535f08df98532e8cb531076/pure.Err, 0xc850b7230535f08df98532e8cb531076/pure.Res>)

def fetch.how source · line 1418 · raw

@method:String -> @url:String -> @headers:Map<&2, List<&2, String>> -> @body:0xec25e4adfb02e59e4b817801115988ee/bytes.Bytes -> @ms:U32 -> @mode:0xc850b7230535f08df98532e8cb531076/pure.Mode -> IO(Result<&1, &1, 0xc850b7230535f08df98532e8cb531076/pure.Err, 0xc850b7230535f08df98532e8cb531076/pure.Res>)

fetch is pool.how on a fresh pool that closes afterwards.

def fetch.with source · line 1423 · raw

@method:String -> @url:String -> @headers:Map<&2, List<&2, String>> -> @body:0xec25e4adfb02e59e4b817801115988ee/bytes.Bytes -> @ms:U32 -> IO(Result<&1, &1, 0xc850b7230535f08df98532e8cb531076/pure.Err, 0xc850b7230535f08df98532e8cb531076/pure.Res>)

def fetch.cert.with source · line 1426 · raw

@method:String -> @url:String -> @headers:Map<&2, List<&2, String>> -> @body:0xec25e4adfb02e59e4b817801115988ee/bytes.Bytes -> @chain:String -> @key:String -> @ms:U32 -> IO(Result<&1, &1, 0xc850b7230535f08df98532e8cb531076/pure.Err, 0xc850b7230535f08df98532e8cb531076/pure.Res>)

def fetch.cert source · line 1431 · raw

@method:String -> @url:String -> @headers:Map<&2, List<&2, String>> -> @body:0xec25e4adfb02e59e4b817801115988ee/bytes.Bytes -> @chain:String -> @key:String -> IO(Result<&1, &1, 0xc850b7230535f08df98532e8cb531076/pure.Err, 0xc850b7230535f08df98532e8cb531076/pure.Res>)

def fetch.ca.with source · line 1434 · raw

@method:String -> @url:String -> @headers:Map<&2, List<&2, String>> -> @body:0xec25e4adfb02e59e4b817801115988ee/bytes.Bytes -> @ca:String -> @ms:U32 -> IO(Result<&1, &1, 0xc850b7230535f08df98532e8cb531076/pure.Err, 0xc850b7230535f08df98532e8cb531076/pure.Res>)

def fetch.ca source · line 1439 · raw

@method:String -> @url:String -> @headers:Map<&2, List<&2, String>> -> @body:0xec25e4adfb02e59e4b817801115988ee/bytes.Bytes -> @ca:String -> IO(Result<&1, &1, 0xc850b7230535f08df98532e8cb531076/pure.Err, 0xc850b7230535f08df98532e8cb531076/pure.Res>)

def fetch source · line 1443 · raw

@method:String -> @url:String -> @headers:Map<&2, List<&2, String>> -> @body:0xec25e4adfb02e59e4b817801115988ee/bytes.Bytes -> IO(Result<&1, &1, 0xc850b7230535f08df98532e8cb531076/pure.Err, 0xc850b7230535f08df98532e8cb531076/pure.Res>)

fetch.with and a 30 s step timeout.

def get source · line 1446 · raw

@url:String -> IO(Result<&1, &1, 0xc850b7230535f08df98532e8cb531076/pure.Err, 0xc850b7230535f08df98532e8cb531076/pure.Res>)

def post.json source · line 1450 · raw

@url:String -> @v:0x419ec39802735c4664960ab4b9d962e5/json.Val -> IO(Result<&1, &1, 0xc850b7230535f08df98532e8cb531076/pure.Err, 0xc850b7230535f08df98532e8cb531076/pure.Res>)

POST v as compact JSON, with content-type: application/json.

def retry.sleep source · line 1455 · raw

@+v:String -> @n:Nat -> IO(Unit)

Base URLs: resolve(base, ref) is ref against the absolute http(s) URL base (RFC 3986 §5.2), written back as a URL for fetch. None when base is not absolute or ref has another scheme.

def retry.one source · line 1461 · raw

@+idem:Bool -> @+method:String -> @+url:String -> @+headers:Map<&2, List<&2, String>> -> @r:Pair(0xec25e4adfb02e59e4b817801115988ee/bytes.Bytes, 0xec25e4adfb02e59e4b817801115988ee/bytes.Bytes) -> IO(Pair(0xec25e4adfb02e59e4b817801115988ee/bytes.Bytes, Pair(Result<&1, &1, 0xc850b7230535f08df98532e8cb531076/pure.Err, 0xc850b7230535f08df98532e8cb531076/pure.Res>, Maybe<&2, String>)))

def retry.go source · line 1469 · raw

@left:Nat -> @+n:Nat -> @+idem:Bool -> @+method:String -> @+url:String -> @+headers:Map<&2, List<&2, String>> -> @t:Pair(0xec25e4adfb02e59e4b817801115988ee/bytes.Bytes, Pair(Result<&1, &1, 0xc850b7230535f08df98532e8cb531076/pure.Err, 0xc850b7230535f08df98532e8cb531076/pure.Res>, Maybe<&2, String>)) -> IO(Result<&1, &1, 0xc850b7230535f08df98532e8cb531076/pure.Err, 0xc850b7230535f08df98532e8cb531076/pure.Res>)

left: retries still allowed. n: the retry to wait for next, 0 first.

def retry.start source · line 1493 · raw

@enabled:Bool -> @n:U32 -> @+method:String -> @+url:String -> @+headers:Map<&2, List<&2, String>> -> @body:0xec25e4adfb02e59e4b817801115988ee/bytes.Bytes -> IO(Result<&1, &1, 0xc850b7230535f08df98532e8cb531076/pure.Err, 0xc850b7230535f08df98532e8cb531076/pure.Res>)

fetch.retry(n, method, url, headers, body) is fetch, tried again up to n times while an idempotent method (GET, HEAD, OPTIONS, TRACE, PUT, DELETE) gets a connect error, a timeout, or 408, 429, 500, 502, 503, or 504. POST, PATCH and other methods get one try. It waits Retry-After (seconds or HTTP-date, at most 30 s) when given, else the backoff. When retries run out, the last response or error comes back as it was.

def fetch.retry source · line 1505 · raw

@+n:U32 -> @+method:String -> @+url:String -> @+headers:Map<&2, List<&2, String>> -> @body:0xec25e4adfb02e59e4b817801115988ee/bytes.Bytes -> IO(Result<&1, &1, 0xc850b7230535f08df98532e8cb531076/pure.Err, 0xc850b7230535f08df98532e8cb531076/pure.Res>)

def stream.mk source · line 1522 · raw

@+tls:Bool -> @s:StreamWire -> @+ms:U32 -> @res:0xc850b7230535f08df98532e8cb531076/pure.Res -> @decs:List<&1, 0xfd122c6a1b806ddf6ed65c24d5ff4e42/native.Decoder> -> @back:Maybe<&2, String> -> @x:Pair(0xc850b7230535f08df98532e8cb531076/pure.Pc, Bool) -> Stream

def stream.got.piece source · line 1527 · raw

@+tls:Bool -> @s:StreamWire -> @+ms:U32 -> @res:0xc850b7230535f08df98532e8cb531076/pure.Res -> @decs:List<&1, 0xfd122c6a1b806ddf6ed65c24d5ff4e42/native.Decoder> -> @back:Maybe<&2, String> -> @+rb:0xc850b7230535f08df98532e8cb531076/pure.Rb -> @p:Pair(U32, Array<U32>) -> Stream

def stream.got source · line 1531 · raw

@+tls:Bool -> @+ms:U32 -> @res:0xc850b7230535f08df98532e8cb531076/pure.Res -> @decs:List<&1, 0xfd122c6a1b806ddf6ed65c24d5ff4e42/native.Decoder> -> @back:Maybe<&2, String> -> @+rb:0xc850b7230535f08df98532e8cb531076/pure.Rb -> @m:Pair(Socket, Result<&1, &1, Pair(U32, String), Pair(U32, Array<U32>)>) -> Stream

def stream.feed.received source · line 1542 · raw

@done:List<&1, 0xfd122c6a1b806ddf6ed65c24d5ff4e42/native.Decoder> -> @m:Pair(0xfd122c6a1b806ddf6ed65c24d5ff4e42/native.Decoder, Result<&1, &1, Pair(U32, String), 0xec25e4adfb02e59e4b817801115988ee/bytes.Bytes>) -> Fed

def stream.feed.step source · line 1550 · raw

@st:Fed -> @d:0xfd122c6a1b806ddf6ed65c24d5ff4e42/native.Decoder -> IO(Fed)

def stream.feed.one source · line 1560 · raw

@prev:IO(Fed) -> @d:0xfd122c6a1b806ddf6ed65c24d5ff4e42/native.Decoder -> IO(Fed)

def stream.feed.reverse source · line 1565 · raw

@st:Fed -> Fed

def stream.feed.all source · line 1569 · raw

@decs:List<&1, 0xfd122c6a1b806ddf6ed65c24d5ff4e42/native.Decoder> -> @b:0xec25e4adfb02e59e4b817801115988ee/bytes.Bytes -> IO(Fed)

def stream.feed.got source · line 1575 · raw

@+tls:Bool -> @s:StreamWire -> @+ms:U32 -> @res:0xc850b7230535f08df98532e8cb531076/pure.Res -> @+rb:0xc850b7230535f08df98532e8cb531076/pure.Rb -> @back:Maybe<&2, String> -> @st:Fed -> Stream

def stream.feed.st source · line 1584 · raw

@st:Stream -> @b:0xec25e4adfb02e59e4b817801115988ee/bytes.Bytes -> IO(Stream)

def stream.finish source · line 1594 · raw

@decs:List<&1, 0xfd122c6a1b806ddf6ed65c24d5ff4e42/native.Decoder> -> IO(Bool)

def stream.h2.event source · line 1604 · raw

@+ms:U32 -> @res:0xc850b7230535f08df98532e8cb531076/pure.Res -> @decs:List<&1, 0xfd122c6a1b806ddf6ed65c24d5ff4e42/native.Decoder> -> @back:Maybe<&2, String> -> @got:Result<&1, &1, 0xc850b7230535f08df98532e8cb531076/pure.Err, Pair(H2Reader, 0xbfcf01f5908bfcd8a7e6b4ce550a378b/http2.ClientEvent)> -> Stream

def stream.recv source · line 1623 · raw

@+tls:Bool -> @wire:StreamWire -> @+ms:U32 -> @res:0xc850b7230535f08df98532e8cb531076/pure.Res -> @+rb:0xc850b7230535f08df98532e8cb531076/pure.Rb -> @decs:List<&1, 0xfd122c6a1b806ddf6ed65c24d5ff4e42/native.Decoder> -> @back:Maybe<&2, String> -> IO(Stream)

def stream.wire.close source · line 1639 · raw

@+tls:Bool -> @wire:StreamWire -> IO(Unit)

def stream.h2.pool.keep source · line 1648 · raw

@state:Pair(Bool, Conn) -> @p:Pool -> @+key:String -> IO(Pool)

def stream.h2.give.result source · line 1658 · raw

@p:Pool -> @+key:String -> @r:Result<&1, &1, 0xc850b7230535f08df98532e8cb531076/pure.Err, H2Reader> -> IO(Pool)

def stream.h2.release source · line 1665 · raw

@active:Bool -> @p:Pool -> @+key:String -> @s:Socket -> @client:0xbfcf01f5908bfcd8a7e6b4ce550a378b/http2.Client -> @+id:U32 -> IO(Pool)

def stream.wire.give source · line 1675 · raw

@whole:Bool -> @p:Pool -> @+key:String -> @+tls:Bool -> @wire:StreamWire -> IO(Pool)

def stream.ended source · line 1691 · raw

@good:Bool -> @+tls:Bool -> @s:StreamWire -> @+ms:U32 -> @res:0xc850b7230535f08df98532e8cb531076/pure.Res -> @+rb:0xc850b7230535f08df98532e8cb531076/pure.Rb -> @back:Maybe<&2, String> -> Pair(Stream, Result<&1, &1, 0xc850b7230535f08df98532e8cb531076/pure.Err, Maybe<&1, 0xec25e4adfb02e59e4b817801115988ee/bytes.Bytes>>)

def stream.res source · line 1724 · raw

@st:Stream -> Pair(Stream, 0xc850b7230535f08df98532e8cb531076/pure.Res)

Status and headers. Its body is empty: read the body with stream.read.

def stream.close source · line 1729 · raw

@st:Stream -> IO(Unit)

def stream.give source · line 1735 · raw

@whole:Bool -> @back:Maybe<&2, String> -> @p:Pool -> @+tls:Bool -> @s:StreamWire -> IO(Pool)

def pool.stream.close source · line 1745 · raw

@p:Pool -> @st:Stream -> IO(Pool)

stream.close, but a body read to its end and decoded cleanly gives its connection to the pool.

def fetch.fail.of source · line 1753 · raw

@r:Result<&1, &1, 0xc850b7230535f08df98532e8cb531076/pure.Err, 0xc850b7230535f08df98532e8cb531076/pure.Res> -> Result<&1, &1, 0xc850b7230535f08df98532e8cb531076/pure.Err, Stream>

Head read state: still scanning, cut short or bad, or the head with the bytes after it. none: no response byte arrived, so a reused socket may be stale.

def stream.sent source · line 1778 · raw

@+tls:Bool -> @+ms:U32 -> @+head:Bool -> @back:Maybe<&2, String> -> @m:Pair(Socket, Result<&1, &1, Pair(U32, String), Unit>) -> IO(Pair(Bool, Result<&1, &1, 0xc850b7230535f08df98532e8cb531076/pure.Err, Stream>))

def stream.h2.head.done source · line 1788 · raw

@res:Maybe<&1, 0xc850b7230535f08df98532e8cb531076/pure.Res> -> @+ms:U32 -> @back:Maybe<&2, String> -> @reader:H2Reader -> IO(Pair(Bool, Result<&1, &1, 0xc850b7230535f08df98532e8cb531076/pure.Err, Stream>))

def stream.h2.head source · line 1800 · raw

@n:Nat -> @+ms:U32 -> @+back:Maybe<&2, String> -> @step:H2Step -> IO(Pair(Bool, Result<&1, &1, 0xc850b7230535f08df98532e8cb531076/pure.Err, Stream>))

def stream.h2.start source · line 1827 · raw

@+ms:U32 -> @back:Maybe<&2, String> -> @r:Result<&1, &1, 0xc850b7230535f08df98532e8cb531076/pure.Err, H2Reader> -> IO(Pair(Bool, Result<&1, &1, 0xc850b7230535f08df98532e8cb531076/pure.Err, Stream>))

def stream.conn source · line 1836 · raw

@r:Result<&1, &1, 0xc850b7230535f08df98532e8cb531076/pure.Err, Conn> -> @+ms:U32 -> @+head:Bool -> @back:Maybe<&2, String> -> @request:0xc850b7230535f08df98532e8cb531076/pure.Send -> IO(Pair(Bool, Result<&1, &1, 0xc850b7230535f08df98532e8cb531076/pure.Err, Stream>))

The bool is true when the open failed before any response byte.

def stream.opened source · line 1853 · raw

@x:Pair(Bool, Result<&1, &1, 0xc850b7230535f08df98532e8cb531076/pure.Err, Stream>) -> Result<&1, &1, 0xc850b7230535f08df98532e8cb531076/pure.Err, Stream>

def stream.fresh source · line 1858 · raw

@+ms:U32 -> @+head:Bool -> @back:Maybe<&2, String> -> @route:0xc850b7230535f08df98532e8cb531076/pure.Route -> @request:0xc850b7230535f08df98532e8cb531076/pure.Send -> IO(Result<&1, &1, 0xc850b7230535f08df98532e8cb531076/pure.Err, Stream>)

A fresh TLS stream offers HTTP/2, with HTTP/1.1 as the fallback.

def stream.stale source · line 1864 · raw

@again:Bool -> @p:Pool -> @+ms:U32 -> @+head:Bool -> @+key:String -> @route:0xc850b7230535f08df98532e8cb531076/pure.Route -> @spare:0xc850b7230535f08df98532e8cb531076/pure.Send -> @e:0xc850b7230535f08df98532e8cb531076/pure.Err -> IO(Pair(Pool, Result<&1, &1, 0xc850b7230535f08df98532e8cb531076/pure.Err, Stream>))

def stream.reused source · line 1874 · raw

@p:Pool -> @+ms:U32 -> @+head:Bool -> @+idem:Bool -> @+key:String -> @route:0xc850b7230535f08df98532e8cb531076/pure.Route -> @spare:0xc850b7230535f08df98532e8cb531076/pure.Send -> @x:Pair(Bool, Result<&1, &1, 0xc850b7230535f08df98532e8cb531076/pure.Err, Stream>) -> IO(Pair(Pool, Result<&1, &1, 0xc850b7230535f08df98532e8cb531076/pure.Err, Stream>))

def stream.idle.h1 source · line 1883 · raw

@p:Pool -> @+ms:U32 -> @+head:Bool -> @+idem:Bool -> @+key:String -> @route:0xc850b7230535f08df98532e8cb531076/pure.Route -> @+method:String -> @+target:String -> @+authority:String -> @+headers:Map<&2, List<&2, String>> -> @bodies:Pair(0xec25e4adfb02e59e4b817801115988ee/bytes.Bytes, 0xec25e4adfb02e59e4b817801115988ee/bytes.Bytes) -> @c:Conn -> IO(Pair(Pool, Result<&1, &1, 0xc850b7230535f08df98532e8cb531076/pure.Err, Stream>))

def stream.idle source · line 1892 · raw

@p:Pool -> @+ms:U32 -> @+head:Bool -> @+idem:Bool -> @+key:String -> @route:0xc850b7230535f08df98532e8cb531076/pure.Route -> @c:Conn -> @request:0xc850b7230535f08df98532e8cb531076/pure.Send -> IO(Pair(Pool, Result<&1, &1, 0xc850b7230535f08df98532e8cb531076/pure.Err, Stream>))

def stream.take source · line 1906 · raw

@taken:Pair(Pool, Maybe<&1, Conn>) -> @+ms:U32 -> @+head:Bool -> @+idem:Bool -> @+key:String -> @route:0xc850b7230535f08df98532e8cb531076/pure.Route -> @wire:0xc850b7230535f08df98532e8cb531076/pure.Send -> IO(Pair(Pool, Result<&1, &1, 0xc850b7230535f08df98532e8cb531076/pure.Err, Stream>))

Copy the request only for a reused socket, for a stale-socket retry.

def stream.route source · line 1918 · raw

@p:Pool -> @+ms:U32 -> @r:Pair(String, Pair(0xc850b7230535f08df98532e8cb531076/pure.Send, 0xc850b7230535f08df98532e8cb531076/pure.Route)) -> IO(Pair(Pool, Result<&1, &1, 0xc850b7230535f08df98532e8cb531076/pure.Err, Stream>))

An idle session from the pool, or a new connection with ALPN.

def stream.origin.choice source · line 1926 · raw

@p:Pool -> @+method:String -> @+ms:U32 -> @headers:Map<&2, List<&2, String>> -> @body:0xec25e4adfb02e59e4b817801115988ee/bytes.Bytes -> @hf:String -> @scheme:String -> @host:String -> @port:U32 -> @target:String -> @cert:Maybe<&2, 0xc850b7230535f08df98532e8cb531076/pure.Cert> -> @+ca:String -> @choice:Maybe<&2, 0xc850b7230535f08df98532e8cb531076/pure.Proxy> -> IO(Pair(Pool, Result<&1, &1, 0xc850b7230535f08df98532e8cb531076/pure.Err, Stream>))

def stream.origin source · line 1939 · raw

@p:Pool -> @+method:String -> @+ms:U32 -> @headers:Map<&2, List<&2, String>> -> @body:0xec25e4adfb02e59e4b817801115988ee/bytes.Bytes -> @hf:String -> @a:0x1f2d80f53f971b16c6de6a65cb1918ae/url.Abs -> @known:Bool -> @cert:Maybe<&2, 0xc850b7230535f08df98532e8cb531076/pure.Cert> -> @+ca:String -> @choice:Maybe<&2, 0xc850b7230535f08df98532e8cb531076/pure.Proxy> -> IO(Pair(Pool, Result<&1, &1, 0xc850b7230535f08df98532e8cb531076/pure.Err, Stream>))

cert and ca: the client identity and trusted CA file for this origin.

def stream.one.back source · line 1951 · raw

@h:0xc850b7230535f08df98532e8cb531076/pure.Hop -> @pr:Pair(Pool, Result<&1, &1, 0xc850b7230535f08df98532e8cb531076/pure.Err, Stream>) -> Pair(Pool, Pair(0xc850b7230535f08df98532e8cb531076/pure.Hop, Result<&1, &1, 0xc850b7230535f08df98532e8cb531076/pure.Err, Stream>))

def stream.one.of source · line 1956 · raw

@p:Pool -> @+method:String -> @+url:0x1f2d80f53f971b16c6de6a65cb1918ae/url.Abs -> @headers:Map<&2, List<&2, String>> -> @sent:Map<&2, List<&2, String>> -> @+ms:U32 -> @r:Pair(0xec25e4adfb02e59e4b817801115988ee/bytes.Bytes, 0xec25e4adfb02e59e4b817801115988ee/bytes.Bytes) -> @cert:Maybe<&2, 0xc850b7230535f08df98532e8cb531076/pure.Cert> -> @+ca:String -> IO(Pair(Pool, Pair(0xc850b7230535f08df98532e8cb531076/pure.Hop, Result<&1, &1, 0xc850b7230535f08df98532e8cb531076/pure.Err, Stream>)))

sent is headers plus any jar cookies; the hop keeps headers, so cookies never pile up across hops.

def stream.one source · line 1968 · raw

@p:Pool -> @h:0xc850b7230535f08df98532e8cb531076/pure.Hop -> @+ms:U32 -> @cert:Maybe<&2, 0xc850b7230535f08df98532e8cb531076/pure.Cert> -> @+ca:String -> @jar:Maybe<&2, 0xc850b7230535f08df98532e8cb531076/pure.Jar> -> IO(Pair(Pool, Pair(0xc850b7230535f08df98532e8cb531076/pure.Hop, Result<&1, &1, 0xc850b7230535f08df98532e8cb531076/pure.Err, Stream>)))

One request, on an idle socket to its origin when the pool has one. The hop comes back for the redirect.

def sn.of source · line 1978 · raw

@n:0xc850b7230535f08df98532e8cb531076/pure.Next -> Sn

def stream.decide.done source · line 1991 · raw

@st:Stream -> @m:Result<&1, &1, 0xc850b7230535f08df98532e8cb531076/pure.Err, 0xc850b7230535f08df98532e8cb531076/pure.Res> -> Sn

def stream.decide.n source · line 1998 · raw

@st:Stream -> @n:0xc850b7230535f08df98532e8cb531076/pure.Next -> Sn

def stream.decide.trust source · line 2011 · raw

@st:Stream -> @jar:Maybe<&2, 0xc850b7230535f08df98532e8cb531076/pure.Jar> -> @nt:Pair(0xc850b7230535f08df98532e8cb531076/pure.Next, Pair(Maybe<&2, 0xc850b7230535f08df98532e8cb531076/pure.Cert>, String)) -> StreamHops

def stream.decide.jar source · line 2015 · raw

@+mode:0xc850b7230535f08df98532e8cb531076/pure.Mode -> @left:Nat -> @cert:Maybe<&2, 0xc850b7230535f08df98532e8cb531076/pure.Cert> -> @+ca:String -> @st:Stream -> @+old:String -> @hop:0xc850b7230535f08df98532e8cb531076/pure.Hop -> @r:Pair(Maybe<&2, 0xc850b7230535f08df98532e8cb531076/pure.Jar>, Result<&1, &1, 0xc850b7230535f08df98532e8cb531076/pure.Err, 0xc850b7230535f08df98532e8cb531076/pure.Res>) -> StreamHops

def stream.decide.of source · line 2021 · raw

@+mode:0xc850b7230535f08df98532e8cb531076/pure.Mode -> @left:Nat -> @cert:Maybe<&2, 0xc850b7230535f08df98532e8cb531076/pure.Cert> -> @+ca:String -> @jar:Maybe<&2, 0xc850b7230535f08df98532e8cb531076/pure.Jar> -> @hop:0xc850b7230535f08df98532e8cb531076/pure.Hop -> @sr:Pair(Stream, 0xc850b7230535f08df98532e8cb531076/pure.Res) -> StreamHops

The jar takes the response's Set-Cookie fields first, redirect or not.

def stream.decide source · line 2026 · raw

@+mode:0xc850b7230535f08df98532e8cb531076/pure.Mode -> @left:Nat -> @cert:Maybe<&2, 0xc850b7230535f08df98532e8cb531076/pure.Cert> -> @+ca:String -> @jar:Maybe<&2, 0xc850b7230535f08df98532e8cb531076/pure.Jar> -> @x:Pair(0xc850b7230535f08df98532e8cb531076/pure.Hop, Result<&1, &1, 0xc850b7230535f08df98532e8cb531076/pure.Err, Stream>) -> StreamHops

def stream.step source · line 2034 · raw

@+mode:0xc850b7230535f08df98532e8cb531076/pure.Mode -> @left:Nat -> @cert:Maybe<&2, 0xc850b7230535f08df98532e8cb531076/pure.Cert> -> @+ca:String -> @jar:Maybe<&2, 0xc850b7230535f08df98532e8cb531076/pure.Jar> -> @x:Pair(Pool, Pair(0xc850b7230535f08df98532e8cb531076/pure.Hop, Result<&1, &1, 0xc850b7230535f08df98532e8cb531076/pure.Err, Stream>)) -> Pair(Pool, StreamHops)

def stream.open.got source · line 2060 · raw

@st:Opened -> @r:Result<&1, &1, Pair(U32, String), 0xfd122c6a1b806ddf6ed65c24d5ff4e42/native.Decoder> -> Opened

def stream.open.add source · line 2068 · raw

@st:Opened -> @m:IO(Result<&1, &1, Pair(U32, String), 0xfd122c6a1b806ddf6ed65c24d5ff4e42/native.Decoder>) -> IO(Opened)

def stream.open.zstd source · line 2073 · raw

@zstd:Bool -> @st:Opened -> IO(Opened)

def stream.open.br source · line 2080 · raw

@br:Bool -> @+c:String -> @st:Opened -> IO(Opened)

def stream.open.gz source · line 2087 · raw

@gz:Bool -> @+c:String -> @st:Opened -> IO(Opened)

def stream.open.step source · line 2094 · raw

@+c:String -> @st:Opened -> IO(Opened)

def stream.open.one source · line 2103 · raw

@prev:IO(Opened) -> @c:String -> IO(Opened)

def stream.open.all source · line 2108 · raw

@cs:List<&2, String> -> IO(Opened)

def stream.put.decs source · line 2111 · raw

@st:Stream -> @decs:List<&1, 0xfd122c6a1b806ddf6ed65c24d5ff4e42/native.Decoder> -> Stream

def stream.init.opened source · line 2115 · raw

@st:Stream -> @opened:Opened -> IO(Result<&1, &1, 0xc850b7230535f08df98532e8cb531076/pure.Err, Stream>)

def stream.init.known source · line 2125 · raw

@known:Bool -> @st:Stream -> @cs:List<&2, String> -> IO(Result<&1, &1, 0xc850b7230535f08df98532e8cb531076/pure.Err, Stream>)

def stream.init.st source · line 2134 · raw

@+enc:String -> @st:Stream -> IO(Result<&1, &1, 0xc850b7230535f08df98532e8cb531076/pure.Err, Stream>)

def stream.init source · line 2141 · raw

@+enc:String -> @r:Result<&1, &1, 0xc850b7230535f08df98532e8cb531076/pure.Err, Stream> -> IO(Result<&1, &1, 0xc850b7230535f08df98532e8cb531076/pure.Err, Stream>)

def stream.init.pool source · line 2148 · raw

@+enc:String -> @x:Pair(Pool, Pair(Maybe<&2, 0xc850b7230535f08df98532e8cb531076/pure.Jar>, Result<&1, &1, 0xc850b7230535f08df98532e8cb531076/pure.Err, Stream>)) -> IO(Pair(Pool, Pair(Maybe<&2, 0xc850b7230535f08df98532e8cb531076/pure.Jar>, Result<&1, &1, 0xc850b7230535f08df98532e8cb531076/pure.Err, Stream>)))

def stream.start source · line 2154 · raw

@method:String -> @headers:Map<&2, List<&2, String>> -> @body:0xec25e4adfb02e59e4b817801115988ee/bytes.Bytes -> @u:Maybe<&2, 0x1f2d80f53f971b16c6de6a65cb1918ae/url.Abs> -> Sn

def stream.only source · line 2161 · raw

@x:Pair(Maybe<&2, 0xc850b7230535f08df98532e8cb531076/pure.Jar>, Result<&1, &1, 0xc850b7230535f08df98532e8cb531076/pure.Err, Stream>) -> Result<&1, &1, 0xc850b7230535f08df98532e8cb531076/pure.Err, Stream>

def pool.stream.only source · line 2165 · raw

@x:Pair(Pool, Pair(Maybe<&2, 0xc850b7230535f08df98532e8cb531076/pure.Jar>, Result<&1, &1, 0xc850b7230535f08df98532e8cb531076/pure.Err, Stream>)) -> Pair(Pool, Result<&1, &1, 0xc850b7230535f08df98532e8cb531076/pure.Err, Stream>)

def stream.unpooled source · line 2170 · raw

@x:Pair(Pool, Pair(Maybe<&2, 0xc850b7230535f08df98532e8cb531076/pure.Jar>, Result<&1, &1, 0xc850b7230535f08df98532e8cb531076/pure.Err, Stream>)) -> IO(Pair(Maybe<&2, 0xc850b7230535f08df98532e8cb531076/pure.Jar>, Result<&1, &1, 0xc850b7230535f08df98532e8cb531076/pure.Err, Stream>))

A one-off pool ends with the open; it closes any idle socket a redirect gave back.

def pool.open.raw.how source · line 2177 · raw

@p:Pool -> @mode:0xc850b7230535f08df98532e8cb531076/pure.Mode -> @cert:Maybe<&2, 0xc850b7230535f08df98532e8cb531076/pure.Cert> -> @ca:String -> @jar:Maybe<&2, 0xc850b7230535f08df98532e8cb531076/pure.Jar> -> @method:String -> @url:String -> @headers:Map<&2, List<&2, String>> -> @body:0xec25e4adfb02e59e4b817801115988ee/bytes.Bytes -> @+ms:U32 -> IO(Pair(Pool, Pair(Maybe<&2, 0xc850b7230535f08df98532e8cb531076/pure.Jar>, Result<&1, &1, 0xc850b7230535f08df98532e8cb531076/pure.Err, Stream>)))

open.raw.how on a pool: each hop takes an idle socket to its origin when the pool has one.

def open.raw.how source · line 2184 · raw

@mode:0xc850b7230535f08df98532e8cb531076/pure.Mode -> @cert:Maybe<&2, 0xc850b7230535f08df98532e8cb531076/pure.Cert> -> @ca:String -> @jar:Maybe<&2, 0xc850b7230535f08df98532e8cb531076/pure.Jar> -> @method:String -> @url:String -> @headers:Map<&2, List<&2, String>> -> @body:0xec25e4adfb02e59e4b817801115988ee/bytes.Bytes -> @+ms:U32 -> IO(Pair(Maybe<&2, 0xc850b7230535f08df98532e8cb531076/pure.Jar>, Result<&1, &1, 0xc850b7230535f08df98532e8cb531076/pure.Err, Stream>))

A raw stream with every choice of fetch: mode for redirects, cert and ca for the first origin and each same-origin hop ("" trusts the default store), and a jar that gives cookies to every hop and takes them from every response. The jar comes back beside the stream. Body bytes and headers remain as sent.

def open.raw.with source · line 2191 · raw

@method:String -> @url:String -> @headers:Map<&2, List<&2, String>> -> @body:0xec25e4adfb02e59e4b817801115988ee/bytes.Bytes -> @+ms:U32 -> IO(Result<&1, &1, 0xc850b7230535f08df98532e8cb531076/pure.Err, Stream>)

Open a raw stream. It follows redirects, with no client certificate and no jar.

def open.raw source · line 2196 · raw

@method:String -> @url:String -> @headers:Map<&2, List<&2, String>> -> @body:0xec25e4adfb02e59e4b817801115988ee/bytes.Bytes -> IO(Result<&1, &1, 0xc850b7230535f08df98532e8cb531076/pure.Err, Stream>)

def pool.open.how.enc source · line 2199 · raw

@+enc:String -> @p:Pool -> @mode:0xc850b7230535f08df98532e8cb531076/pure.Mode -> @cert:Maybe<&2, 0xc850b7230535f08df98532e8cb531076/pure.Cert> -> @ca:String -> @jar:Maybe<&2, 0xc850b7230535f08df98532e8cb531076/pure.Jar> -> @method:String -> @url:String -> @headers:Map<&2, List<&2, String>> -> @body:0xec25e4adfb02e59e4b817801115988ee/bytes.Bytes -> @+ms:U32 -> IO(Pair(Pool, Pair(Maybe<&2, 0xc850b7230535f08df98532e8cb531076/pure.Jar>, Result<&1, &1, 0xc850b7230535f08df98532e8cb531076/pure.Err, Stream>)))

def pool.open.how source · line 2207 · raw

@p:Pool -> @mode:0xc850b7230535f08df98532e8cb531076/pure.Mode -> @cert:Maybe<&2, 0xc850b7230535f08df98532e8cb531076/pure.Cert> -> @ca:String -> @jar:Maybe<&2, 0xc850b7230535f08df98532e8cb531076/pure.Jar> -> @method:String -> @url:String -> @headers:Map<&2, List<&2, String>> -> @body:0xec25e4adfb02e59e4b817801115988ee/bytes.Bytes -> @+ms:U32 -> IO(Pair(Pool, Pair(Maybe<&2, 0xc850b7230535f08df98532e8cb531076/pure.Jar>, Result<&1, &1, 0xc850b7230535f08df98532e8cb531076/pure.Err, Stream>)))

open.how on a pool. Give a stream back with pool.stream.close.

def pool.open.with source · line 2213 · raw

@p:Pool -> @method:String -> @url:String -> @headers:Map<&2, List<&2, String>> -> @body:0xec25e4adfb02e59e4b817801115988ee/bytes.Bytes -> @+ms:U32 -> IO(Pair(Pool, Result<&1, &1, 0xc850b7230535f08df98532e8cb531076/pure.Err, Stream>))

def pool.open source · line 2219 · raw

@p:Pool -> @method:String -> @url:String -> @headers:Map<&2, List<&2, String>> -> @body:0xec25e4adfb02e59e4b817801115988ee/bytes.Bytes -> IO(Pair(Pool, Result<&1, &1, 0xc850b7230535f08df98532e8cb531076/pure.Err, Stream>))

open on a pool: an idle socket to the origin when the pool has one, else a new one.

def open.how.enc source · line 2222 · raw

@+enc:String -> @mode:0xc850b7230535f08df98532e8cb531076/pure.Mode -> @cert:Maybe<&2, 0xc850b7230535f08df98532e8cb531076/pure.Cert> -> @ca:String -> @jar:Maybe<&2, 0xc850b7230535f08df98532e8cb531076/pure.Jar> -> @method:String -> @url:String -> @headers:Map<&2, List<&2, String>> -> @body:0xec25e4adfb02e59e4b817801115988ee/bytes.Bytes -> @+ms:U32 -> IO(Pair(Maybe<&2, 0xc850b7230535f08df98532e8cb531076/pure.Jar>, Result<&1, &1, 0xc850b7230535f08df98532e8cb531076/pure.Err, Stream>))

def open.how source · line 2229 · raw

@mode:0xc850b7230535f08df98532e8cb531076/pure.Mode -> @cert:Maybe<&2, 0xc850b7230535f08df98532e8cb531076/pure.Cert> -> @ca:String -> @jar:Maybe<&2, 0xc850b7230535f08df98532e8cb531076/pure.Jar> -> @method:String -> @url:String -> @headers:Map<&2, List<&2, String>> -> @body:0xec25e4adfb02e59e4b817801115988ee/bytes.Bytes -> @+ms:U32 -> IO(Pair(Maybe<&2, 0xc850b7230535f08df98532e8cb531076/pure.Jar>, Result<&1, &1, 0xc850b7230535f08df98532e8cb531076/pure.Err, Stream>))

open.raw.how, then each body piece decoded by Content-Encoding (see codings). Unknown codings stay raw.

def open.with source · line 2236 · raw

@method:String -> @url:String -> @headers:Map<&2, List<&2, String>> -> @body:0xec25e4adfb02e59e4b817801115988ee/bytes.Bytes -> @+ms:U32 -> IO(Result<&1, &1, 0xc850b7230535f08df98532e8cb531076/pure.Err, Stream>)

Follow redirects, then decode each body piece by Content-Encoding. No client certificate and no jar.

def open source · line 2241 · raw

@method:String -> @url:String -> @headers:Map<&2, List<&2, String>> -> @body:0xec25e4adfb02e59e4b817801115988ee/bytes.Bytes -> IO(Result<&1, &1, 0xc850b7230535f08df98532e8cb531076/pure.Err, Stream>)

def up.conn source · line 2245 · raw

@r:Result<&1, &1, 0xc850b7230535f08df98532e8cb531076/pure.Err, Conn> -> @+ms:U32 -> @+head:Bool -> @wire:String -> IO(Result<&1, &1, 0xc850b7230535f08df98532e8cb531076/pure.Err, 0xc850b7230535f08df98532e8cb531076/pure.Up>)

Upload: the request body sent in chunks (RFC 9112 §7.1). err: the first failed write.

def up.route source · line 2260 · raw

@+ms:U32 -> @r:Pair(String, Pair(0xc850b7230535f08df98532e8cb531076/pure.Send, 0xc850b7230535f08df98532e8cb531076/pure.Route)) -> IO(Result<&1, &1, 0xc850b7230535f08df98532e8cb531076/pure.Err, 0xc850b7230535f08df98532e8cb531076/pure.Up>)

def up.origin.choice source · line 2267 · raw

@+method:String -> @+ms:U32 -> @headers:Map<&2, List<&2, String>> -> @hf:String -> @scheme:String -> @host:String -> @port:U32 -> @target:String -> @cert:Maybe<&2, 0xc850b7230535f08df98532e8cb531076/pure.Cert> -> @+ca:String -> @choice:Maybe<&2, 0xc850b7230535f08df98532e8cb531076/pure.Proxy> -> IO(Result<&1, &1, 0xc850b7230535f08df98532e8cb531076/pure.Err, 0xc850b7230535f08df98532e8cb531076/pure.Up>)

def up.origin source · line 2279 · raw

@+method:String -> @+ms:U32 -> @headers:Map<&2, List<&2, String>> -> @hf:String -> @a:0x1f2d80f53f971b16c6de6a65cb1918ae/url.Abs -> @known:Bool -> @cert:Maybe<&2, 0xc850b7230535f08df98532e8cb531076/pure.Cert> -> @+ca:String -> IO(Result<&1, &1, 0xc850b7230535f08df98532e8cb531076/pure.Err, 0xc850b7230535f08df98532e8cb531076/pure.Up>)

def up.url source · line 2292 · raw

@+method:String -> @+ms:U32 -> @headers:Map<&2, List<&2, String>> -> @u:Maybe<&2, 0x1f2d80f53f971b16c6de6a65cb1918ae/url.Abs> -> @cert:Maybe<&2, 0xc850b7230535f08df98532e8cb531076/pure.Cert> -> @+ca:String -> IO(Result<&1, &1, 0xc850b7230535f08df98532e8cb531076/pure.Err, 0xc850b7230535f08df98532e8cb531076/pure.Up>)

def upload.how source · line 2302 · raw

@cert:Maybe<&2, 0xc850b7230535f08df98532e8cb531076/pure.Cert> -> @+ca:String -> @+method:String -> @url:String -> @headers:Map<&2, List<&2, String>> -> @+ms:U32 -> IO(Result<&1, &1, 0xc850b7230535f08df98532e8cb531076/pure.Err, 0xc850b7230535f08df98532e8cb531076/pure.Up>)

cert and ca as in open.how. A streamed body cannot be replayed, so redirects are not followed.

def upload.with source · line 2306 · raw

@+method:String -> @url:String -> @headers:Map<&2, List<&2, String>> -> @+ms:U32 -> IO(Result<&1, &1, 0xc850b7230535f08df98532e8cb531076/pure.Err, 0xc850b7230535f08df98532e8cb531076/pure.Up>)

def upload source · line 2309 · raw

@+method:String -> @url:String -> @headers:Map<&2, List<&2, String>> -> IO(Result<&1, &1, 0xc850b7230535f08df98532e8cb531076/pure.Err, 0xc850b7230535f08df98532e8cb531076/pure.Up>)

def up.put source · line 2312 · raw

@+tls:Bool -> @s:Socket -> @+ms:U32 -> @+head:Bool -> @+len:U32 -> @piece:0xec25e4adfb02e59e4b817801115988ee/bytes.Bytes -> @skip:Bool -> IO(Pair(0xc850b7230535f08df98532e8cb531076/pure.Up, Result<&2, &2, 0xc850b7230535f08df98532e8cb531076/pure.Err, Unit>))

def up.chunk source · line 2321 · raw

@+tls:Bool -> @s:Socket -> @+ms:U32 -> @+head:Bool -> @piece:0xec25e4adfb02e59e4b817801115988ee/bytes.Bytes -> IO(Pair(0xc850b7230535f08df98532e8cb531076/pure.Up, Result<&2, &2, 0xc850b7230535f08df98532e8cb531076/pure.Err, Unit>))

def upload.write source · line 2326 · raw

@up:0xc850b7230535f08df98532e8cb531076/pure.Up -> @piece:0xec25e4adfb02e59e4b817801115988ee/bytes.Bytes -> IO(Pair(0xc850b7230535f08df98532e8cb531076/pure.Up, Result<&2, &2, 0xc850b7230535f08df98532e8cb531076/pure.Err, Unit>))

One chunk. An empty piece sends nothing, since an empty chunk would end the body.

def upload.finish source · line 2335 · raw

@up:0xc850b7230535f08df98532e8cb531076/pure.Up -> IO(Result<&1, &1, 0xc850b7230535f08df98532e8cb531076/pure.Err, Stream>)

Ends the body and returns the response as a stream.

def limits.validate.ok source · line 2348 · raw

@valid:Bool -> IO(Unit)

def limits.validate source · line 2355 · raw

@+max:Nat -> IO(Unit)

def bounded.send.ready source · line 2358 · raw

@expired:Bool -> @s:Socket -> @b:0xec25e4adfb02e59e4b817801115988ee/bytes.Bytes -> @ms:U32 -> IO(Pair(Socket, Result<&1, &1, Pair(U32, String), Unit>))

def bounded.send source · line 2368 · raw

@s:Socket -> @b:0xec25e4adfb02e59e4b817801115988ee/bytes.Bytes -> @until:0xb11aca60dbb10f10d8f37cc3807477a2/pure.Duration -> IO(Pair(Socket, Result<&1, &1, Pair(U32, String), Unit>))

def reply.drain source · line 2374 · raw

@n:Nat -> @alive:Bool -> @+until:0xb11aca60dbb10f10d8f37cc3807477a2/pure.Duration -> @st:Pair(Socket, Bool) -> IO(Unit)

def reply.sent.close source · line 2395 · raw

@m:Pair(Socket, Result<&1, &1, Pair(U32, String), Unit>) -> IO(Unit)

def reply.sent.observe source · line 2405 · raw

@observer:0xc850b7230535f08df98532e8cb531076/completion.Receipt -> @status:U32 -> @sent:Pair(Socket, Result<&1, &1, Pair(U32, String), Unit>) -> IO(Unit)

def reply_fail source · line 2419 · raw

@observer:0xc850b7230535f08df98532e8cb531076/completion.Receipt -> @s:Socket -> @+status:U32 -> @ms:U32 -> IO(Unit)

def talk.after source · line 2428 · raw

@settings:0xc850b7230535f08df98532e8cb531076/pure.Limits -> @keep:Bool -> @rest:0xec25e4adfb02e59e4b817801115988ee/bytes.Bytes -> @m:Pair(Socket, Result<&1, &1, Pair(U32, String), Unit>) -> Pair(Pair(Socket, 0xc850b7230535f08df98532e8cb531076/pure.Turn), 0xc850b7230535f08df98532e8cb531076/completion.Outcome)

The head is parsed once, when it is whole. Body pieces are kept as they come and joined once.

def talk.send source · line 2436 · raw

@+settings:0xc850b7230535f08df98532e8cb531076/pure.Limits -> @s:Socket -> @rest:0xec25e4adfb02e59e4b817801115988ee/bytes.Bytes -> @+headers:Map<&2, List<&2, String>> -> @v11:Bool -> @+head:Bool -> @res:0xc850b7230535f08df98532e8cb531076/pure.Res -> IO(Pair(Pair(Socket, 0xc850b7230535f08df98532e8cb531076/pure.Turn), 0xc850b7230535f08df98532e8cb531076/completion.Outcome))

def talk.completed.connection source · line 2446 · raw

@outcome:0xc850b7230535f08df98532e8cb531076/completion.Outcome -> @next:Pair(Socket, 0xc850b7230535f08df98532e8cb531076/pure.Turn) -> IO(Maybe<&1, Pair(Socket, 0xc850b7230535f08df98532e8cb531076/pure.Turn)>)

def talk.completed source · line 2462 · raw

@observer:0xc850b7230535f08df98532e8cb531076/completion.Receipt -> @receipt:0xc850b7230535f08df98532e8cb531076/completion.Receipt -> @+status:U32 -> @sent:Pair(Pair(Socket, 0xc850b7230535f08df98532e8cb531076/pure.Turn), 0xc850b7230535f08df98532e8cb531076/completion.Outcome) -> IO(Maybe<&1, Pair(Socket, 0xc850b7230535f08df98532e8cb531076/pure.Turn)>)

def talk.respond source · line 2472 · raw

@observer:0xc850b7230535f08df98532e8cb531076/completion.Receipt -> @+settings:0xc850b7230535f08df98532e8cb531076/pure.Limits -> @s:Socket -> @rest:0xec25e4adfb02e59e4b817801115988ee/bytes.Bytes -> @headers:Map<&2, List<&2, String>> -> @v11:Bool -> @head:Bool -> @reply:Reply -> IO(Maybe<&1, Pair(Socket, 0xc850b7230535f08df98532e8cb531076/pure.Turn)>)

def talk.cont source · line 2479 · raw

@cont:Bool -> @s:Socket -> @ms:U32 -> IO(Pair(Socket, Result<&1, &1, Pair(U32, String), Unit>))

def talk.read.running source · line 2488 · raw

@held:Bool -> @inbox:Chan(0xc850b7230535f08df98532e8cb531076/admission.Command) -> IO(Bool)

def talk.read source · line 2540 · raw

@+inbox:Chan(0xc850b7230535f08df98532e8cb531076/admission.Command) -> @held:Bool -> @+settings:0xc850b7230535f08df98532e8cb531076/pure.Limits -> @sv:0xc850b7230535f08df98532e8cb531076/pure.Sv -> @phase:0xc850b7230535f08df98532e8cb531076/pure.Phase -> @m:Pair(Socket, Result<&1, &1, Pair(U32, String), Unit>) -> IO(Pair(Pair(Socket, 0xc850b7230535f08df98532e8cb531076/pure.Turn), 0xc850b7230535f08df98532e8cb531076/pure.Phase))

def talk.recv.selected source · line 2548 · raw

@+inbox:Chan(0xc850b7230535f08df98532e8cb531076/admission.Command) -> @held:Bool -> @+settings:0xc850b7230535f08df98532e8cb531076/pure.Limits -> @s:Socket -> @cont:Bool -> @selected:Pair(0xc850b7230535f08df98532e8cb531076/pure.Phase, 0xc850b7230535f08df98532e8cb531076/pure.Sv) -> IO(Pair(Pair(Socket, 0xc850b7230535f08df98532e8cb531076/pure.Turn), 0xc850b7230535f08df98532e8cb531076/pure.Phase))

def talk.recv source · line 2555 · raw

@+inbox:Chan(0xc850b7230535f08df98532e8cb531076/admission.Command) -> @held:Bool -> @+settings:0xc850b7230535f08df98532e8cb531076/pure.Limits -> @s:Socket -> @sv:0xc850b7230535f08df98532e8cb531076/pure.Sv -> @cont:Bool -> @previous:Maybe<&2, 0xc850b7230535f08df98532e8cb531076/pure.Phase> -> IO(Pair(Pair(Socket, 0xc850b7230535f08df98532e8cb531076/pure.Turn), 0xc850b7230535f08df98532e8cb531076/pure.Phase))

def admission.done source · line 2560 · raw

@+inbox:Chan(0xc850b7230535f08df98532e8cb531076/admission.Command) -> @operation:IO(Unit) -> IO(Unit)

def admission.reject source · line 2565 · raw

@observer:0xc850b7230535f08df98532e8cb531076/completion.Receipt -> @s:Socket -> @head:Bool -> @ms:U32 -> IO(Unit)

def server.counts source · line 2695 · raw

@counts:Maybe<&2, 0xc850b7230535f08df98532e8cb531076/admission.Counts> -> Maybe<&2, 0xc850b7230535f08df98532e8cb531076/pure.ServerCounts>

def server.stats source · line 2704 · raw

@observer:ServerStats -> IO(Maybe<&2, 0xc850b7230535f08df98532e8cb531076/pure.ServerCounts>)

None means accounting has closed after the listener and its retained operations. This is not a drain result or a per-response write outcome.

def server.stop source · line 2718 · raw

@control:ServerControl -> IO(Bool)

def server.final.counts source · line 2722 · raw

@counts:0xc850b7230535f08df98532e8cb531076/admission.Counts -> 0xc850b7230535f08df98532e8cb531076/pure.ServerCounts

def server.exited source · line 2845 · raw

@result:0xc850b7230535f08df98532e8cb531076/pure.ServerExit -> IO(Unit)

Convenience wrappers use the same owner and observe its actual exit/drain.

def server.start.failed source · line 2850 · raw

@error:0xc850b7230535f08df98532e8cb531076/pure.StartupError -> IO(Unit)

def serve.config.result source · line 2855 · raw

@result:Result<&2, &2, 0xc850b7230535f08df98532e8cb531076/pure.StartupError, Unit> -> IO(Unit)

def admission.give.held source · line 2901 · raw

@held:Bool -> @inbox:Chan(0xc850b7230535f08df98532e8cb531076/admission.Command) -> IO(Unit)

def admission.stream.take source · line 2908 · raw

@needed:Bool -> @inbox:Chan(0xc850b7230535f08df98532e8cb531076/admission.Command) -> IO(Bool)

def writer.sent source · line 3045 · raw

@+mode:0xc850b7230535f08df98532e8cb531076/pure.WriterMode -> @+until:0xb11aca60dbb10f10d8f37cc3807477a2/pure.Duration -> @m:Pair(Socket, Result<&1, &1, Pair(U32, String), Unit>) -> IO(Writer)

def writer.raw source · line 3055 · raw

@w:Writer -> @b:0xec25e4adfb02e59e4b817801115988ee/bytes.Bytes -> IO(Writer)

def writer.chunk source · line 3065 · raw

@s:Socket -> @b:0xec25e4adfb02e59e4b817801115988ee/bytes.Bytes -> @+len:U32 -> @until:0xb11aca60dbb10f10d8f37cc3807477a2/pure.Duration -> IO(Writer)

def writer.known source · line 3071 · raw

@ok:Bool -> @s:Socket -> @+left:U32 -> @len:U32 -> @b:0xec25e4adfb02e59e4b817801115988ee/bytes.Bytes -> @+until:0xb11aca60dbb10f10d8f37cc3807477a2/pure.Duration -> IO(Writer)

def writer.chunk.go source · line 3080 · raw

@empty:Bool -> @s:Socket -> @b:0xec25e4adfb02e59e4b817801115988ee/bytes.Bytes -> @len:U32 -> @until:0xb11aca60dbb10f10d8f37cc3807477a2/pure.Duration -> IO(Writer)

def writer.write.mode source · line 3087 · raw

@s:Socket -> @mode:0xc850b7230535f08df98532e8cb531076/pure.WriterMode -> @b:0xec25e4adfb02e59e4b817801115988ee/bytes.Bytes -> @until:0xb11aca60dbb10f10d8f37cc3807477a2/pure.Duration -> IO(Writer)

def writer.write source · line 3098 · raw

@w:Writer -> @b:0xec25e4adfb02e59e4b817801115988ee/bytes.Bytes -> IO(Writer)

def writer.result source · line 3106 · raw

@w:Writer -> Pair(Maybe<&1, Socket>, 0xc850b7230535f08df98532e8cb531076/completion.Outcome)

def writer.finish.known source · line 3110 · raw

@complete:Bool -> @s:Socket -> IO(Pair(Maybe<&1, Socket>, 0xc850b7230535f08df98532e8cb531076/completion.Outcome))

def writer.finish.mode source · line 3119 · raw

@s:Socket -> @mode:0xc850b7230535f08df98532e8cb531076/pure.WriterMode -> @until:0xb11aca60dbb10f10d8f37cc3807477a2/pure.Duration -> IO(Pair(Maybe<&1, Socket>, 0xc850b7230535f08df98532e8cb531076/completion.Outcome))

def writer.finish source · line 3130 · raw

@w:Writer -> IO(Pair(Maybe<&1, Socket>, 0xc850b7230535f08df98532e8cb531076/completion.Outcome))

def serve.write.completed source · line 3138 · raw

@observer:0xc850b7230535f08df98532e8cb531076/completion.Receipt -> @receipt:0xc850b7230535f08df98532e8cb531076/completion.Receipt -> @+status:U32 -> @settings:0xc850b7230535f08df98532e8cb531076/pure.Limits -> @keep:Bool -> @rest:0xec25e4adfb02e59e4b817801115988ee/bytes.Bytes -> @result:Pair(Maybe<&1, Socket>, 0xc850b7230535f08df98532e8cb531076/completion.Outcome) -> IO(Maybe<&1, Pair(Socket, 0xc850b7230535f08df98532e8cb531076/pure.Turn)>)

def serve.write.returned source · line 3147 · raw

@observer:0xc850b7230535f08df98532e8cb531076/completion.Receipt -> @status:U32 -> @settings:0xc850b7230535f08df98532e8cb531076/pure.Limits -> @keep:Bool -> @rest:0xec25e4adfb02e59e4b817801115988ee/bytes.Bytes -> @result:Pair(Writer, 0xc850b7230535f08df98532e8cb531076/completion.Receipt) -> IO(Maybe<&1, Pair(Socket, 0xc850b7230535f08df98532e8cb531076/pure.Turn)>)

def serve.write.finish source · line 3154 · raw

@observer:0xc850b7230535f08df98532e8cb531076/completion.Receipt -> @receipt:0xc850b7230535f08df98532e8cb531076/completion.Receipt -> @status:U32 -> @settings:0xc850b7230535f08df98532e8cb531076/pure.Limits -> @keep:Bool -> @rest:0xec25e4adfb02e59e4b817801115988ee/bytes.Bytes -> @w:Writer -> IO(Maybe<&1, Pair(Socket, 0xc850b7230535f08df98532e8cb531076/pure.Turn)>)

Templates

template reply.complete source · line 43 · raw

@-D:Data -> @-done:(@_:0xc850b7230535f08df98532e8cb531076/completion.Completion<D> -> IO(Unit)) -> @payload:D -> @response:0xc850b7230535f08df98532e8cb531076/pure.Res -> Reply

template ce.eff source · line 1207 · raw

@-eff:(@_:U32 -> @_:0xec25e4adfb02e59e4b817801115988ee/bytes.Bytes -> IO(Result<&1, &1, Pair(U32, String), 0xec25e4adfb02e59e4b817801115988ee/bytes.Bytes>)) -> @b:0xec25e4adfb02e59e4b817801115988ee/bytes.Bytes -> IO(Maybe<&1, 0xec25e4adfb02e59e4b817801115988ee/bytes.Bytes>)

Content-Encoding (RFC 9110 §8.4): each value, trimmed and lowercased, in the order applied.

template codings.has source · line 1282 · raw

@-eff:(@_:U32 -> @_:0xec25e4adfb02e59e4b817801115988ee/bytes.Bytes -> IO(Result<&1, &1, Pair(U32, String), 0xec25e4adfb02e59e4b817801115988ee/bytes.Bytes>)) -> @b:0xec25e4adfb02e59e4b817801115988ee/bytes.Bytes -> IO(Bool)

An effect on empty input fails with ENOENT only when its library does not load.

template admission.request source · line 2572 · raw

@-C:Data -> @-h:(@_:C -> @_:0xc850b7230535f08df98532e8cb531076/pure.Req -> IO(Reply)) -> @-observe:(@_:C -> @_:U32 -> @_:0xc850b7230535f08df98532e8cb531076/completion.Outcome -> IO(Unit)) -> @admitted:Bool -> @+inbox:Chan(0xc850b7230535f08df98532e8cb531076/admission.Command) -> @+context:C -> @+settings:0xc850b7230535f08df98532e8cb531076/pure.Limits -> @s:Socket -> @req:0xc850b7230535f08df98532e8cb531076/pure.Req -> @rest:0xec25e4adfb02e59e4b817801115988ee/bytes.Bytes -> @v11:Bool -> IO(Maybe<&1, Pair(Socket, 0xc850b7230535f08df98532e8cb531076/pure.Turn)>)

template conn.admitted source · line 2615 · raw

@-h:(@_:0xc850b7230535f08df98532e8cb531076/pure.Req -> IO(Reply)) -> @-observe:(@_:U32 -> @_:0xc850b7230535f08df98532e8cb531076/completion.Outcome -> IO(Unit)) -> @admitted:Bool -> @+settings:0xc850b7230535f08df98532e8cb531076/pure.Limits -> @+inbox:Chan(0xc850b7230535f08df98532e8cb531076/admission.Command) -> @l:Listener -> @s:Socket -> IO(Listener)

template conn source · line 2627 · raw

@-h:(@_:0xc850b7230535f08df98532e8cb531076/pure.Req -> IO(Reply)) -> @-observe:(@_:U32 -> @_:0xc850b7230535f08df98532e8cb531076/completion.Outcome -> IO(Unit)) -> @+settings:0xc850b7230535f08df98532e8cb531076/pure.Limits -> @+inbox:Chan(0xc850b7230535f08df98532e8cb531076/admission.Command) -> @m:Pair(Listener, Result<&1, &1, Pair(U32, String), Socket>) -> IO(Listener)

template server.opened source · line 2638 · raw

@-C:Data -> @-O:Type -> @owner:O -> @listener:Listener -> @context:C -> @config:0xc850b7230535f08df98532e8cb531076/pure.ServerConfig -> @opened:Pair(Chan(0xc850b7230535f08df98532e8cb531076/admission.Command), Chan(0xc850b7230535f08df98532e8cb531076/admission.Counts)) -> IO(Pair(O, Result<&2, &1, 0xc850b7230535f08df98532e8cb531076/pure.StartupError, Server<C>>))

template server.started source · line 2643 · raw

@-C:Data -> @-O:Type -> @context:C -> @owner:O -> @+config:0xc850b7230535f08df98532e8cb531076/pure.ServerConfig -> @result:Result<&1, &1, Pair(U32, String), Listener> -> IO(Pair(O, Result<&2, &1, 0xc850b7230535f08df98532e8cb531076/pure.StartupError, Server<C>>))

template server.bound source · line 2654 · raw

@-C:Data -> @-O:Type -> @context:C -> @owner:O -> @config:0xc850b7230535f08df98532e8cb531076/pure.ServerConfig -> @result:Result<&1, &1, Pair(U32, String), Pair(Listener, U32)> -> IO(Pair(O, Result<&2, &1, 0xc850b7230535f08df98532e8cb531076/pure.StartupError, Server<C>>))

template server.start.valid source · line 2665 · raw

@-C:Data -> @-O:Type -> @valid:Bool -> @context:C -> @owner:O -> @+config:0xc850b7230535f08df98532e8cb531076/pure.ServerConfig -> IO(Pair(O, Result<&2, &1, 0xc850b7230535f08df98532e8cb531076/pure.StartupError, Server<C>>))

template server.start source · line 2677 · raw

@-C:Data -> @-O:Type -> @context:C -> @owner:O -> @+config:0xc850b7230535f08df98532e8cb531076/pure.ServerConfig -> IO(Pair(O, Result<&2, &1, 0xc850b7230535f08df98532e8cb531076/pure.StartupError, Server<C>>))

Done is the readiness signal: Wire.listen has installed an accepting socket. Both branches return the preopened application owner unchanged.

template server.port source · line 2681 · raw

@-C:Data -> @server:Server<C> -> Pair(Server<C>, U32)

Observe the actual bound port without releasing the listener.

template server.observer source · line 2691 · raw

@-C:Data -> @server:Server<C> -> Pair(Server<C>, ServerStats)

template server.control source · line 2714 · raw

@-C:Data -> @server:Server<C> -> Pair(Server<C>, ServerControl)

Stop linearizes in Admission. It requests quiescence, never attests drain.

template server.close source · line 2728 · raw

@-C:Data -> @server:Server<C> -> IO(0xc850b7230535f08df98532e8cb531076/pure.ServerCounts)

Only the listener owner closes it, after the current accept really returns. Joining the controller waits for every real operation, including callbacks.

template server.finish source · line 2737 · raw

@-C:Data -> @stopped:Bool -> @error:Pair(U32, String) -> @server:Server<C> -> IO(0xc850b7230535f08df98532e8cb531076/pure.ServerExit)

template server.admitted source · line 2742 · raw

@-C:Data -> @-operation:(@_:C -> @_:0xc850b7230535f08df98532e8cb531076/pure.Limits -> @_:Chan(0xc850b7230535f08df98532e8cb531076/admission.Command) -> @_:Socket -> IO(Unit)) -> @admitted:Bool -> @+context:C -> @+config:0xc850b7230535f08df98532e8cb531076/pure.ServerConfig -> @+inbox:Chan(0xc850b7230535f08df98532e8cb531076/admission.Command) -> @drained:Chan(0xc850b7230535f08df98532e8cb531076/admission.Counts) -> @listener:Listener -> @socket:Socket -> IO(Pair(Server<C>, Result<&1, &1, Pair(U32, String), Chan(Unit)>))

template server.accepted source · line 2753 · raw

@-C:Data -> @-operation:(@_:C -> @_:0xc850b7230535f08df98532e8cb531076/pure.Limits -> @_:Chan(0xc850b7230535f08df98532e8cb531076/admission.Command) -> @_:Socket -> IO(Unit)) -> @+context:C -> @+config:0xc850b7230535f08df98532e8cb531076/pure.ServerConfig -> @+inbox:Chan(0xc850b7230535f08df98532e8cb531076/admission.Command) -> @drained:Chan(0xc850b7230535f08df98532e8cb531076/admission.Counts) -> @result:Pair(Listener, Result<&1, &1, Pair(U32, String), Socket>) -> IO(Pair(Server<C>, Result<&1, &1, Pair(U32, String), Chan(Unit)>))

template server.accept.operation source · line 2802 · raw

@-C:Data -> @-operation:(@_:C -> @_:0xc850b7230535f08df98532e8cb531076/pure.Limits -> @_:Chan(0xc850b7230535f08df98532e8cb531076/admission.Command) -> @_:Socket -> IO(Unit)) -> @server:Server<C> -> IO(Pair(Server<C>, Result<&1, &1, Pair(U32, String), Chan(Unit)>))

template server.accept source · line 2806 · raw

@-C:Data -> @-h:(@_:C -> @_:0xc850b7230535f08df98532e8cb531076/pure.Req -> IO(Reply)) -> @-observe:(@_:C -> @_:U32 -> @_:0xc850b7230535f08df98532e8cb531076/completion.Outcome -> IO(Unit)) -> @server:Server<C> -> IO(Pair(Server<C>, Result<&1, &1, Pair(U32, String), Chan(Unit)>))

template server.run source · line 2839 · raw

@-C:Data -> @-h:(@_:C -> @_:0xc850b7230535f08df98532e8cb531076/pure.Req -> IO(Reply)) -> @-observe:(@_:C -> @_:U32 -> @_:0xc850b7230535f08df98532e8cb531076/completion.Outcome -> IO(Unit)) -> @server:Server<C> -> IO(0xc850b7230535f08df98532e8cb531076/pure.ServerExit)

template serve.stream.nonempty source · line 2860 · raw

@-S:Type -> @-piece:(@_:S -> @_:0xec25e4adfb02e59e4b817801115988ee/bytes.Bytes -> IO(Pair(S, Bool))) -> @empty:Bool -> @state:S -> @b:0xec25e4adfb02e59e4b817801115988ee/bytes.Bytes -> IO(Pair(S, Bool))

template serve.stream.one source · line 2868 · raw

@-S:Type -> @-piece:(@_:S -> @_:0xec25e4adfb02e59e4b817801115988ee/bytes.Bytes -> IO(Pair(S, Bool))) -> @drop:Bool -> @state:S -> @b:0xec25e4adfb02e59e4b817801115988ee/bytes.Bytes -> IO(Pair(S, Bool))

The piece callback returns True to discard the rest of this request body.

template serve.stream.parts source · line 2876 · raw

@-S:Type -> @-piece:(@_:S -> @_:0xec25e4adfb02e59e4b817801115988ee/bytes.Bytes -> IO(Pair(S, Bool))) -> @xs:List<&1, 0xec25e4adfb02e59e4b817801115988ee/bytes.Bytes> -> @st:Pair(S, Bool) -> IO(Pair(S, Bool))

template serve.stream.feed source · line 2886 · raw

@-S:Type -> @-start:(@_:0xc850b7230535f08df98532e8cb531076/pure.Req -> IO(S)) -> @-piece:(@_:S -> @_:0xec25e4adfb02e59e4b817801115988ee/bytes.Bytes -> IO(Pair(S, Bool))) -> @req:0xc850b7230535f08df98532e8cb531076/pure.Req -> @m:Maybe<&1, Pair(S, Bool)> -> @parts:List<&1, 0xec25e4adfb02e59e4b817801115988ee/bytes.Bytes> -> IO(Pair(S, Bool))

template serve.stream.respond source · line 2895 · raw

@-S:Type -> @-finish:(@_:S -> IO(Reply)) -> @-observe:(@_:U32 -> @_:0xc850b7230535f08df98532e8cb531076/completion.Outcome -> IO(Unit)) -> @+settings:0xc850b7230535f08df98532e8cb531076/pure.Limits -> @s:Socket -> @rest:0xec25e4adfb02e59e4b817801115988ee/bytes.Bytes -> @+headers:Map<&2, List<&2, String>> -> @v11:Bool -> @+method:String -> @st:Pair(S, Bool) -> IO(Maybe<&1, Pair(Socket, 0xc850b7230535f08df98532e8cb531076/pure.Turn)>)

template serve.stream.abort source · line 2915 · raw

@-S:Type -> @-abort:(@_:S -> @_:0xc850b7230535f08df98532e8cb531076/pure.StreamAbort -> IO(Unit)) -> @reason:0xc850b7230535f08df98532e8cb531076/pure.StreamAbort -> @state:Maybe<&1, Pair(S, Bool)> -> IO(Unit)

template server.stream.run source · line 3007 · raw

@-S:Type -> @-start:(@_:0xc850b7230535f08df98532e8cb531076/pure.Req -> IO(S)) -> @-piece:(@_:S -> @_:0xec25e4adfb02e59e4b817801115988ee/bytes.Bytes -> IO(Pair(S, Bool))) -> @-finish:(@_:S -> IO(Reply)) -> @-abort:(@_:S -> @_:0xc850b7230535f08df98532e8cb531076/pure.StreamAbort -> IO(Unit)) -> @-observe:(@_:U32 -> @_:0xc850b7230535f08df98532e8cb531076/completion.Outcome -> IO(Unit)) -> @server:Server<Unit> -> IO(0xc850b7230535f08df98532e8cb531076/pure.ServerExit)

template serve.stream.started source · line 3017 · raw

@-S:Type -> @-start:(@_:0xc850b7230535f08df98532e8cb531076/pure.Req -> IO(S)) -> @-piece:(@_:S -> @_:0xec25e4adfb02e59e4b817801115988ee/bytes.Bytes -> IO(Pair(S, Bool))) -> @-finish:(@_:S -> IO(Reply)) -> @-abort:(@_:S -> @_:0xc850b7230535f08df98532e8cb531076/pure.StreamAbort -> IO(Unit)) -> @-observe:(@_:U32 -> @_:0xc850b7230535f08df98532e8cb531076/completion.Outcome -> IO(Unit)) -> @result:Pair(Unit, Result<&2, &1, 0xc850b7230535f08df98532e8cb531076/pure.StartupError, Server<Unit>>) -> IO(Result<&2, &2, 0xc850b7230535f08df98532e8cb531076/pure.StartupError, Unit>)

template serve.stream.config source · line 3031 · raw

@-S:Type -> @-start:(@_:0xc850b7230535f08df98532e8cb531076/pure.Req -> IO(S)) -> @-piece:(@_:S -> @_:0xec25e4adfb02e59e4b817801115988ee/bytes.Bytes -> IO(Pair(S, Bool))) -> @-finish:(@_:S -> IO(Reply)) -> @-abort:(@_:S -> @_:0xc850b7230535f08df98532e8cb531076/pure.StreamAbort -> IO(Unit)) -> @-observe:(@_:U32 -> @_:0xc850b7230535f08df98532e8cb531076/completion.Outcome -> IO(Unit)) -> @config:0xc850b7230535f08df98532e8cb531076/pure.ServerConfig -> IO(Result<&2, &2, 0xc850b7230535f08df98532e8cb531076/pure.StartupError, Unit>)

template serve.write.body source · line 3158 · raw

@-S:Type -> @-write:(@_:S -> @_:Writer -> @_:0xc850b7230535f08df98532e8cb531076/completion.Receipt -> IO(Pair(Writer, 0xc850b7230535f08df98532e8cb531076/completion.Receipt))) -> @-dispose:(@_:S -> IO(Unit)) -> @observer:0xc850b7230535f08df98532e8cb531076/completion.Receipt -> @receipt:0xc850b7230535f08df98532e8cb531076/completion.Receipt -> @status:U32 -> @settings:0xc850b7230535f08df98532e8cb531076/pure.Limits -> @keep:Bool -> @rest:0xec25e4adfb02e59e4b817801115988ee/bytes.Bytes -> @state:S -> @s:Socket -> @mode:0xc850b7230535f08df98532e8cb531076/pure.WriterMode -> @suppress:Bool -> @until:0xb11aca60dbb10f10d8f37cc3807477a2/pure.Duration -> IO(Maybe<&1, Pair(Socket, 0xc850b7230535f08df98532e8cb531076/pure.Turn)>)

template serve.write.open source · line 3171 · raw

@-S:Type -> @-write:(@_:S -> @_:Writer -> @_:0xc850b7230535f08df98532e8cb531076/completion.Receipt -> IO(Pair(Writer, 0xc850b7230535f08df98532e8cb531076/completion.Receipt))) -> @-dispose:(@_:S -> IO(Unit)) -> @observer:0xc850b7230535f08df98532e8cb531076/completion.Receipt -> @receipt:0xc850b7230535f08df98532e8cb531076/completion.Receipt -> @+status:U32 -> @settings:0xc850b7230535f08df98532e8cb531076/pure.Limits -> @keep:Bool -> @rest:0xec25e4adfb02e59e4b817801115988ee/bytes.Bytes -> @state:S -> @mode:0xc850b7230535f08df98532e8cb531076/pure.WriterMode -> @suppress:Bool -> @until:0xb11aca60dbb10f10d8f37cc3807477a2/pure.Duration -> @m:Pair(Socket, Result<&1, &1, Pair(U32, String), Unit>) -> IO(Maybe<&1, Pair(Socket, 0xc850b7230535f08df98532e8cb531076/pure.Turn)>)

template serve.write.send.plan source · line 3188 · raw

@-S:Type -> @-write:(@_:S -> @_:Writer -> @_:0xc850b7230535f08df98532e8cb531076/completion.Receipt -> IO(Pair(Writer, 0xc850b7230535f08df98532e8cb531076/completion.Receipt))) -> @-dispose:(@_:S -> IO(Unit)) -> @observer:0xc850b7230535f08df98532e8cb531076/completion.Receipt -> @receipt:0xc850b7230535f08df98532e8cb531076/completion.Receipt -> @+settings:0xc850b7230535f08df98532e8cb531076/pure.Limits -> @s:Socket -> @rest:0xec25e4adfb02e59e4b817801115988ee/bytes.Bytes -> @+keep:Bool -> @+head:Bool -> @+status:U32 -> @state:S -> @plan:Pair(0xc850b7230535f08df98532e8cb531076/pure.WriterMode, Map<&2, List<&2, String>>) -> IO(Maybe<&1, Pair(Socket, 0xc850b7230535f08df98532e8cb531076/pure.Turn)>)

template serve.write.send source · line 3204 · raw

@-S:Type -> @-write:(@_:S -> @_:Writer -> @_:0xc850b7230535f08df98532e8cb531076/completion.Receipt -> IO(Pair(Writer, 0xc850b7230535f08df98532e8cb531076/completion.Receipt))) -> @-dispose:(@_:S -> IO(Unit)) -> @observer:0xc850b7230535f08df98532e8cb531076/completion.Receipt -> @settings:0xc850b7230535f08df98532e8cb531076/pure.Limits -> @s:Socket -> @rest:0xec25e4adfb02e59e4b817801115988ee/bytes.Bytes -> @+headers:Map<&2, List<&2, String>> -> @v11:Bool -> @+head:Bool -> @out:WriteHead<S> -> IO(Maybe<&1, Pair(Socket, 0xc850b7230535f08df98532e8cb531076/pure.Turn)>)

template admission.write source · line 3214 · raw

@-S:Type -> @-start:(@_:0xc850b7230535f08df98532e8cb531076/pure.Req -> IO(WriteHead<S>)) -> @-write:(@_:S -> @_:Writer -> @_:0xc850b7230535f08df98532e8cb531076/completion.Receipt -> IO(Pair(Writer, 0xc850b7230535f08df98532e8cb531076/completion.Receipt))) -> @-dispose:(@_:S -> IO(Unit)) -> @-observe:(@_:U32 -> @_:0xc850b7230535f08df98532e8cb531076/completion.Outcome -> IO(Unit)) -> @admitted:Bool -> @+inbox:Chan(0xc850b7230535f08df98532e8cb531076/admission.Command) -> @+settings:0xc850b7230535f08df98532e8cb531076/pure.Limits -> @s:Socket -> @req:0xc850b7230535f08df98532e8cb531076/pure.Req -> @rest:0xec25e4adfb02e59e4b817801115988ee/bytes.Bytes -> @v11:Bool -> IO(Maybe<&1, Pair(Socket, 0xc850b7230535f08df98532e8cb531076/pure.Turn)>)

template server.write.run source · line 3260 · raw

@-S:Type -> @-start:(@_:0xc850b7230535f08df98532e8cb531076/pure.Req -> IO(WriteHead<S>)) -> @-write:(@_:S -> @_:Writer -> @_:0xc850b7230535f08df98532e8cb531076/completion.Receipt -> IO(Pair(Writer, 0xc850b7230535f08df98532e8cb531076/completion.Receipt))) -> @-dispose:(@_:S -> IO(Unit)) -> @-observe:(@_:U32 -> @_:0xc850b7230535f08df98532e8cb531076/completion.Outcome -> IO(Unit)) -> @server:Server<Unit> -> IO(0xc850b7230535f08df98532e8cb531076/pure.ServerExit)

template serve.write.started source · line 3272 · raw

@-S:Type -> @-start:(@_:0xc850b7230535f08df98532e8cb531076/pure.Req -> IO(WriteHead<S>)) -> @-write:(@_:S -> @_:Writer -> @_:0xc850b7230535f08df98532e8cb531076/completion.Receipt -> IO(Pair(Writer, 0xc850b7230535f08df98532e8cb531076/completion.Receipt))) -> @-dispose:(@_:S -> IO(Unit)) -> @-observe:(@_:U32 -> @_:0xc850b7230535f08df98532e8cb531076/completion.Outcome -> IO(Unit)) -> @result:Pair(Unit, Result<&2, &1, 0xc850b7230535f08df98532e8cb531076/pure.StartupError, Server<Unit>>) -> IO(Result<&2, &2, 0xc850b7230535f08df98532e8cb531076/pure.StartupError, Unit>)

template serve.write.config source · line 3286 · raw

@-S:Type -> @-start:(@_:0xc850b7230535f08df98532e8cb531076/pure.Req -> IO(WriteHead<S>)) -> @-write:(@_:S -> @_:Writer -> @_:0xc850b7230535f08df98532e8cb531076/completion.Receipt -> IO(Pair(Writer, 0xc850b7230535f08df98532e8cb531076/completion.Receipt))) -> @-dispose:(@_:S -> IO(Unit)) -> @-observe:(@_:U32 -> @_:0xc850b7230535f08df98532e8cb531076/completion.Outcome -> IO(Unit)) -> @config:0xc850b7230535f08df98532e8cb531076/pure.ServerConfig -> IO(Result<&2, &2, 0xc850b7230535f08df98532e8cb531076/pure.StartupError, Unit>)

template serve.started source · line 3293 · raw

@-h:(@_:0xc850b7230535f08df98532e8cb531076/pure.Req -> IO(Reply)) -> @-observe:(@_:U32 -> @_:0xc850b7230535f08df98532e8cb531076/completion.Outcome -> IO(Unit)) -> @started:Pair(Unit, Result<&2, &1, 0xc850b7230535f08df98532e8cb531076/pure.StartupError, Server<Unit>>) -> IO(Unit)

template serve.on.with source · line 3304 · raw

@-h:(@_:0xc850b7230535f08df98532e8cb531076/pure.Req -> IO(Reply)) -> @-observe:(@_:U32 -> @_:0xc850b7230535f08df98532e8cb531076/completion.Outcome -> IO(Unit)) -> @host:String -> @+port:U32 -> @+max:Nat -> IO(Unit)

template serve.on source · line 3311 · raw

@-h:(@_:0xc850b7230535f08df98532e8cb531076/pure.Req -> IO(Reply)) -> @-observe:(@_:U32 -> @_:0xc850b7230535f08df98532e8cb531076/completion.Outcome -> IO(Unit)) -> @host:String -> @+port:U32 -> IO(Unit)

template serve.with source · line 3314 · raw

@-h:(@_:0xc850b7230535f08df98532e8cb531076/pure.Req -> IO(Reply)) -> @-observe:(@_:U32 -> @_:0xc850b7230535f08df98532e8cb531076/completion.Outcome -> IO(Unit)) -> @+port:U32 -> @+max:Nat -> IO(Unit)

template serve source · line 3317 · raw

@-h:(@_:0xc850b7230535f08df98532e8cb531076/pure.Req -> IO(Reply)) -> @-observe:(@_:U32 -> @_:0xc850b7230535f08df98532e8cb531076/completion.Outcome -> IO(Unit)) -> @+port:U32 -> IO(Unit)

template serve.stream.on.with source · line 3320 · raw

@-S:Type -> @-start:(@_:0xc850b7230535f08df98532e8cb531076/pure.Req -> IO(S)) -> @-piece:(@_:S -> @_:0xec25e4adfb02e59e4b817801115988ee/bytes.Bytes -> IO(Pair(S, Bool))) -> @-finish:(@_:S -> IO(Reply)) -> @-abort:(@_:S -> @_:0xc850b7230535f08df98532e8cb531076/pure.StreamAbort -> IO(Unit)) -> @-observe:(@_:U32 -> @_:0xc850b7230535f08df98532e8cb531076/completion.Outcome -> IO(Unit)) -> @host:String -> @+port:U32 -> @+max:Nat -> IO(Unit)

template serve.stream.with source · line 3330 · raw

@-S:Type -> @-start:(@_:0xc850b7230535f08df98532e8cb531076/pure.Req -> IO(S)) -> @-piece:(@_:S -> @_:0xec25e4adfb02e59e4b817801115988ee/bytes.Bytes -> IO(Pair(S, Bool))) -> @-finish:(@_:S -> IO(Reply)) -> @-abort:(@_:S -> @_:0xc850b7230535f08df98532e8cb531076/pure.StreamAbort -> IO(Unit)) -> @-observe:(@_:U32 -> @_:0xc850b7230535f08df98532e8cb531076/completion.Outcome -> IO(Unit)) -> @+port:U32 -> @+max:Nat -> IO(Unit)

template serve.write.on.with source · line 3336 · raw

@-S:Type -> @-start:(@_:0xc850b7230535f08df98532e8cb531076/pure.Req -> IO(WriteHead<S>)) -> @-write:(@_:S -> @_:Writer -> @_:0xc850b7230535f08df98532e8cb531076/completion.Receipt -> IO(Pair(Writer, 0xc850b7230535f08df98532e8cb531076/completion.Receipt))) -> @-dispose:(@_:S -> IO(Unit)) -> @-observe:(@_:U32 -> @_:0xc850b7230535f08df98532e8cb531076/completion.Outcome -> IO(Unit)) -> @host:String -> @+port:U32 -> @+max:Nat -> IO(Unit)

template serve.write.with source · line 3346 · raw

@-S:Type -> @-start:(@_:0xc850b7230535f08df98532e8cb531076/pure.Req -> IO(WriteHead<S>)) -> @-write:(@_:S -> @_:Writer -> @_:0xc850b7230535f08df98532e8cb531076/completion.Receipt -> IO(Pair(Writer, 0xc850b7230535f08df98532e8cb531076/completion.Receipt))) -> @-dispose:(@_:S -> IO(Unit)) -> @-observe:(@_:U32 -> @_:0xc850b7230535f08df98532e8cb531076/completion.Outcome -> IO(Unit)) -> @+port:U32 -> @+max:Nat -> IO(Unit)

Unsafe

unsafe fetch.loop source · line 111 · raw

@+close:Bool -> @+head:Bool -> @+tls:Bool -> @+ms:U32 -> @st:Pair(Socket, 0xc850b7230535f08df98532e8cb531076/pure.Fl) -> IO(0xc850b7230535f08df98532e8cb531076/pure.Out)

Read state: the response so far and the bytes read, or how it ended. none: no byte arrived, so an idempotent request may be retried.

unsafe pool.hops source · line 1194 · raw

@+mode:0xc850b7230535f08df98532e8cb531076/pure.Mode -> @+ms:U32 -> @st:Hops -> IO(Pair(Pool, Pair(Result<&1, &1, 0xc850b7230535f08df98532e8cb531076/pure.Err, 0xc850b7230535f08df98532e8cb531076/pure.Res>, Maybe<&2, 0xc850b7230535f08df98532e8cb531076/pure.Jar>)))

NGo.left is how many redirects may follow this request. 20 is WHATWG's limit. The jar, when there is one, gives cookies to every hop and takes them from every response.

unsafe stream.read source · line 1701 · raw

@st:Stream -> IO(Pair(Stream, Result<&1, &1, 0xc850b7230535f08df98532e8cb531076/pure.Err, Maybe<&1, 0xec25e4adfb02e59e4b817801115988ee/bytes.Bytes>>))

The next piece of the body; None at the end. A piece is never empty.

unsafe stream.head source · line 1762 · raw

@+tls:Bool -> @+ms:U32 -> @+head:Bool -> @back:Maybe<&2, String> -> @st:Pair(Socket, 0xc850b7230535f08df98532e8cb531076/pure.Sh) -> IO(Pair(Bool, Result<&1, &1, 0xc850b7230535f08df98532e8cb531076/pure.Err, Stream>))

The connection can take another request only when the server did not say close and the body does not end at close.

unsafe stream.hops source · line 2042 · raw

@+mode:0xc850b7230535f08df98532e8cb531076/pure.Mode -> @+ms:U32 -> @x:Pair(Pool, StreamHops) -> IO(Pair(Pool, Pair(Maybe<&2, 0xc850b7230535f08df98532e8cb531076/pure.Jar>, Result<&1, &1, 0xc850b7230535f08df98532e8cb531076/pure.Err, Stream>)))

mode says what a redirect does, as in pool.hops. A dropped redirect gives its connection to the pool when its body has ended. The pool and the jar come back beside the stream.

unsafe talk.read.loop source · line 2494 · raw

@+inbox:Chan(0xc850b7230535f08df98532e8cb531076/admission.Command) -> @+held:Bool -> @+settings:0xc850b7230535f08df98532e8cb531076/pure.Limits -> @step:0xc850b7230535f08df98532e8cb531076/pure.ReadStep -> IO(Pair(Pair(Socket, 0xc850b7230535f08df98532e8cb531076/pure.Turn), 0xc850b7230535f08df98532e8cb531076/pure.Phase))

unsafe talk source · line 2592 · raw

@-C:Data -> @-h:(@_:C -> @_:0xc850b7230535f08df98532e8cb531076/pure.Req -> IO(Reply)) -> @-observe:(@_:C -> @_:U32 -> @_:0xc850b7230535f08df98532e8cb531076/completion.Outcome -> IO(Unit)) -> @+context:C -> @+settings:0xc850b7230535f08df98532e8cb531076/pure.Limits -> @+inbox:Chan(0xc850b7230535f08df98532e8cb531076/admission.Command) -> @st:Maybe<&1, 0xc850b7230535f08df98532e8cb531076/pure.Serving> -> IO(Unit)

unsafe server.accept.loop source · line 2771 · raw

@-C:Data -> @-operation:(@_:C -> @_:0xc850b7230535f08df98532e8cb531076/pure.Limits -> @_:Chan(0xc850b7230535f08df98532e8cb531076/admission.Command) -> @_:Socket -> IO(Unit)) -> @step:AcceptStep<C> -> IO(Pair(Server<C>, Result<&1, &1, Pair(U32, String), Chan(Unit)>))

unsafe server.run.loop source · line 2817 · raw

@-C:Data -> @-operation:(@_:C -> @_:0xc850b7230535f08df98532e8cb531076/pure.Limits -> @_:Chan(0xc850b7230535f08df98532e8cb531076/admission.Command) -> @_:Socket -> IO(Unit)) -> @step:ServerLoop<C> -> IO(0xc850b7230535f08df98532e8cb531076/pure.ServerExit)

unsafe serve.stream.talk source · line 2925 · raw

@-S:Type -> @-start:(@_:0xc850b7230535f08df98532e8cb531076/pure.Req -> IO(S)) -> @-piece:(@_:S -> @_:0xec25e4adfb02e59e4b817801115988ee/bytes.Bytes -> IO(Pair(S, Bool))) -> @-finish:(@_:S -> IO(Reply)) -> @-abort:(@_:S -> @_:0xc850b7230535f08df98532e8cb531076/pure.StreamAbort -> IO(Unit)) -> @-observe:(@_:U32 -> @_:0xc850b7230535f08df98532e8cb531076/completion.Outcome -> IO(Unit)) -> @+settings:0xc850b7230535f08df98532e8cb531076/pure.Limits -> @+inbox:Chan(0xc850b7230535f08df98532e8cb531076/admission.Command) -> @step:0xc850b7230535f08df98532e8cb531076/pure.StreamServing<S> -> IO(Unit)

One recursive state machine keeps template callbacks out of mutual recursion.

unsafe serve.write.talk source · line 3234 · raw

@-S:Type -> @-start:(@_:0xc850b7230535f08df98532e8cb531076/pure.Req -> IO(WriteHead<S>)) -> @-write:(@_:S -> @_:Writer -> @_:0xc850b7230535f08df98532e8cb531076/completion.Receipt -> IO(Pair(Writer, 0xc850b7230535f08df98532e8cb531076/completion.Receipt))) -> @-dispose:(@_:S -> IO(Unit)) -> @-observe:(@_:U32 -> @_:0xc850b7230535f08df98532e8cb531076/completion.Outcome -> IO(Unit)) -> @+settings:0xc850b7230535f08df98532e8cb531076/pure.Limits -> @+inbox:Chan(0xc850b7230535f08df98532e8cb531076/admission.Command) -> @st:Maybe<&1, 0xc850b7230535f08df98532e8cb531076/pure.Serving> -> IO(Unit)