~/bend-docscommunity

http.bend relies on unsafe/foreign

raw source on the hub · import bend-kit-http@0.40.0.1/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

17 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.1/time.bend as Time
import bend-kit-int@0.2.0.0/int.bend as Int
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-encoding@0.5.0.1/encoding.bend as Enc
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/zlib.bend as Zlib
import bend-kit-zlib@0.6.0.0/native.bend as ZNative

Types

type Req source · line 27 · raw

Type

type Res source · line 30 · raw

Type

type Reply source · line 34 · raw

Type

A typed Data payload can be captured in receipt; the response remains affine.

type Err source · line 57 · raw

Data

Why fetch failed. Wire errors keep the errno and the text the effect already had. ponytail: 60 and 110 are ETIMEDOUT on macOS and Linux. Windows is out of scope.

type Fields source · line 81 · raw

Data

type Hold source · line 413 · raw

Data

More: a valid prefix. Bad: cannot become a body. Body: a whole chunked body.

type Dc source · line 427 · raw

Data

A chunked body decoder that reads each byte once, so a body fed in pieces costs O(bytes) in total. Tr{j}: j bytes of the closing CRLF CRLF matched.

type Dco source · line 439 · raw

Data

st: where the decoder is. racc: the body so far, reversed. rest: bytes after a Done body.

type Cs source · line 676 · raw

Type

A chunked body decoded from piece[i..]: a data run is sliced whole, and every other byte steps dc.

type Ck source · line 680 · raw

Type

st: where the decoder stopped. parts: the data so far, newest first. rest: the bytes after a Done body.

type Got source · line 801 · raw

Type

Bad: never a request. More: the head is not whole; read on. Head: the head is whole and valid, and the body is still coming (req.body is empty). Req: a whole request.

type Frame source · line 931 · raw

Type

Bad: never a message. More: a valid prefix; read on. Done: a whole response.

type Lead source · line 1021 · raw

Data

type Rb source · line 1142 · raw

Data

The response body as it arrives. Len: bytes left. Chunk: the decoder. Close: until the server closes. Done: the body is whole. Bad: it cannot become a body.

type Bf source · line 1179 · raw

Type

rb: how the body goes on. parts: body bytes so far, newest first. rest: bytes past a Done body.

type Hs source · line 1249 · raw

Type

The head scan. Seek: look for the blank line from byte from; k interim heads are behind. Wait: no blank line yet. Res: the final head, how its body ends, and the bytes after it.

type Rv source · line 1349 · raw

Type

A response read in pieces. Head: the head is not whole yet. Body: it is, and parts is the body so far. Len: a Content-Length body in one buffer of that size, with left bytes still to come.

type Rt source · line 1355 · raw

Type

More: read on. Done: the response, and the bytes after it when the body is self-delimited.

type Reason source · line 1661 · raw

Data

RFC 9110 §15. An unknown code gets an empty reason, which RFC 9112 §4 allows.

type Hop source · line 1757 · raw

Type

One request to make: headers are already lowercased (see req.put).

type Jar source · line 1821 · raw

Data

The cookies, oldest first, and the caller's clock. No cookie in it has expired by now.

type Hms source · line 1944 · raw

Data

type Cdate source · line 1948 · raw

Data

§5.1.1 cookie-date: the first time, day, month and year tokens found.

type Cav source · line 2150 · raw

Data

§5.6.1–§5.6.7: the last of each attribute. expires is the date as sent; max_age is capped seconds. Neither is a time from now yet: a Cav with a Time.Instant and now beside it is too wide (bendlang/bend#1069).

type Av source · line 2218 · raw

Data

type Out source · line 2510 · raw

Type

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.

type Fl source · line 2551 · raw

Type

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.

type Cert source · line 2630 · raw

Data

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

type Proxy source · line 2633 · raw

Data

type Route source · line 2637 · raw

Data

type Conn source · line 2645 · raw

Type

type Send source · line 2649 · raw

Type

type H2Reader source · line 2653 · raw

Type

type H2Step source · line 2656 · raw

Type

type TunnelStep source · line 2660 · raw

Type

type Pool source · line 2666 · raw

Type

type Dial source · line 2891 · raw

Type

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

type Took source · line 3656 · raw

Type

type Next source · line 3967 · raw

Type

type Mode source · line 3972 · raw

Data

type Hops source · line 4039 · raw

Type

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

type Dec source · line 4114 · raw

Type

Ok: decoded so far. Bad: a coding failed. Skip: a coding we cannot decode, so the body stays as sent.

type Fetch source · line 4409 · raw

Type

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

type Po source · line 4704 · 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 StreamWire source · line 4711 · raw

Type

type Stream source · line 4717 · raw

Type

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

type Pc source · line 4720 · raw

Type

type Fed source · line 4807 · raw

Type

type Sh source · line 5049 · raw

Type

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.

type Sn source · line 5306 · raw

Type

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

type StreamHops source · line 5341 · 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 5390 · raw

Type

type Up source · line 5578 · raw

Type

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

type ServerConfig source · line 5725 · raw

Data

type Limits source · line 5731 · raw

Data

Shared framing settings; all live readers reserve admission before allocation.

type Phase source · line 5757 · raw

Data

One absolute deadline, never replenished by progress.

type Sv source · line 5858 · raw

Type

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

type InputOperation source · line 5863 · raw

Data

type Turn source · line 5868 · raw

Type

More: read on, first answering 100 Continue when cont is set.

type ReadStep source · line 6296 · raw

Type

type Serving source · line 6373 · raw

Type

type StartupError source · line 6489 · raw

Data

Finite positive settings, not zero/unlimited sentinels.

type Server source · line 6494 · raw

@-C:Data -> Type

Application-owned affine dependencies never enter this transport owner.

type ServerStats source · line 6565 · raw

Data

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

type ServerCounts source · line 6568 · raw

Data

type ServerControl source · line 6592 · raw

Data

type ServerExit source · line 6619 · raw

Data

type AcceptStep source · line 6658 · raw

@-C:Data -> Type

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

type ServerLoop source · line 6709 · raw

@-C:Data -> Type

type StreamServing source · line 6831 · raw

@-S:Type -> Type

type StreamAbort source · line 6856 · raw

Data

type WriterMode source · line 6987 · raw

Data

type Writer source · line 6992 · raw

Type

type WriteHead source · line 6995 · raw

@-S:Type -> Type

Definitions

def Body source · line 42 · raw

Type

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

def from_string source · line 46 · raw

@+s:String -> 0xec25e4adfb02e59e4b817801115988ee/bytes.Bytes

A byte string (one Char per octet) to a body, and back.

def to_string source · line 49 · raw

@b:0xec25e4adfb02e59e4b817801115988ee/bytes.Bytes -> String

def length source · line 52 · raw

@b:0xec25e4adfb02e59e4b817801115988ee/bytes.Bytes -> Pair(0xec25e4adfb02e59e4b817801115988ee/bytes.Bytes, U32)

def err.late source · line 68 · raw

@+code:U32 -> Bool

def err.pick source · line 71 · raw

@e:Err -> @late:Bool -> Err

def err.or_late source · line 78 · raw

@code:U32 -> @e:Err -> Err

def empty source · line 87 · raw

Map<&2, List<&2, String>>

One list per field name, in arrival order. header() is the first value. Set-Cookie is never joined. Encode writes one line per value.

def fields.of source · line 90 · raw

@r:Pair(Map<&2, List<&2, String>>, List<&2, String>) -> List<&2, String>

def fields source · line 94 · raw

@+h:Map<&2, List<&2, String>> -> @k:String -> List<&2, String>

def header.first source · line 97 · raw

@xs:List<&2, String> -> String

def field.last source · line 107 · raw

@xs:List<&2, String> -> String

def header.last source · line 117 · raw

@+h:Map<&2, List<&2, String>> -> @k:String -> String

Transfer-Encoding is a list; chunked, when present, is the last coding.

def snoc source · line 120 · raw

@xs:List<&2, String> -> @v:String -> List<&2, String>

def set source · line 127 · raw

@m:Map<&2, List<&2, String>> -> @k:String -> @v:String -> Map<&2, List<&2, String>>

def add source · line 130 · raw

@+m:Map<&2, List<&2, String>> -> @+k:String -> @v:String -> Map<&2, List<&2, String>>

def sanitize.cons source · line 133 · raw

@ch:Char -> @rest:String -> @drop:Bool -> String

def sanitize source · line 140 · raw

@s:String -> String

def drop_cr.last.if source · line 147 · raw

@cr:Bool -> @c:U32 -> String

def drop_cr.last source · line 154 · raw

@+c:U32 -> String

def drop_cr.go source · line 158 · raw

@s:String -> @prev:U32 -> String

prev is the char before s; it is kept unless it is a final CR.

def drop_cr source · line 165 · raw

@s:String -> String

def blank_end.go source · line 173 · raw

@s:String -> @w:U32 -> Bool

w holds the last four octets; a char past 255 clears it.

def blank_end source · line 181 · raw

@s:String -> Bool

String.ends_with(s, "\r\n\r\n") in one pass, with no reversed copy.

def trim_end.cons source · line 184 · raw

@h:Char -> @r:String -> @space:Bool -> String

def trim_end source · line 196 · raw

@s:String -> String

String.trim_end without the two reversed copies.

def trim source · line 203 · raw

@s:String -> String

def take.cut source · line 207 · raw

@acc:String -> @rest:String -> Pair(String, String)

Bool.pick evaluates both arms; a split that recursed inside it would reverse acc at every byte.

def take_sp.go source · line 211 · raw

@s:String -> @acc:String -> @hit:Bool -> Pair(String, String)

hit: the last char pushed onto acc was the stop char.

def take_sp source · line 226 · raw

@s:String -> Pair(String, String)

def start_line.ver source · line 229 · raw

@m:String -> @pv:Pair(String, String) -> Pair(String, Pair(String, String))

def start_line.rest source · line 233 · raw

@mr:Pair(String, String) -> Pair(String, Pair(String, String))

def start_line source · line 237 · raw

@s:String -> Pair(String, Pair(String, String))

def split_at_blank.go source · line 240 · raw

@s:String -> @e:Bool -> @w:U32 -> @acc:String -> Pair(String, String)

def split_at_blank.flag.go source · line 253 · raw

@+raw:String -> @s:String -> @off:Nat -> @w:U32 -> @e:Bool -> Pair(String, Pair(String, Bool))

split_at_blank, plus whether the head ends in the blank line.

def split_at_blank.pair source · line 266 · raw

@r:Pair(String, Pair(String, Bool)) -> Pair(String, String)

def split_at_blank source · line 270 · raw

@+s:String -> Pair(String, String)

def split_colon.go source · line 273 · raw

@s:String -> @acc:String -> @hit:Bool -> Pair(String, String)

def split_colon source · line 288 · raw

@+s:String -> Pair(String, String)

def has_header.of source · line 291 · raw

@r:Pair(Map<&2, List<&2, String>>, Bool) -> Bool

def has_header source · line 295 · raw

@+h:Map<&2, List<&2, String>> -> @k:String -> Bool

def folded source · line 298 · raw

@+line:String -> Bool

def tracked source · line 301 · raw

@+k:String -> Bool

def fields_put.dup source · line 304 · raw

@m:Map<&2, List<&2, String>> -> @k:String -> @v:String -> @bad:Bool -> Fields

def fields_put.tracked source · line 311 · raw

@+m:Map<&2, List<&2, String>> -> @+k:String -> @v:String -> @t:Bool -> Fields

def fields_put.key source · line 318 · raw

@+m:Map<&2, List<&2, String>> -> @+k:String -> @v:String -> Fields

def fields_put.kv source · line 321 · raw

@m:Map<&2, List<&2, String>> -> @kv:Pair(String, String) -> Fields

def fields_put.fold source · line 325 · raw

@m:Map<&2, List<&2, String>> -> @line:String -> @fold:Bool -> Fields

def fields_put.empty source · line 332 · raw

@m:Map<&2, List<&2, String>> -> @+line:String -> @e:Bool -> Fields

def fields_put.ok source · line 339 · raw

@m:Map<&2, List<&2, String>> -> @+line:String -> Fields

def fields_put source · line 342 · raw

@acc:Fields -> @line:String -> Fields

def parse.headers.done source · line 349 · raw

@acc:Fields -> Maybe<&2, Map<&2, List<&2, String>>>

def parse.headers.scan.line source · line 357 · raw

@acc:String -> @fields:Fields -> Fields

def parse.headers.scan source · line 364 · raw

@s:String -> @acc:String -> @fields:Fields -> Fields

def parse.headers.raw source · line 373 · raw

@s:String -> Maybe<&2, Map<&2, List<&2, String>>>

def parse.first source · line 376 · raw

@s:String -> @acc:String -> Pair(String, String)

def parse_u32.digit source · line 385 · raw

@+c:U32 -> Bool

def parse_u32.add source · line 388 · raw

@acc:U32 -> @c:U32 -> U32

def parse_u32.done source · line 391 · raw

@acc:U32 -> @bad:Bool -> Maybe<&2, U32>

def parse_u32.go source · line 398 · raw

@s:String -> @acc:U32 -> @bad:Bool -> Maybe<&2, U32>

def parse_u32 source · line 405 · raw

@s:String -> Maybe<&2, U32>

def is_hex source · line 419 · raw

@+c:U32 -> Bool

def hexv source · line 422 · raw

@+c:U32 -> U32

def dc.start source · line 442 · raw

Dc

def dc.size.semi source · line 445 · raw

@+n:U32 -> @semi:Bool -> Dc

def dc.size.cr source · line 452 · raw

@+n:U32 -> @+c:U32 -> @cr:Bool -> Dc

def dc.size.end source · line 459 · raw

@+n:U32 -> @+c:U32 -> @seen:Bool -> Dc

def dc.size source · line 467 · raw

@+acc:U32 -> @seen:Bool -> @+c:U32 -> @digit:Bool -> Dc

A size that would overflow 32 bits ends the digits, and size.end then refuses it.

def dc.ext.lf source · line 475 · raw

@+n:U32 -> @lf:Bool -> Dc

RFC 9112 §7.1.1: recipients ignore unknown chunk extensions; a bare LF is not CRLF.

def dc.ext source · line 482 · raw

@+n:U32 -> @+c:U32 -> @cr:Bool -> Dc

def dc.sized source · line 489 · raw

@+n:U32 -> @zero:Bool -> Dc

def dc.size.lf source · line 496 · raw

@+n:U32 -> @lf:Bool -> Dc

def dc.data source · line 504 · raw

@+k:U32 -> @+m:U32 -> Dc

k data bytes are left and m of them were just read.

def dc.pick source · line 507 · raw

@ok:Bool -> @next:Dc -> Dc

def dc.tr.hit source · line 515 · raw

@+j:U32 -> Dc

ponytail: trailer fields are dropped unparsed (§7.1.2 allows discarding)

def dc.tr source · line 518 · raw

@+j:U32 -> @+c:U32 -> @hit:Bool -> Dc

def dc.tr.want source · line 525 · raw

@+j:U32 -> U32

def dc.byte source · line 528 · raw

@h:Char -> U32

def dc.step source · line 533 · raw

@st:Dc -> @+c:U32 -> Dc

One byte c. Done and Bad never look at it, and a data byte is not inspected.

def dc.live source · line 554 · raw

@st:Dc -> Bool

def dc.feed source · line 575 · raw

@s:String -> @st:Dc -> @racc:String -> Dco

def chunk.hold source · line 600 · raw

@o:Dco -> Hold

def chunk.live source · line 622 · raw

@s:String -> Hold

def chunk.rest source · line 625 · raw

@o:Dco -> Maybe<&2, String>

def chunk.suffix source · line 647 · raw

@s:String -> Maybe<&2, String>

def chunk.decode.hold source · line 650 · raw

@h:Hold -> Maybe<&2, String>

def chunk.decode source · line 661 · raw

@s:String -> Maybe<&2, String>

def bytes.snd source · line 664 · raw

@r:Pair(0xec25e4adfb02e59e4b817801115988ee/bytes.Bytes, 0xec25e4adfb02e59e4b817801115988ee/bytes.Bytes) -> 0xec25e4adfb02e59e4b817801115988ee/bytes.Bytes

def found.at source · line 668 · raw

@+from:U32 -> @m:Maybe<&2, U32> -> Maybe<&2, U32>

def ck.next source · line 683 · raw

@+len:U32 -> @+i:U32 -> @+st:Dc -> @piece:0xec25e4adfb02e59e4b817801115988ee/bytes.Bytes -> @parts:List<&1, 0xec25e4adfb02e59e4b817801115988ee/bytes.Bytes> -> Pair(Bool, Cs)

def ck.data source · line 686 · raw

@+len:U32 -> @+i:U32 -> @+k:U32 -> @+m:U32 -> @parts:List<&1, 0xec25e4adfb02e59e4b817801115988ee/bytes.Bytes> -> @r:Pair(0xec25e4adfb02e59e4b817801115988ee/bytes.Bytes, 0xec25e4adfb02e59e4b817801115988ee/bytes.Bytes) -> Pair(Bool, Cs)

def ck.byte source · line 690 · raw

@+len:U32 -> @+i:U32 -> @st:Dc -> @parts:List<&1, 0xec25e4adfb02e59e4b817801115988ee/bytes.Bytes> -> @r:Pair(0xec25e4adfb02e59e4b817801115988ee/bytes.Bytes, Maybe<&2, U32>) -> Pair(Bool, Cs)

def ck.step source · line 698 · raw

@+len:U32 -> @cs:Cs -> Pair(Bool, Cs)

def ck.rest source · line 721 · raw

@st:Dc -> @parts:List<&1, 0xec25e4adfb02e59e4b817801115988ee/bytes.Bytes> -> @r:Pair(0xec25e4adfb02e59e4b817801115988ee/bytes.Bytes, 0xec25e4adfb02e59e4b817801115988ee/bytes.Bytes) -> Ck

def ck.end source · line 725 · raw

@+len:U32 -> @cs:Cs -> Ck

def ck.feed source · line 730 · raw

@f:Nat -> @+len:U32 -> @r:Pair(Bool, Cs) -> Ck

Each step reads at least one byte, so len steps are enough.

def ck source · line 743 · raw

@piece:0xec25e4adfb02e59e4b817801115988ee/bytes.Bytes -> @+st:Dc -> @parts:List<&1, 0xec25e4adfb02e59e4b817801115988ee/bytes.Bytes> -> Ck

def parse.res.cl.have source · line 747 · raw

@+rest:String -> @+k:Nat -> @short:Bool -> Hold

def parse.res.cl.k source · line 754 · raw

@+rest:String -> @+k:Nat -> Hold

def parse.res.cl.n source · line 757 · raw

@rest:String -> @n:Maybe<&2, U32> -> Hold

def parse.body.cl source · line 764 · raw

@+h:Map<&2, List<&2, String>> -> @rest:String -> @hascl:Bool -> Hold

def parse.body.chunked.eq source · line 772 · raw

@rest:String -> @ok:Bool -> Hold

RFC 9112 §6.3 (4): a request coding other than chunked cannot be framed.

def parse.body.chunked.val source · line 779 · raw

@te:String -> @rest:String -> Hold

def parse.body.chunked source · line 782 · raw

@+h:Map<&2, List<&2, String>> -> @rest:String -> @hascl:Bool -> Hold

def parse.body.te source · line 789 · raw

@+h:Map<&2, List<&2, String>> -> @rest:String -> @te:Bool -> Hold

def parse.body source · line 796 · raw

@+h:Map<&2, List<&2, String>> -> @rest:String -> Hold

def parse.finish source · line 807 · raw

@method:String -> @path:String -> @h:Map<&2, List<&2, String>> -> @body:Hold -> Got

def parse.host source · line 818 · raw

@method:String -> @path:String -> @+h:Map<&2, List<&2, String>> -> @rest:String -> @has:Bool -> Got

def parse.fields source · line 826 · raw

@method:String -> @path:String -> @rest:String -> @v11:Bool -> @fs:Maybe<&2, Map<&2, List<&2, String>>> -> Got

RFC 9112 §3.2: only HTTP/1.1 requires Host.

def target_ok source · line 833 · raw

@+p:String -> Bool

def parse.target source · line 836 · raw

@method:String -> @+path:String -> @headers:String -> @rest:String -> @v11:Bool -> @ok:Bool -> Got

def parse.ver source · line 843 · raw

@method:String -> @+path:String -> @+v:String -> @headers:String -> @rest:String -> @ok:Bool -> Got

def parse.empty_method source · line 850 · raw

@method:String -> @path:String -> @+v:String -> @headers:String -> @rest:String -> @empty:Bool -> Got

def parse.start3 source · line 857 · raw

@mpv:Pair(String, Pair(String, String)) -> @headers:String -> @rest:String -> Got

def parse.lines source · line 861 · raw

@lr:Pair(String, String) -> @rest:String -> Got

def parse.head source · line 866 · raw

@+head:String -> @rest:String -> @whole:Bool -> Got

def parse.of source · line 873 · raw

@hb:Pair(String, Pair(String, Bool)) -> Got

def parse.got source · line 878 · raw

@+raw:String -> Got

serve reads until this is not GotMore.

def parse.req source · line 882 · raw

@g:Got -> Maybe<&1, Req>

def parse source · line 893 · raw

@raw:String -> Maybe<&1, Req>

def parse.res.cl source · line 896 · raw

@+h:Map<&2, List<&2, String>> -> @rest:String -> @hascl:Bool -> Hold

def parse.res.chunked.eq source · line 903 · raw

@rest:String -> @ok:Bool -> Hold

def parse.res.chunked.val source · line 910 · raw

@te:String -> @rest:String -> Hold

def parse.res.chunked source · line 913 · raw

@+h:Map<&2, List<&2, String>> -> @rest:String -> @hascl:Bool -> Hold

def parse.res.te source · line 920 · raw

@+h:Map<&2, List<&2, String>> -> @rest:String -> @te:Bool -> Hold

def parse.res.body source · line 927 · raw

@+h:Map<&2, List<&2, String>> -> @rest:String -> Hold

def frame.cut source · line 937 · raw

@closed:Bool -> Frame

RFC 9112 §8: a message cut short by close is incomplete, not valid.

def frame.wait source · line 944 · raw

@res:Res -> @wait:Bool -> Frame

def frame.done source · line 951 · raw

@status:U32 -> @h:Map<&2, List<&2, String>> -> @body:Hold -> @+closed:Bool -> @open:Bool -> Frame

def frame.open source · line 963 · raw

@+h:Map<&2, List<&2, String>> -> Bool

RFC 9112 §6.3 (8): no TE and no CL ⇒ the body runs until the server closes.

def frame.nobody source · line 967 · raw

@+status:U32 -> @head:Bool -> Bool

RFC 9112 §6.3 (1): HEAD, 1xx, 204 and 304 responses end at the blank line.

def frame.interim source · line 971 · raw

@+status:U32 -> Bool

101 is the final response. Other 1xx are interim; a final response follows.

def frame.status source · line 974 · raw

@status:U32 -> @+h:Map<&2, List<&2, String>> -> @rest:String -> @closed:Bool -> @nobody:Bool -> Frame

def parse.res.fields source · line 981 · raw

@+status:U32 -> @rest:String -> @fs:Maybe<&2, Map<&2, List<&2, String>>> -> @closed:Bool -> @head:Bool -> Frame

def parse.res.num source · line 988 · raw

@code:Maybe<&2, U32> -> @headers:String -> @rest:String -> @closed:Bool -> @head:Bool -> Frame

def parse.res.ver source · line 995 · raw

@code:String -> @headers:String -> @rest:String -> @closed:Bool -> @head:Bool -> @ok:Bool -> Frame

def parse.res.start3 source · line 1002 · raw

@mpv:Pair(String, Pair(String, String)) -> @headers:String -> @rest:String -> @closed:Bool -> @head:Bool -> Frame

def parse.res.lines source · line 1006 · raw

@lr:Pair(String, String) -> @rest:String -> @closed:Bool -> @head:Bool -> Frame

def parse.res.blank source · line 1010 · raw

@hd:String -> @rest:String -> @+closed:Bool -> @head:Bool -> @ok:Bool -> Frame

def parse.res.of source · line 1017 · raw

@hb:Pair(String, String) -> @closed:Bool -> @head:Bool -> Frame

def frame.lead.if source · line 1026 · raw

@rest:String -> @interim:Bool -> Lead

def frame.lead.num source · line 1033 · raw

@n:Maybe<&2, U32> -> @rest:String -> Lead

def frame.lead.code source · line 1040 · raw

@mpv:Pair(String, Pair(String, String)) -> @rest:String -> Lead

def frame.lead.lines source · line 1044 · raw

@xs:List<&2, String> -> @rest:String -> Lead

def frame.lead.blank source · line 1051 · raw

@+hd:String -> @rest:String -> @ok:Bool -> Lead

def frame.lead source · line 1058 · raw

@hb:Pair(String, String) -> Lead

def frame.at.cont source · line 1062 · raw

@+raw:String -> @lead:Lead -> String

def frame.at.zero.go source · line 1071 · raw

@+raw:String -> @closed:Bool -> @head:Bool -> @lead:Lead -> Frame

def frame.at.zero.of source · line 1080 · raw

@+raw:String -> @closed:Bool -> @head:Bool -> Frame

def frame.at.pos.do source · line 1083 · raw

@f:Nat -> @+raw:String -> @closed:Bool -> @head:Bool -> @hb:Pair(String, String) -> @lead:Lead -> Frame

def frame.at.zero source · line 1102 · raw

@+raw:String -> @closed:Bool -> @head:Bool -> Frame

def frame.at source · line 1106 · raw

@fuel:Nat -> @+raw:String -> @closed:Bool -> @head:Bool -> Frame

ponytail: 8 interim responses; raise the fuel if a server sends more

def frame source · line 1114 · raw

@raw:String -> @closed:Bool -> @head:Bool -> Frame

frame(bytes so far, server closed?, request was HEAD?)

def frame.res source · line 1117 · raw

@f:Frame -> Maybe<&1, Res>

def parse_res source · line 1126 · raw

@raw:String -> Maybe<&1, Res>

def res_fields.res source · line 1129 · raw

@res:Res -> @k:String -> List<&2, String>

def res_fields source · line 1133 · raw

@m:Maybe<&1, Res> -> @k:String -> List<&2, String>

def rb.cl source · line 1149 · raw

@n:Maybe<&2, U32> -> Maybe<&2, Rb>

def rb.te source · line 1156 · raw

@+h:Map<&2, List<&2, String>> -> @cl:Bool -> Maybe<&2, Rb>

def rb.len source · line 1163 · raw

@+h:Map<&2, List<&2, String>> -> @te:Bool -> Maybe<&2, Rb>

def rb.of source · line 1171 · raw

@+h:Map<&2, List<&2, String>> -> @nobody:Bool -> Maybe<&2, Rb>

RFC 9112 §6.3: how the body of this response ends. None: it cannot be framed.

def rb.len.cut source · line 1182 · raw

@parts:List<&1, 0xec25e4adfb02e59e4b817801115988ee/bytes.Bytes> -> @+len:U32 -> @+left:U32 -> @r:Pair(0xec25e4adfb02e59e4b817801115988ee/bytes.Bytes, 0xec25e4adfb02e59e4b817801115988ee/bytes.Bytes) -> Bf

def rb.len.have source · line 1186 · raw

@short:Bool -> @+left:U32 -> @parts:List<&1, 0xec25e4adfb02e59e4b817801115988ee/bytes.Bytes> -> @+len:U32 -> @piece:0xec25e4adfb02e59e4b817801115988ee/bytes.Bytes -> Bf

def rb.chunk source · line 1193 · raw

@c:Ck -> Bf

def rb.feed source · line 1216 · raw

@rb:Rb -> @parts:List<&1, 0xec25e4adfb02e59e4b817801115988ee/bytes.Bytes> -> @piece:0xec25e4adfb02e59e4b817801115988ee/bytes.Bytes -> Bf

The body bytes in piece, added to parts.

def rb.eof source · line 1231 · raw

@rb:Rb -> Bool

RFC 9112 §8: only a close-delimited body may end at close.

def rb.body source · line 1244 · raw

@parts:List<&1, 0xec25e4adfb02e59e4b817801115988ee/bytes.Bytes> -> 0xec25e4adfb02e59e4b817801115988ee/bytes.Bytes

def hs.final source · line 1255 · raw

@+status:U32 -> @+h:Map<&2, List<&2, String>> -> @rest:0xec25e4adfb02e59e4b817801115988ee/bytes.Bytes -> @m:Maybe<&2, Rb> -> Hs

def hs.skip source · line 1262 · raw

@more:Bool -> @+k:U32 -> @rest:0xec25e4adfb02e59e4b817801115988ee/bytes.Bytes -> Hs

def hs.pick source · line 1269 · raw

@interim:Bool -> @+head:Bool -> @+k:U32 -> @+status:U32 -> @+h:Map<&2, List<&2, String>> -> @rest:0xec25e4adfb02e59e4b817801115988ee/bytes.Bytes -> Hs

def hs.res source · line 1276 · raw

@+head:Bool -> @+k:U32 -> @rest:0xec25e4adfb02e59e4b817801115988ee/bytes.Bytes -> @res:Res -> Hs

def hs.parsed source · line 1281 · raw

@+head:Bool -> @+k:U32 -> @rest:0xec25e4adfb02e59e4b817801115988ee/bytes.Bytes -> @f:Frame -> Hs

The head alone, framed as a HEAD response so it stops at the blank line.

def hs.split source · line 1290 · raw

@+head:Bool -> @+k:U32 -> @+hlen:U32 -> @+len:U32 -> @r:Pair(0xec25e4adfb02e59e4b817801115988ee/bytes.Bytes, 0xec25e4adfb02e59e4b817801115988ee/bytes.Bytes) -> Hs

def hs.hit source · line 1294 · raw

@+head:Bool -> @+k:U32 -> @+len:U32 -> @buf:0xec25e4adfb02e59e4b817801115988ee/bytes.Bytes -> @at:Maybe<&2, U32> -> Hs

def hs.seek.of source · line 1302 · raw

@+head:Bool -> @+k:U32 -> @+len:U32 -> @+from:U32 -> @buf:0xec25e4adfb02e59e4b817801115988ee/bytes.Bytes -> @r:Pair(0xec25e4adfb02e59e4b817801115988ee/bytes.Bytes, Maybe<&2, U32>) -> Hs

def hs.seek source · line 1306 · raw

@+head:Bool -> @+k:U32 -> @+len:U32 -> @+from:U32 -> @r:Pair(0xec25e4adfb02e59e4b817801115988ee/bytes.Bytes, 0xec25e4adfb02e59e4b817801115988ee/bytes.Bytes) -> Hs

def hs.step source · line 1310 · raw

@+head:Bool -> @st:Hs -> Hs

def hs.scan source · line 1323 · raw

@fuel:Nat -> @+head:Bool -> @st:Hs -> Hs

Each step ends the scan or passes one interim head, and at most 8 interim heads pass.

def hs.more source · line 1339 · raw

@+head:Bool -> @+k:U32 -> @buf:0xec25e4adfb02e59e4b817801115988ee/bytes.Bytes -> @piece:0xec25e4adfb02e59e4b817801115988ee/bytes.Bytes -> Hs

piece joins buf; only the new bytes, and the 3 before them, can finish the blank line.

def fetch.max source · line 1344 · raw

Nat

Untrusted servers must not grow the buffer without bound.

def rv.start source · line 1360 · raw

Rv

def rv.whole source · line 1363 · raw

@res:Res -> @b:0xec25e4adfb02e59e4b817801115988ee/bytes.Bytes -> @rest:Maybe<&1, 0xec25e4adfb02e59e4b817801115988ee/bytes.Bytes> -> Rt

def rv.done source · line 1367 · raw

@res:Res -> @parts:List<&1, 0xec25e4adfb02e59e4b817801115988ee/bytes.Bytes> -> @rest:Maybe<&1, 0xec25e4adfb02e59e4b817801115988ee/bytes.Bytes> -> Rt

def rl.put.of source · line 1370 · raw

@+total:U32 -> @+len:U32 -> @r:Pair(Array<U32>, Array<U32>) -> Pair(0xec25e4adfb02e59e4b817801115988ee/bytes.Bytes, 0xec25e4adfb02e59e4b817801115988ee/bytes.Bytes)

def rl.put source · line 1375 · raw

@+m:U32 -> @+left:U32 -> @body:0xec25e4adfb02e59e4b817801115988ee/bytes.Bytes -> @piece:0xec25e4adfb02e59e4b817801115988ee/bytes.Bytes -> Pair(0xec25e4adfb02e59e4b817801115988ee/bytes.Bytes, 0xec25e4adfb02e59e4b817801115988ee/bytes.Bytes)

The first m bytes of piece, written into body after the total - left bytes already there.

def rl.fed source · line 1380 · raw

@short:Bool -> @res:Res -> @+left:U32 -> @+len:U32 -> @r:Pair(0xec25e4adfb02e59e4b817801115988ee/bytes.Bytes, 0xec25e4adfb02e59e4b817801115988ee/bytes.Bytes) -> Rt

def rl.feed source · line 1389 · raw

@res:Res -> @+left:U32 -> @body:0xec25e4adfb02e59e4b817801115988ee/bytes.Bytes -> @piece:0xec25e4adfb02e59e4b817801115988ee/bytes.Bytes -> Rt

def rv.fed source · line 1393 · raw

@res:Res -> @bf:Bf -> Rt

def rb.buf source · line 1408 · raw

@rb:Rb -> Maybe<&2, U32>

Some{left}: a Content-Length body small enough to allocate up front. Larger ones fail at the fetch cap.

def rv.body source · line 1421 · raw

@m:Maybe<&2, U32> -> @res:Res -> @rb:Rb -> @rest:0xec25e4adfb02e59e4b817801115988ee/bytes.Bytes -> Rt

def rv.head source · line 1428 · raw

@hs:Hs -> Rt

def rv.eof source · line 1439 · raw

@res:Res -> @parts:List<&1, 0xec25e4adfb02e59e4b817801115988ee/bytes.Bytes> -> @ok:Bool -> Rt

def rv.step source · line 1447 · raw

@closed:Bool -> @+head:Bool -> @rv:Rv -> @piece:0xec25e4adfb02e59e4b817801115988ee/bytes.Bytes -> Rt

One read: piece, or the server closed (RFC 9112 §8: a message cut short is not a message).

def rv.end source · line 1466 · raw

@closed:Bool -> @+head:Bool -> @t:Rt -> Rt

def rv.go source · line 1479 · raw

@xs:List<&2, String> -> @closed:Bool -> @+head:Bool -> @t:Rt -> Rt

def rt.frame source · line 1492 · raw

@t:Rt -> Frame

def res.frame source · line 1502 · raw

@xs:List<&2, String> -> @closed:Bool -> @+head:Bool -> Frame

What the read loop makes of these pieces, then a close when closed is set.

def rt.rest source · line 1505 · raw

@t:Rt -> Maybe<&1, 0xec25e4adfb02e59e4b817801115988ee/bytes.Bytes>

def after.of source · line 1514 · raw

@m:Maybe<&1, 0xec25e4adfb02e59e4b817801115988ee/bytes.Bytes> -> Maybe<&2, String>

def after source · line 1522 · raw

@+raw:String -> @+head:Bool -> Maybe<&2, String>

Bytes after a complete self-delimited message. None if it is not one yet.

def req.v11.ver source · line 1525 · raw

@mpv:Pair(String, Pair(String, String)) -> Bool

def req.v11.line source · line 1529 · raw

@+line:String -> Bool

def req.v11.lines source · line 1532 · raw

@xs:List<&2, String> -> Bool

def req.v11.pick source · line 1539 · raw

@+head:String -> @ok:Bool -> Bool

def req.v11.of source · line 1546 · raw

@hb:Pair(String, String) -> Bool

def req.v11 source · line 1550 · raw

@+raw:String -> Bool

def req.conn_close source · line 1553 · raw

@+headers:Map<&2, List<&2, String>> -> Bool

def res.conn_close source · line 1556 · raw

@+headers:Map<&2, List<&2, String>> -> Bool

def serve.fail_close source · line 1559 · raw

@+status:U32 -> Bool

def serve.keep.ok source · line 1562 · raw

@fail:Bool -> @res_close:Bool -> Bool

def serve.keep.v11 source · line 1569 · raw

@v11:Bool -> @+req_close:Bool -> @+status:U32 -> @res_close:Bool -> Bool

def serve.keep source · line 1580 · raw

@+headers:Map<&2, List<&2, String>> -> @v11:Bool -> @+status:U32 -> @+res:Map<&2, List<&2, String>> -> Bool

def again.keep source · line 1584 · raw

@close:Bool -> @x:0xec25e4adfb02e59e4b817801115988ee/bytes.Bytes -> Maybe<&1, 0xec25e4adfb02e59e4b817801115988ee/bytes.Bytes>

def again.rest source · line 1591 · raw

@close:Bool -> @rest:Maybe<&1, 0xec25e4adfb02e59e4b817801115988ee/bytes.Bytes> -> Maybe<&1, 0xec25e4adfb02e59e4b817801115988ee/bytes.Bytes>

def again source · line 1600 · raw

@close:Bool -> @+h:Map<&2, List<&2, String>> -> @rest:Maybe<&1, 0xec25e4adfb02e59e4b817801115988ee/bytes.Bytes> -> Maybe<&1, 0xec25e4adfb02e59e4b817801115988ee/bytes.Bytes>

The bytes past the response when the socket can take another request: the request did not ask to close, the response is self-delimited, and the peer did not say close.

def res_body.res source · line 1607 · raw

@res:Res -> 0xec25e4adfb02e59e4b817801115988ee/bytes.Bytes

def res_body source · line 1611 · raw

@m:Maybe<&1, Res> -> 0xec25e4adfb02e59e4b817801115988ee/bytes.Bytes

def text source · line 1618 · raw

@res:Res -> String

def json source · line 1622 · raw

@res:Res -> Maybe<&1, 0x419ec39802735c4664960ab4b9d962e5/json.Val>

UTF-8 is checked, not repaired: bad UTF-8 in a string gives None (RFC 8259 §8.1).

def got_body.req source · line 1625 · raw

@req:Req -> 0xec25e4adfb02e59e4b817801115988ee/bytes.Bytes

def got_body source · line 1629 · raw

@m:Maybe<&1, Req> -> 0xec25e4adfb02e59e4b817801115988ee/bytes.Bytes

def body.of source · line 1636 · raw

@hb:Pair(String, String) -> String

def body source · line 1640 · raw

@s:String -> String

def headers_lines source · line 1643 · raw

@+k:String -> @vs:List<&2, String> -> @acc:String -> String

def headers_block.go source · line 1650 · raw

@xs:List<&2, Sigma<&2, &2, String, _ => List<&2, String>>> -> @acc:String -> String

def headers_block source · line 1657 · raw

@h:Map<&2, List<&2, String>> -> String

def reasons source · line 1664 · raw

List<&2, Reason>

def reason.go source · line 1671 · raw

@xs:List<&2, Reason> -> @+status:U32 -> String

def reason source · line 1678 · raw

@+status:U32 -> String

def response source · line 1681 · raw

@+status:U32 -> @headers:Map<&2, List<&2, String>> -> @body:String -> String

def encode.body source · line 1684 · raw

@head:Bool -> @top:0xec25e4adfb02e59e4b817801115988ee/bytes.Bytes -> @body:0xec25e4adfb02e59e4b817801115988ee/bytes.Bytes -> 0xec25e4adfb02e59e4b817801115988ee/bytes.Bytes

def encode.len source · line 1691 · raw

@+status:U32 -> @headers:Map<&2, List<&2, String>> -> @head:Bool -> @body:0xec25e4adfb02e59e4b817801115988ee/bytes.Bytes -> 0xec25e4adfb02e59e4b817801115988ee/bytes.Bytes

def encode.pick source · line 1696 · raw

@+status:U32 -> @headers:Map<&2, List<&2, String>> -> @body:0xec25e4adfb02e59e4b817801115988ee/bytes.Bytes -> @head:Bool -> @nobody:Bool -> 0xec25e4adfb02e59e4b817801115988ee/bytes.Bytes

RFC 9110 §6.4.1, §8.6: 1xx, 204 and 304 have no body; HEAD gets the length but no body.

def encode.on source · line 1703 · raw

@r:Res -> @head:Bool -> 0xec25e4adfb02e59e4b817801115988ee/bytes.Bytes

def encode source · line 1707 · raw

@r:Res -> 0xec25e4adfb02e59e4b817801115988ee/bytes.Bytes

def request source · line 1710 · raw

@method:String -> @path:String -> @headers:Map<&2, List<&2, String>> -> @body:String -> String

def req.reserved source · line 1713 · raw

@+k:String -> Bool

def req.put.one source · line 1716 · raw

@m:Map<&2, List<&2, String>> -> @+k:String -> @vs:List<&2, String> -> @skip:Bool -> Map<&2, List<&2, String>>

def req.put source · line 1723 · raw

@xs:List<&2, Sigma<&2, &2, String, _ => List<&2, String>>> -> @m:Map<&2, List<&2, String>> -> Map<&2, List<&2, String>>

def req.cl source · line 1732 · raw

@+m:Map<&2, List<&2, String>> -> @+method:String -> @+len:U32 -> Map<&2, List<&2, String>>

RFC 9110 §8.6: no Content-Length on a bodiless request whose method gives a body no meaning.

def encode_req.word source · line 1738 · raw

@close:Bool -> String

Caller headers are lowercased so they cannot duplicate ours; host, connection, content-length and transfer-encoding are always ours (no smuggling through them).

def encode_req.on source · line 1745 · raw

@+method:String -> @target:String -> @host:String -> @headers:Map<&2, List<&2, String>> -> @body:0xec25e4adfb02e59e4b817801115988ee/bytes.Bytes -> @close:Bool -> 0xec25e4adfb02e59e4b817801115988ee/bytes.Bytes

def encode_req source · line 1750 · raw

@+method:String -> @target:String -> @host:String -> @headers:Map<&2, List<&2, String>> -> @body:0xec25e4adfb02e59e4b817801115988ee/bytes.Bytes -> 0xec25e4adfb02e59e4b817801115988ee/bytes.Bytes

def redirect.code source · line 1760 · raw

@+s:U32 -> Bool

def redirect.origin source · line 1763 · raw

@a:0x1f2d80f53f971b16c6de6a65cb1918ae/url.Abs -> String

def redirect.del source · line 1767 · raw

@ks:List<&2, String> -> @m:Map<&2, List<&2, String>> -> Map<&2, List<&2, String>>

def redirect.hdrs source · line 1774 · raw

@+h:Map<&2, List<&2, String>> -> @drop:Bool -> @cross:Bool -> Map<&2, List<&2, String>>

def redirect.body source · line 1781 · raw

@drop:Bool -> @body:0xec25e4adfb02e59e4b817801115988ee/bytes.Bytes -> 0xec25e4adfb02e59e4b817801115988ee/bytes.Bytes

303 turns any method but HEAD into GET; 301 and 302 turn POST into GET; 307 and 308 keep method and body. A GET carries no body or body headers. Credentials do not follow a hop to another origin.

def redirect.to source · line 1788 · raw

@+status:U32 -> @+method:String -> @+from:0x1f2d80f53f971b16c6de6a65cb1918ae/url.Abs -> @headers:Map<&2, List<&2, String>> -> @body:0xec25e4adfb02e59e4b817801115988ee/bytes.Bytes -> @next:Maybe<&2, 0x1f2d80f53f971b16c6de6a65cb1918ae/url.Abs> -> Maybe<&1, Hop>

def redirect.hop source · line 1796 · raw

@status:U32 -> @h:Hop -> @loc:String -> Maybe<&1, Hop>

def redirect.if source · line 1800 · raw

@status:U32 -> @h:Hop -> @loc:String -> @ok:Bool -> Maybe<&1, Hop>

def redirect source · line 1808 · raw

@+status:U32 -> @+headers:Map<&2, List<&2, String>> -> @h:Hop -> Maybe<&1, Hop>

The next request after a response, or None when it is not a redirect we follow.

def jar.new source · line 1824 · raw

@now:0x0d2a146cd1cbaedf76cc532bcd3594b0/time.Instant -> Jar

def jar.cookies source · line 1827 · raw

@j:Jar -> List<&2, Cookie>

def cookie.live.at source · line 1831 · raw

@+now:0x0d2a146cd1cbaedf76cc532bcd3594b0/time.Instant -> @e:Maybe<&2, 0x0d2a146cd1cbaedf76cc532bcd3594b0/time.Instant> -> Bool

def cookie.live source · line 1839 · raw

@+now:0x0d2a146cd1cbaedf76cc532bcd3594b0/time.Instant -> @c:Cookie -> Bool

Alive at now: no expiry, or an expiry after now.

def jar.live source · line 1843 · raw

@cs:List<&2, Cookie> -> @+now:0x0d2a146cd1cbaedf76cc532bcd3594b0/time.Instant -> List<&2, Cookie>

def jar.at source · line 1851 · raw

@j:Jar -> @+now:0x0d2a146cd1cbaedf76cc532bcd3594b0/time.Instant -> Jar

The jar at a later time: cookies expired by now are evicted (§5.7).

def cookie.cut.found source · line 1855 · raw

@r:Pair(String, String) -> Pair(String, Pair(String, Bool))

def cookie.cut.go source · line 1860 · raw

@s:String -> @+c:U32 -> @acc:String -> @hit:Bool -> Pair(String, Pair(String, Bool))

hit: the last char pushed onto acc was c.

def cookie.cut source · line 1876 · raw

@s:String -> @+c:U32 -> Pair(String, Pair(String, Bool))

s split at its first c: before, after, and whether c was there.

def cookie.fst source · line 1879 · raw

@r:Pair(String, Pair(String, Bool)) -> String

def cookie.target_path source · line 1884 · raw

@t:String -> String

The path of an origin-form target: the part before "?".

def cookie.over source · line 1888 · raw

@s:String -> @+n:U32 -> Bool

Longer than n octets.

def cookie.ctl source · line 1896 · raw

@s:String -> Bool

%x00-08 / %x0A-1F / %x7F: control characters other than HTAB.

def cookie.ascii source · line 1903 · raw

@s:String -> Bool

def cookie.ip4 source · line 1910 · raw

@s:String -> Bool

def cookie.ip source · line 1918 · raw

@+h:String -> Bool

An IP literal rather than a host name: IPv6 has a colon, IPv4 is digits and dots.

def cookie.domain_match source · line 1922 · raw

@+s:String -> @+d:String -> Bool

§5.1.3: s is d, or a host name under d on a label boundary.

def cookie.up source · line 1926 · raw

@rs:String -> String

A reversed path with its last segment and slash dropped.

def cookie.default_path source · line 1936 · raw

@+p:String -> String

§5.1.4: the request path up to its last "/", or "/".

def cookie.path_match source · line 1941 · raw

@+p:String -> @+c:String -> Bool

§5.1.4: request path p path-matches cookie path c.

def cookie.date.delim source · line 1951 · raw

@+c:U32 -> Bool

def cookie.date.push source · line 1954 · raw

@acc:String -> @ts:List<&2, String> -> List<&2, String>

def cookie.date.step source · line 1961 · raw

@d:Bool -> @+c:U32 -> @acc:String -> @ts:List<&2, String> -> Pair(String, List<&2, String>)

def cookie.date.tokens source · line 1969 · raw

@s:String -> @st:Pair(String, List<&2, String>) -> List<&2, String>

The date-tokens, last first. st: the token so far (reversed) and the tokens before it.

def cookie.date.head source · line 1978 · raw

@+s:String -> Bool

def cookie.date.run source · line 1986 · raw

@s:String -> @d:Bool -> @+n:U32 -> @+acc:U32 -> Pair(U32, Pair(U32, String))

The digits at the start of s: (count, value, rest). d: s starts with a digit.

def cookie.date.within source · line 1997 · raw

@r:Pair(U32, Pair(U32, String)) -> @+lo:U32 -> @+hi:U32 -> Maybe<&1, Pair(U32, String)>

def cookie.date.num source · line 2002 · raw

@+s:String -> @+lo:U32 -> @+hi:U32 -> Maybe<&1, Pair(U32, String)>

lo to hi digits and what follows them, which does not start with a digit.

def cookie.date.val source · line 2005 · raw

@m:Maybe<&1, Pair(U32, String)> -> Maybe<&2, U32>

def cookie.date.colon source · line 2012 · raw

@s:String -> Maybe<&2, String>

def cookie.date.sec source · line 2021 · raw

@+h:U32 -> @+m:U32 -> @r:Maybe<&1, Pair(U32, String)> -> Maybe<&2, Hms>

def cookie.date.min.c source · line 2028 · raw

@+h:U32 -> @+m:U32 -> @c:Maybe<&2, String> -> Maybe<&2, Hms>

def cookie.date.min source · line 2035 · raw

@+h:U32 -> @r:Maybe<&1, Pair(U32, String)> -> Maybe<&2, Hms>

def cookie.date.hour.c source · line 2042 · raw

@+h:U32 -> @c:Maybe<&2, String> -> Maybe<&2, Hms>

def cookie.date.hour source · line 2049 · raw

@r:Maybe<&1, Pair(U32, String)> -> Maybe<&2, Hms>

def cookie.date.time source · line 2057 · raw

@+tok:String -> Maybe<&2, Hms>

hms-time: 1*2DIGIT ":" 1*2DIGIT ":" 1*2DIGIT, then anything but a digit.

def cookie.date.month.go source · line 2060 · raw

@xs:List<&2, String> -> @+w:String -> @+i:U32 -> Maybe<&2, U32>

def cookie.date.month source · line 2068 · raw

@+tok:String -> Maybe<&2, U32>

The month named by the first three letters, from 1.

def cookie.date.year source · line 2072 · raw

@y:Maybe<&2, U32> -> @+tok:String -> @t:Maybe<&2, Hms> -> @d:Maybe<&2, U32> -> @m:Maybe<&2, U32> -> Cdate

Each try* below: the flag is set, so go on; or the token matches, so stop; or go on.

def cookie.date.month.got source · line 2079 · raw

@g:Maybe<&2, U32> -> @+tok:String -> @t:Maybe<&2, Hms> -> @d:Maybe<&2, U32> -> @y:Maybe<&2, U32> -> Cdate

def cookie.date.month.try source · line 2086 · raw

@m:Maybe<&2, U32> -> @+tok:String -> @t:Maybe<&2, Hms> -> @d:Maybe<&2, U32> -> @y:Maybe<&2, U32> -> Cdate

def cookie.date.day.got source · line 2093 · raw

@g:Maybe<&2, U32> -> @+tok:String -> @t:Maybe<&2, Hms> -> @m:Maybe<&2, U32> -> @y:Maybe<&2, U32> -> Cdate

def cookie.date.day.try source · line 2100 · raw

@d:Maybe<&2, U32> -> @+tok:String -> @t:Maybe<&2, Hms> -> @m:Maybe<&2, U32> -> @y:Maybe<&2, U32> -> Cdate

def cookie.date.time.got source · line 2107 · raw

@g:Maybe<&2, Hms> -> @+tok:String -> @d:Maybe<&2, U32> -> @m:Maybe<&2, U32> -> @y:Maybe<&2, U32> -> Cdate

def cookie.date.time.try source · line 2114 · raw

@t:Maybe<&2, Hms> -> @+tok:String -> @d:Maybe<&2, U32> -> @m:Maybe<&2, U32> -> @y:Maybe<&2, U32> -> Cdate

def cookie.date.fold source · line 2121 · raw

@ts:List<&2, String> -> @st:Cdate -> Cdate

def cookie.date.fix source · line 2130 · raw

@+y:U32 -> U32

70–99 are 19xx, 0–69 are 20xx.

def cookie.date.at source · line 2133 · raw

@+y:U32 -> @+d:U32 -> @mo:U32 -> @h:U32 -> @mi:U32 -> @s:U32 -> Maybe<&2, 0x0d2a146cd1cbaedf76cc532bcd3594b0/time.Instant>

def cookie.date.fin source · line 2136 · raw

@st:Cdate -> Maybe<&2, 0x0d2a146cd1cbaedf76cc532bcd3594b0/time.Instant>

def cookie.date source · line 2145 · raw

@s:String -> Maybe<&2, 0x0d2a146cd1cbaedf76cc532bcd3594b0/time.Instant>

§5.1.1: a cookie-date such as "Sun, 06 Nov 1994 08:49:37 GMT" or "Thu, 01-Jan-70 00:00:01 GMT". Time.mk refuses a day past the month's end and a time past 23:59:59.

def cookie.cav source · line 2153 · raw

Cav

def cookie.limit source · line 2157 · raw

U32

§5.5: 400 days, the longest a cookie lives.

def cookie.later source · line 2160 · raw

@+now:0x0d2a146cd1cbaedf76cc532bcd3594b0/time.Instant -> @+secs:U32 -> 0x0d2a146cd1cbaedf76cc532bcd3594b0/time.Instant

def cookie.expires.cap source · line 2163 · raw

@+now:0x0d2a146cd1cbaedf76cc532bcd3594b0/time.Instant -> @m:Maybe<&2, 0x0d2a146cd1cbaedf76cc532bcd3594b0/time.Instant> -> Maybe<&2, 0x0d2a146cd1cbaedf76cc532bcd3594b0/time.Instant>

def cookie.max_age.zero source · line 2171 · raw

@m:Maybe<&2, U32> -> Maybe<&2, U32>

def cookie.max_age.nz source · line 2178 · raw

@s:String -> String

def cookie.max_age.cap source · line 2188 · raw

@long:Bool -> @m:Maybe<&2, U32> -> Maybe<&2, U32>

More than 9 significant digits is past the limit (and would overflow parse_u32).

def cookie.max_age.secs source · line 2195 · raw

@+v:String -> @neg:Bool -> Maybe<&2, U32>

def cookie.max_age.at source · line 2203 · raw

@+now:0x0d2a146cd1cbaedf76cc532bcd3594b0/time.Instant -> @m:Maybe<&2, U32> -> Maybe<&2, 0x0d2a146cd1cbaedf76cc532bcd3594b0/time.Instant>

Zero or less is the earliest time, so the cookie is already expired.

def cookie.max_age source · line 2211 · raw

@+v:String -> Maybe<&2, U32>

§5.6.2: DIGIT*, or "-" and DIGIT*. Anything else is ignored.

def cookie.same_site source · line 2214 · raw

@+v:String -> String

def cookie.av.kind source · line 2228 · raw

@+k:String -> Av

def cookie.av.put source · line 2232 · raw

@k:Av -> @a:Cav -> @+v:String -> Cav

An Expires or Max-Age that does not parse leaves the earlier one. A leading dot of Domain is dropped.

def cookie.av source · line 2252 · raw

@+a:Cav -> @kv:Pair(String, Pair(String, Bool)) -> Cav

§5.6: name and value trimmed; a value over 1024 octets drops the attribute.

def cookie.avs source · line 2257 · raw

@xs:List<&2, String> -> @a:Cav -> Cav

def cookie.nv source · line 2265 · raw

@r:Pair(String, Pair(String, Bool)) -> Pair(String, String)

§5.6: with no "=", the name is empty and the pair is the value.

def cookie.prefixed source · line 2273 · raw

@+s:String -> @+p:String -> Bool

def cookie.domain.of source · line 2279 · raw

@+host:String -> @+d:String -> Maybe<&1, Pair(String, Bool)>

§5.7 steps 8–10: (domain, host-only), or None to ignore the cookie. ponytail: the public-suffix check knows single-label suffixes only (com, org, localhost). Multi-label ones (co.uk, github.io) need the publicsuffix.org list; ship it as data when a caller needs it.

def cookie.path.of source · line 2286 · raw

@p:Maybe<&2, String> -> @+req:String -> String

def cookie.make.dm source · line 2294 · raw

@dm:Maybe<&1, Pair(String, Bool)> -> @+name:String -> @+value:String -> @+path:String -> @has_path:Bool -> @+secure:Bool -> @http_only:Bool -> @+same_site:String -> @expiry:Maybe<&2, 0x0d2a146cd1cbaedf76cc532bcd3594b0/time.Instant> -> @https:Bool -> Maybe<&2, Cookie>

§5.7 steps 12–20: Secure needs https; SameSite=None needs Secure; the __Secure- and __Host- prefixes.

def cookie.expiry source · line 2306 · raw

@+now:0x0d2a146cd1cbaedf76cc532bcd3594b0/time.Instant -> @m:Maybe<&2, U32> -> @e:Maybe<&2, 0x0d2a146cd1cbaedf76cc532bcd3594b0/time.Instant> -> Maybe<&2, 0x0d2a146cd1cbaedf76cc532bcd3594b0/time.Instant>

Max-Age wins over Expires, whatever their order (§5.7 step 6). Both count from now.

def cookie.make source · line 2309 · raw

@+now:0x0d2a146cd1cbaedf76cc532bcd3594b0/time.Instant -> @a:0x1f2d80f53f971b16c6de6a65cb1918ae/url.Abs -> @+name:String -> @+value:String -> @c:Cav -> Maybe<&2, Cookie>

def cookie.parse.nv source · line 2315 · raw

@+now:0x0d2a146cd1cbaedf76cc532bcd3594b0/time.Instant -> @a:0x1f2d80f53f971b16c6de6a65cb1918ae/url.Abs -> @nv:Pair(String, String) -> @avs:List<&2, String> -> Maybe<&2, Cookie>

An empty name and value, or more than 4096 octets of them, is ignored.

def cookie.parse.go source · line 2319 · raw

@+now:0x0d2a146cd1cbaedf76cc532bcd3594b0/time.Instant -> @a:0x1f2d80f53f971b16c6de6a65cb1918ae/url.Abs -> @xs:List<&2, String> -> Maybe<&2, Cookie>

def cookie.parse source · line 2327 · raw

@+now:0x0d2a146cd1cbaedf76cc532bcd3594b0/time.Instant -> @a:0x1f2d80f53f971b16c6de6a65cb1918ae/url.Abs -> @+line:String -> Maybe<&2, Cookie>

§5.6 and §5.7: one Set-Cookie value received from a at now, or None when it is ignored.

def cookie.https source · line 2330 · raw

@a:0x1f2d80f53f971b16c6de6a65cb1918ae/url.Abs -> Bool

def cookie.secure source · line 2334 · raw

@c:Cookie -> Bool

def cookie.same source · line 2339 · raw

@+a:Cookie -> @+b:Cookie -> Bool

Same name, domain, host-only flag and path: the new cookie replaces the old one.

def cookie.shadows source · line 2345 · raw

@+old:Cookie -> @+c:Cookie -> Bool

§5.7 step 16: a secure cookie that a new cookie from plain http must not overlay.

def cookie.shadowed source · line 2350 · raw

@cs:List<&2, Cookie> -> @+c:Cookie -> Bool

def cookie.put source · line 2359 · raw

@cs:List<&2, Cookie> -> @+c:Cookie -> @+live:Bool -> List<&2, Cookie>

cs with the cookie c replaces swapped for c (keeping its place, so its creation order), or c last. A c that is not live only removes the old one: that is how a server deletes a cookie.

def jar.put.c source · line 2366 · raw

@m:Maybe<&2, Cookie> -> @j:Jar -> @+https:Bool -> Jar

def jar.put.one source · line 2375 · raw

@j:Jar -> @+a:0x1f2d80f53f971b16c6de6a65cb1918ae/url.Abs -> @x:String -> Jar

def jar.put.all source · line 2379 · raw

@xs:List<&2, String> -> @j:Jar -> @+a:0x1f2d80f53f971b16c6de6a65cb1918ae/url.Abs -> Jar

def jar.store.abs source · line 2387 · raw

@j:Jar -> @+a:0x1f2d80f53f971b16c6de6a65cb1918ae/url.Abs -> @+h:Map<&2, List<&2, String>> -> Jar

Every set-cookie field of h, in order, as received from a.

def jar.store.url source · line 2390 · raw

@j:Jar -> @u:Maybe<&2, 0x1f2d80f53f971b16c6de6a65cb1918ae/url.Abs> -> @+h:Map<&2, List<&2, String>> -> Jar

def jar.store source · line 2399 · raw

@j:Jar -> @url:String -> @res:Res -> Pair(Jar, Res)

The jar after res came from url, and res as it was. Header names are lowercase, as parse gives them. An unparsable url stores nothing.

def cookie.sends source · line 2404 · raw

@+host:String -> @+path:String -> @+https:Bool -> @+c:Cookie -> Bool

§5.8.3: domain (exact when host-only), path, and Secure only over https.

def cookie.pick source · line 2408 · raw

@cs:List<&2, Cookie> -> @+host:String -> @+path:String -> @+https:Bool -> List<&2, Cookie>

def cookie.longer source · line 2416 · raw

@a:Cookie -> @b:Cookie -> Bool

The sort order of §5.8.3: longer paths first; the stable sort keeps creation order among equals.

def cookie.pair source · line 2421 · raw

@c:Cookie -> String

def cookie.pairs source · line 2425 · raw

@cs:List<&2, Cookie> -> List<&2, String>

def jar.string source · line 2433 · raw

@j:Jar -> @a:0x1f2d80f53f971b16c6de6a65cb1918ae/url.Abs -> String

§5.8.3: the cookie-string for a request to a, or "" when no cookie matches.

def jar.header source · line 2439 · raw

@+h:Map<&2, List<&2, String>> -> @+s:String -> Map<&2, List<&2, String>>

One cookie field: the caller's own cookie values first, then the jar's.

def jar.apply.url source · line 2443 · raw

@j:Jar -> @u:Maybe<&2, 0x1f2d80f53f971b16c6de6a65cb1918ae/url.Abs> -> @+h:Map<&2, List<&2, String>> -> Map<&2, List<&2, String>>

def jar.apply source · line 2452 · raw

@j:Jar -> @url:String -> @+h:Map<&2, List<&2, String>> -> Map<&2, List<&2, String>>

The headers with the jar's cookies for a request to url in their cookie field (lowercase, as fetch sends names). An unparsable url adds nothing.

def jar.opt.apply source · line 2456 · raw

@m:Maybe<&2, Jar> -> @a:0x1f2d80f53f971b16c6de6a65cb1918ae/url.Abs -> @+h:Map<&2, List<&2, String>> -> Map<&2, List<&2, String>>

The jar, if any, that a fetch threads through its hops.

def jar.opt.res source · line 2463 · raw

@j:Jar -> @+a:0x1f2d80f53f971b16c6de6a65cb1918ae/url.Abs -> @r:Result<&1, &1, Err, Res> -> Pair(Maybe<&2, Jar>, Result<&1, &1, Err, Res>)

def jar.opt.store source · line 2471 · raw

@m:Maybe<&2, Jar> -> @+a:0x1f2d80f53f971b16c6de6a65cb1918ae/url.Abs -> @r:Result<&1, &1, Err, Res> -> Pair(Maybe<&2, Jar>, Result<&1, &1, Err, Res>)

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

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

def io.send.words source · line 2485 · 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 2492 · raw

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

def io.close source · line 2496 · raw

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

def fetch.close source · line 2503 · raw

@tls:Bool -> @s:Socket -> @r:Result<&1, &1, Err, Res> -> IO(Result<&1, &1, Err, Res>)

def fetch.boxed source · line 2514 · raw

@r:Result<&1, &1, Err, Res> -> @none:Bool -> Out

def fetch.bad source · line 2521 · raw

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

def fetch.shut source · line 2528 · raw

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

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

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

def fetch.hold source · line 2540 · raw

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

def fetch.failout source · line 2544 · raw

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

def fetch.rt source · line 2556 · raw

@+n:U32 -> @t:Rt -> Fl

def fetch.over source · line 2566 · raw

@+n:U32 -> Bool

64 KiB of head past the body cap, as serve allows.

def fetch.piece.cap source · line 2569 · raw

@over:Bool -> @+head:Bool -> @rv:Rv -> @+n2:U32 -> @+len:U32 -> @buf:Array<U32> -> Fl

def fetch.piece source · line 2576 · raw

@+head:Bool -> @rv:Rv -> @+n:U32 -> @p:Pair(U32, Array<U32>) -> Fl

def fetch.next source · line 2581 · raw

@+head:Bool -> @rv:Rv -> @+n:U32 -> @m:Pair(Socket, Result<&1, &1, Pair(U32, String), Pair(U32, Array<U32>)>) -> Pair(Socket, Fl)

def exchange.sent source · line 2603 · raw

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

def exchange.go source · line 2611 · raw

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

def exchange.tup source · line 2616 · raw

@o:Out -> Pair(Maybe<&1, Socket>, Pair(Result<&1, &1, Err, Res>, 0xec25e4adfb02e59e4b817801115988ee/bytes.Bytes))

def exchange source · line 2624 · raw

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

One request on an open socket. Some{socket}: it can take another request.

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

@+cap:U32 -> Pool

def pool.new source · line 2673 · raw

Pool

Up to 8 idle sockets per origin.

def pool.key source · line 2676 · raw

@+scheme:String -> @+host:String -> @+port:U32 -> String

def pool.key.cert source · line 2679 · raw

@+base:String -> @cert:Maybe<&2, Cert> -> String

def pool.key.ca source · line 2687 · raw

@+base:String -> @+ca:String -> @empty:Bool -> String

def pool.key.trust source · line 2694 · raw

@+base:String -> @cert:Maybe<&2, Cert> -> @+ca:String -> String

def pool.take.of source · line 2697 · 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 2710 · raw

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

The socket given back last.

def conn.close source · line 2714 · raw

@c:Conn -> IO(Unit)

def conns.cut source · line 2722 · 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 2737 · 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 2745 · 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 2754 · raw

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

def pool.close source · line 2763 · raw

@p:Pool -> IO(Unit)

def pool.idempotent source · line 2768 · raw

@+method:String -> Bool

RFC 9110 §9.2.2

def conn.tls source · line 2771 · raw

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

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

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

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

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

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

@proto:String -> @s:Socket -> IO(Result<&1, &1, Err, Conn>)

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

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

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

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

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

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

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

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

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

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

def conn.secure source · line 2867 · raw

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

A failed handshake is an error, never plaintext.

def conn.made source · line 2875 · raw

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

def conn.open source · line 2884 · raw

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

def conn.dial.time source · line 2894 · 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 2902 · 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 2910 · raw

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

def conn.dial.after source · line 2916 · 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 2924 · 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 2930 · raw

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

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

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

def conn.dial.all source · line 2938 · 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 2948 · raw

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

def proxy.auth.safe source · line 2960 · raw

@s:String -> Bool

def proxy.auth.checked source · line 2967 · raw

@+decoded:String -> @valid:Bool -> Maybe<&2, String>

def proxy.auth.value source · line 2974 · raw

@m:Maybe<&2, String> -> Maybe<&2, String>

def proxy.from.abs source · line 2981 · raw

@authorization:String -> @m:Maybe<&2, 0x1f2d80f53f971b16c6de6a65cb1918ae/url.Abs> -> Maybe<&2, Proxy>

def proxy.from.user source · line 2988 · raw

@user:String -> @host:String -> Maybe<&2, Proxy>

def proxy.from.authority source · line 2993 · raw

@has_user:Bool -> @authority:String -> @split:Pair(String, String) -> Maybe<&2, Proxy>

def proxy.from.parts source · line 3002 · raw

@parts:Pair(String, String) -> Maybe<&2, Proxy>

def proxy.from.url.if source · line 3010 · raw

@valid:Bool -> @raw:String -> Maybe<&2, Proxy>

def proxy.from.url source · line 3017 · raw

@+raw:String -> Maybe<&2, Proxy>

def proxy.no.domain source · line 3020 · raw

@+host:String -> @+suffix:String -> Bool

def proxy.no.suffix source · line 3023 · raw

@+host:String -> @+raw:String -> Bool

def proxy.no.port source · line 3030 · raw

@valid:Bool -> @+host:String -> @suffix:String -> Bool

def proxy.no.named source · line 3037 · raw

@+host:String -> @+port:U32 -> @parts:Pair(String, String) -> Bool

def proxy.no.literal source · line 3045 · raw

@+host:String -> @+port:U32 -> @+name:String -> Bool

def proxy.no.token source · line 3050 · raw

@+host:String -> @+port:U32 -> @token:String -> Bool

def proxy.no.list source · line 3057 · raw

@xs:List<&2, String> -> @+host:String -> @+port:U32 -> Bool

def proxy.no_match source · line 3064 · raw

@+host:String -> @+port:U32 -> @no_proxy:String -> Bool

def proxy.env.value source · line 3067 · raw

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

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

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

def proxy.env source · line 3084 · raw

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

def proxy.from.env source · line 3089 · raw

@value:String -> Maybe<&2, Proxy>

def proxy.choose source · line 3096 · raw

@bypass:Bool -> @value:String -> Maybe<&2, Proxy>

def proxy.select source · line 3103 · raw

@+scheme:String -> @+host:String -> @+port:U32 -> IO(Maybe<&2, Proxy>)

def h2.header.skip source · line 3112 · raw

@+name:String -> Bool

def h2.header.mode source · line 3122 · raw

@+name:String -> U32

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

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

def h2.header.tokens source · line 3135 · raw

@vs:List<&2, String> -> List<&2, String>

def h2.header.nominated.one source · line 3142 · raw

@enabled:Bool -> @vs:List<&2, String> -> @rest:List<&2, String> -> List<&2, String>

def h2.header.nominated source · line 3150 · raw

@xs:List<&2, Sigma<&2, &2, String, _ => List<&2, String>>> -> List<&2, String>

def h2.header.has source · line 3159 · raw

@xs:List<&2, String> -> @+key:String -> Bool

def h2.header.item source · line 3166 · 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 3174 · 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 3184 · raw

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

def h2.response.status.value source · line 3192 · raw

@+value:String -> @valid:Bool -> Maybe<&2, U32>

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

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

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

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

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

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

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

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

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

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

def h2.response source · line 3248 · raw

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

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

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

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

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

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

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

def h2.send source · line 3281 · raw

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

@reader:H2Reader -> @e:Err -> IO(Result<&1, &1, Err, Pair(Conn, Res)>)

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

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

def h2.buffered.head.result source · line 3397 · raw

@r:Result<&1, &1, Err, Maybe<&1, Res>> -> Maybe<&1, Res>

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

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

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

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

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

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

def h2.exchange source · line 3451 · raw

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

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

@s:Socket -> @e:Err -> IO(Result<&1, &1, Err, Conn>)

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

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

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

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

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

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

def proxy.connect.frame source · line 3489 · raw

@raw:String -> @over:Bool -> Frame

def proxy.connect.chunk source · line 3496 · raw

@empty:Bool -> @s:Socket -> @raw:String -> @+len:U32 -> @buf:Array<U32> -> TunnelStep

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

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

def proxy.connect.header source · line 3542 · raw

@+authority:String -> @authorization:String -> String

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

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

def proxy.connect source · line 3560 · raw

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

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

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

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

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

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

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

def route.open source · line 3602 · raw

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

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

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

@+tls:Bool -> @s:Socket -> @+ms:U32 -> @request:Send -> IO(Out)

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

@p:Pool -> @+key:String -> @+tls:Bool -> @res:Res -> @s:Socket -> @clean:Bool -> IO(Pair(Pool, Result<&1, &1, Err, 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 3628 · raw

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

def pool.keep source · line 3635 · raw

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

def pool.after source · line 3639 · raw

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

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

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

def took.of source · line 3661 · raw

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

def took.seen source · line 3669 · raw

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

def h2.idle.kept source · line 3674 · 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 3682 · raw

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

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

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

def h2.idle.read source · line 3698 · 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 3709 · 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 3720 · raw

@c:Conn -> IO(Took)

def pool.take.go source · line 3732 · 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 3756 · 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 3760 · raw

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

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

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

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

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

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

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

def pool.fresh source · line 3801 · raw

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

def pool.retry source · line 3808 · raw

@+none:Bool -> @+idem:Bool -> Bool

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

def pool.stale source · line 3811 · raw

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

def pool.reused source · line 3820 · raw

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

def pool.idle.h1.bodies source · line 3830 · 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:Route -> IO(Pair(Pool, Result<&1, &1, Err, Res>))

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

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

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

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

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

def pool.idle source · line 3856 · raw

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

def proxy.http.headers source · line 3866 · raw

@headers:Map<&2, List<&2, String>> -> @authorization:String -> Map<&2, List<&2, String>>

def proxy.absolute source · line 3874 · raw

@scheme:String -> @host_field:String -> @target:String -> String

def proxy.request source · line 3877 · raw

@secure:Bool -> @+scheme:String -> @method:String -> @+target:String -> @+hf:String -> @headers:Map<&2, List<&2, String>> -> @body:0xec25e4adfb02e59e4b817801115988ee/bytes.Bytes -> @authorization:String -> Send

def origin.route source · line 3889 · raw

@+method:String -> @headers:Map<&2, List<&2, String>> -> @body:0xec25e4adfb02e59e4b817801115988ee/bytes.Bytes -> @+hf:String -> @+scheme:String -> @+host:String -> @+port:U32 -> @+target:String -> @+cert:Maybe<&2, Cert> -> @+ca:String -> @proxy:Proxy -> Pair(String, Pair(Send, Route))

The pool key, the request as sent, and the route to one origin, direct or through a proxy.

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

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

def pool.origin.choice source · line 3915 · 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, Cert> -> @+ca:String -> @choice:Maybe<&2, Proxy> -> IO(Pair(Pool, Result<&1, &1, Err, Res>))

def pool.origin source · line 3927 · 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, Cert> -> @+ca:String -> @choice:Maybe<&2, Proxy> -> IO(Pair(Pool, Result<&1, &1, Err, Res>))

def pool.scheme.ok source · line 3940 · raw

@a:0x1f2d80f53f971b16c6de6a65cb1918ae/url.Abs -> Bool

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

@h:Hop -> @pr:Pair(Pool, Result<&1, &1, Err, Res>) -> Pair(Pool, Pair(Result<&1, &1, Err, Res>, Hop))

def pool.one.of source · line 3949 · 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, Cert> -> @+ca:String -> IO(Pair(Pool, Pair(Result<&1, &1, Err, Res>, Hop)))

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

def pool.one source · line 3963 · raw

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

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

def fetch.hop source · line 3978 · raw

@left:Nat -> @h:Hop -> Next

left: redirects still allowed after the request we just finished.

def fetch.decide.r source · line 3985 · raw

@left:Nat -> @r:Res -> @next:Maybe<&1, Hop> -> Next

def fetch.decide.res source · line 3992 · raw

@left:Nat -> @h:Hop -> @r:Res -> Next

def fetch.decide source · line 3996 · raw

@left:Nat -> @h:Hop -> @m:Result<&1, &1, Err, Res> -> Next

def fetch.error.res source · line 4003 · raw

@r:Res -> @bad:Bool -> Next

def fetch.error source · line 4010 · raw

@h:Hop -> @m:Result<&1, &1, Err, Res> -> Next

def fetch.policy source · line 4018 · raw

@mode:Mode -> @left:Nat -> @h:Hop -> @m:Result<&1, &1, Err, Res> -> Next

def accept.enc source · line 4028 · raw

@+h:Map<&2, List<&2, String>> -> @+enc:String -> Map<&2, List<&2, String>>

A caller's own Accept-Encoding wins; enc is the codings fetch can undo.

def fetch.start source · line 4031 · raw

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

def pool.next.ca source · line 4042 · raw

@same:Bool -> @+ca:String -> String

def next.trust source · line 4050 · raw

@+old:String -> @cert:Maybe<&2, Cert> -> @+ca:String -> @n:Next -> Pair(Next, Pair(Maybe<&2, Cert>, String))

The certificate and CA file go on only to a hop on the same origin.

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

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

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

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

def pool.next source · line 4070 · raw

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

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

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

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

def ce.keep source · line 4096 · raw

@+w:String -> @+rest:List<&2, String> -> List<&2, String>

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

def ce.norm source · line 4099 · raw

@xs:List<&2, String> -> List<&2, String>

def ce.split source · line 4106 · raw

@xs:List<&2, String> -> List<&2, String>

def ce.of source · line 4119 · raw

@m:Maybe<&1, 0xec25e4adfb02e59e4b817801115988ee/bytes.Bytes> -> Dec

def ce.deflate.raw source · line 4127 · raw

@b:0xec25e4adfb02e59e4b817801115988ee/bytes.Bytes -> @m:Maybe<&1, 0xec25e4adfb02e59e4b817801115988ee/bytes.Bytes> -> Dec

Servers send deflate both with and without the zlib wrapper.

def ce.deflate.of source · line 4134 · raw

@r:Pair(0xec25e4adfb02e59e4b817801115988ee/bytes.Bytes, 0xec25e4adfb02e59e4b817801115988ee/bytes.Bytes) -> Dec

def ce.deflate source · line 4138 · raw

@b:0xec25e4adfb02e59e4b817801115988ee/bytes.Bytes -> Dec

def ce.apply.id source · line 4141 · raw

@on:Bool -> @b:0xec25e4adfb02e59e4b817801115988ee/bytes.Bytes -> Dec

def ce.apply.de source · line 4148 · raw

@on:Bool -> @+c:String -> @b:0xec25e4adfb02e59e4b817801115988ee/bytes.Bytes -> Dec

def ce.apply.gz source · line 4155 · raw

@on:Bool -> @+c:String -> @b:0xec25e4adfb02e59e4b817801115988ee/bytes.Bytes -> Dec

def ce.apply source · line 4162 · raw

@+c:String -> @b:0xec25e4adfb02e59e4b817801115988ee/bytes.Bytes -> Dec

def ce.go source · line 4165 · raw

@cs:List<&2, String> -> @d:Dec -> Dec

def decoded.pick source · line 4178 · raw

@d:Dec -> @+status:U32 -> @headers:Map<&2, List<&2, String>> -> @body:0xec25e4adfb02e59e4b817801115988ee/bytes.Bytes -> Result<&1, &1, Err, Res>

def decoded.both source · line 4188 · raw

@+status:U32 -> @+headers:Map<&2, List<&2, String>> -> @cs:List<&2, String> -> @r:Pair(0xec25e4adfb02e59e4b817801115988ee/bytes.Bytes, 0xec25e4adfb02e59e4b817801115988ee/bytes.Bytes) -> Result<&1, &1, Err, Res>

One copy decodes; the other is the body as sent, for a coding we cannot decode.

def decoded.cs source · line 4192 · raw

@+status:U32 -> @+headers:Map<&2, List<&2, String>> -> @body:0xec25e4adfb02e59e4b817801115988ee/bytes.Bytes -> @cs:List<&2, String> -> Result<&1, &1, Err, Res>

def decoded.go source · line 4199 · raw

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

def decoded source · line 4207 · raw

@res:Res -> Result<&1, &1, Err, Res>

The body decoded per Content-Encoding; the headers stay as sent. A corrupt body is ErrBad.

def decoded.m source · line 4212 · raw

@r:Result<&1, &1, Err, Res> -> Maybe<&1, Res>

def decoded.some source · line 4219 · raw

@res:Res -> Maybe<&1, Res>

def ce.words source · line 4222 · raw

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

def ce.dec source · line 4235 · raw

@d:Dec -> Maybe<&1, 0xec25e4adfb02e59e4b817801115988ee/bytes.Bytes>

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

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

ponytail: deflate runs on the pure decoder, which also takes raw DEFLATE; servers rarely send it.

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

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

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

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

def ce.io.gz source · line 4267 · 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 4274 · raw

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

def ce.has source · line 4291 · raw

@xs:List<&2, String> -> @+c:String -> Bool

def ce.known source · line 4298 · raw

@cs:List<&2, String> -> @+ok:List<&2, String> -> Bool

def decoded.io.pick source · line 4305 · raw

@m:Maybe<&1, 0xec25e4adfb02e59e4b817801115988ee/bytes.Bytes> -> @+status:U32 -> @headers:Map<&2, List<&2, String>> -> Result<&1, &1, Err, Res>

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

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

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

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

def decoded.io source · line 4330 · raw

@+enc:String -> @res:Res -> IO(Result<&1, &1, Err, Res>)

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

def codings.ok source · line 4336 · raw

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

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

def codings.add source · line 4348 · raw

@has:Bool -> @+enc:String -> @+c:String -> String

def codings source · line 4352 · raw

IO(String)

gzip and deflate, then br and zstd when their C library loads.

def fetch.final source · line 4359 · raw

@+enc:String -> @r:Result<&1, &1, Err, Res> -> IO(Result<&1, &1, Err, Res>)

The final response of a fetch, after redirects.

def pool.final source · line 4366 · raw

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

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

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

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

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

def pool.how source · line 4385 · raw

@p:Pool -> @method:String -> @url:String -> @headers:Map<&2, List<&2, String>> -> @body:0xec25e4adfb02e59e4b817801115988ee/bytes.Bytes -> @ms:U32 -> @mode:Mode -> IO(Pair(Pool, Result<&1, &1, Err, 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 4388 · 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, Err, Res>))

def pool.fetch source · line 4391 · raw

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

def pool.fetch.cert.with source · line 4394 · 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, Err, Res>))

def pool.fetch.cert source · line 4397 · 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, Err, Res>))

def pool.fetch.ca.with source · line 4400 · 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, Err, Res>))

def pool.fetch.ca source · line 4405 · 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, Err, Res>))

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

@p:Pool -> @f:Fetch -> IO(Pair(Pool, Result<&1, &1, Err, Res>))

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

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

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

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

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

@r:Pair(List<&1, Pool>, List<&1, Result<&1, &1, Err, Res>>) -> IO(List<&1, Result<&1, &1, Err, Res>>)

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

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

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

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

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

def fetch.all source · line 4457 · raw

@reqs:List<&1, Fetch> -> @+n:U32 -> IO(List<&1, Result<&1, &1, Err, 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 4461 · raw

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

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

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

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

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

@p:Pool -> @j:Jar -> @method:String -> @url:String -> @headers:Map<&2, List<&2, String>> -> @body:0xec25e4adfb02e59e4b817801115988ee/bytes.Bytes -> IO(Pair(Pool, Pair(Jar, Result<&1, &1, Err, 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 4479 · raw

@pr:Pair(Pool, Result<&1, &1, Err, Res>) -> IO(Result<&1, &1, Err, Res>)

def fetch.how source · line 4486 · raw

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

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

def fetch.with source · line 4491 · raw

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

def fetch.cert.with source · line 4494 · 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, Err, Res>)

def fetch.cert source · line 4499 · raw

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

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

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

def fetch.ca source · line 4507 · raw

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

def fetch source · line 4511 · raw

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

fetch.with and a 30 s step timeout.

def get source · line 4514 · raw

@url:String -> IO(Result<&1, &1, Err, Res>)

def post.json source · line 4518 · raw

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

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

def resolve.show source · line 4523 · raw

@a:0x1f2d80f53f971b16c6de6a65cb1918ae/url.Abs -> String

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 resolve.to source · line 4527 · raw

@m:Maybe<&2, 0x1f2d80f53f971b16c6de6a65cb1918ae/url.Abs> -> Maybe<&2, String>

def resolve.base source · line 4534 · raw

@m:Maybe<&2, 0x1f2d80f53f971b16c6de6a65cb1918ae/url.Abs> -> @+ref:String -> Maybe<&2, String>

def resolve source · line 4541 · raw

@base:String -> @+ref:String -> Maybe<&2, String>

def retry.cap source · line 4546 · raw

U32

Retry. The wait before retry n (0 first) is 500 ms doubled n times, at most 30 s; its upper half is jitter r: backoff(n, r) = half + r mod (half + 1).

def retry.base source · line 4549 · raw

@n:Nat -> U32

def retry.backoff.half source · line 4556 · raw

@+half:U32 -> @+r:U32 -> U32

def retry.backoff source · line 4559 · raw

@n:Nat -> @+r:U32 -> U32

def retry.after.ms source · line 4563 · raw

@+ms:0x4eed9d7ac6ece61523d747a9d804e4f0/int.I64 -> U32

ms clamped to 0 .. retry.cap().

def retry.after.date source · line 4567 · raw

@m:Maybe<&2, 0x0d2a146cd1cbaedf76cc532bcd3594b0/time.Instant> -> @now:0x0d2a146cd1cbaedf76cc532bcd3594b0/time.Instant -> Maybe<&2, U32>

def retry.after.secs source · line 4575 · raw

@+v:String -> @now:0x0d2a146cd1cbaedf76cc532bcd3594b0/time.Instant -> @n:Maybe<&2, U32> -> Maybe<&2, U32>

More than 5 digits is past the cap, and would overflow parse_u32.

def retry.after source · line 4584 · raw

@+v:String -> @now:0x0d2a146cd1cbaedf76cc532bcd3594b0/time.Instant -> Maybe<&2, U32>

Retry-After (RFC 9110 §10.2.3) as ms from now, at most retry.cap(): delay-seconds, or an HTTP-date (a past date is 0). None when v is empty or neither form.

def retry.wait source · line 4587 · raw

@m:Maybe<&2, U32> -> @n:Nat -> @+r:U32 -> U32

def retry.delay source · line 4595 · raw

@+v:String -> @now:0x0d2a146cd1cbaedf76cc532bcd3594b0/time.Instant -> @n:Nat -> @+r:U32 -> U32

The wait before retry n: Retry-After v when it reads as a delay, else backoff with jitter r.

def retry.status source · line 4599 · raw

@+s:U32 -> Bool

Statuses a later try may clear.

def retry.fail source · line 4604 · raw

@e:Err -> Pair(Result<&1, &1, Err, Res>, Maybe<&2, String>)

A refused connect or a timeout may clear; any other error would repeat.

def retry.res source · line 4613 · raw

@res:Res -> Pair(Result<&1, &1, Err, Res>, Maybe<&2, String>)

def retry.judge.try source · line 4617 · raw

@r:Result<&1, &1, Err, Res> -> Pair(Result<&1, &1, Err, Res>, Maybe<&2, String>)

def retry.judge source · line 4626 · raw

@idem:Bool -> @r:Result<&1, &1, Err, Res> -> Pair(Result<&1, &1, Err, Res>, Maybe<&2, String>)

One try, judged: the result as it came, and Some{Retry-After value} ("" when absent) when an idempotent request may try again.

def retry.jitter source · line 4634 · raw

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

ponytail: a failed random source gives jitter 0, so the wait is the lower half.

def retry.sleep source · line 4641 · raw

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

def retry.kept source · line 4647 · raw

@body:0xec25e4adfb02e59e4b817801115988ee/bytes.Bytes -> @j:Pair(Result<&1, &1, Err, Res>, Maybe<&2, String>) -> Pair(0xec25e4adfb02e59e4b817801115988ee/bytes.Bytes, Pair(Result<&1, &1, Err, Res>, Maybe<&2, String>))

def retry.one source · line 4652 · 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, Err, Res>, Maybe<&2, String>)))

One fetch of the copy; the body comes back for the next try.

def retry.go source · line 4660 · 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, Err, Res>, Maybe<&2, String>)) -> IO(Result<&1, &1, Err, Res>)

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

def retry.start source · line 4684 · raw

@enabled:Bool -> @n:U32 -> @+method:String -> @+url:String -> @+headers:Map<&2, List<&2, String>> -> @body:0xec25e4adfb02e59e4b817801115988ee/bytes.Bytes -> IO(Result<&1, &1, Err, 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 4696 · raw

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

def pc.po source · line 4724 · raw

@more:Bool -> @empty:Bool -> @b:0xec25e4adfb02e59e4b817801115988ee/bytes.Bytes -> Po

A body piece, or none when empty: more reads the next piece, and not more is the end.

def pc.piece source · line 4731 · raw

@more:Bool -> @+rb:Rb -> @b:0xec25e4adfb02e59e4b817801115988ee/bytes.Bytes -> Pc

def pc.fed.of source · line 4735 · raw

@b:0xec25e4adfb02e59e4b817801115988ee/bytes.Bytes -> @st:Rb -> Pc

def pc.fed source · line 4748 · raw

@bf:Bf -> Pc

def pc.of source · line 4753 · raw

@rb:Rb -> @piece:0xec25e4adfb02e59e4b817801115988ee/bytes.Bytes -> Pc

The body bytes that just arrived: what they add to the body, and how it ends.

def pc.end source · line 4757 · raw

@ok:Bool -> Pc

The server closed. Only a close-delimited body may end this way (RFC 9112 §8).

def pc.eof source · line 4764 · raw

@st:Rb -> Pc

def stream.pc.of source · line 4768 · raw

@bf:Bf -> Pair(Pc, Bool)

pc.of, and whether bytes came past the end of the body.

def stream.pc source · line 4773 · raw

@rb:Rb -> @piece:0xec25e4adfb02e59e4b817801115988ee/bytes.Bytes -> Pair(Pc, Bool)

def stream.mk source · line 4777 · raw

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

Bytes past the body put the socket out of step with the server, so it cannot go back to a pool.

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

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

def stream.got source · line 4786 · raw

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

def stream.after source · line 4794 · raw

@+rb:Rb -> Po

def stream.feed.received source · line 4810 · 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 4818 · raw

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

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

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

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

@st:Fed -> Fed

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

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

def stream.ready source · line 4843 · raw

@empty:Bool -> @+rb:Rb -> @b:0xec25e4adfb02e59e4b817801115988ee/bytes.Bytes -> Po

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

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

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

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

def stream.finish.ok source · line 4869 · raw

@r:Result<&1, &1, Pair(U32, String), Unit> -> Bool

def stream.finish source · line 4876 · raw

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

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

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

def stream.recv source · line 4905 · raw

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

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

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

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

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

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

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

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

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

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

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

def stream.ended source · line 4973 · raw

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

def stream.res source · line 5006 · raw

@st:Stream -> Pair(Stream, Res)

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

def stream.close source · line 5011 · raw

@st:Stream -> IO(Unit)

def stream.po.end source · line 5017 · raw

@out:Po -> Bool

def stream.rb.done source · line 5024 · raw

@+rb:Rb -> Bool

def stream.give source · line 5031 · raw

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

def pool.stream.close source · line 5041 · 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 sh.of source · line 5054 · raw

@hs:Hs -> Sh

def sh.none source · line 5065 · raw

@buf:0xec25e4adfb02e59e4b817801115988ee/bytes.Bytes -> @+k:U32 -> Bool

def sh.piece source · line 5069 · raw

@+head:Bool -> @buf:0xec25e4adfb02e59e4b817801115988ee/bytes.Bytes -> @+k:U32 -> @p:Pair(U32, Array<U32>) -> Sh

def sh.next source · line 5074 · raw

@+head:Bool -> @buf:0xec25e4adfb02e59e4b817801115988ee/bytes.Bytes -> @+k:U32 -> @m:Pair(Socket, Result<&1, &1, Pair(U32, String), Pair(U32, Array<U32>)>) -> Pair(Socket, Sh)

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

@r:Result<&1, &1, Err, Res> -> Result<&1, &1, Err, Stream>

def stream.back source · line 5090 · raw

@back:Maybe<&2, String> -> @+rb:Rb -> @+headers:Map<&2, List<&2, String>> -> Maybe<&2, String>

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

def stream.sent source · line 5111 · 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, Err, Stream>))

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

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

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

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

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

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

def stream.conn source · line 5169 · raw

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

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

def stream.opened source · line 5186 · raw

@x:Pair(Bool, Result<&1, &1, Err, Stream>) -> Result<&1, &1, Err, Stream>

def stream.fresh source · line 5191 · raw

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

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

def stream.stale source · line 5197 · raw

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

def stream.reused source · line 5207 · raw

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

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

@p:Pool -> @+ms:U32 -> @+head:Bool -> @+idem:Bool -> @+key:String -> @route: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, Err, Stream>))

def stream.idle source · line 5225 · raw

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

def stream.take source · line 5239 · raw

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

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

def stream.route source · line 5251 · raw

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

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

def stream.origin.choice source · line 5259 · 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, Cert> -> @+ca:String -> @choice:Maybe<&2, Proxy> -> IO(Pair(Pool, Result<&1, &1, Err, Stream>))

def stream.origin source · line 5272 · 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, Cert> -> @+ca:String -> @choice:Maybe<&2, Proxy> -> IO(Pair(Pool, Result<&1, &1, Err, Stream>))

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

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

@h:Hop -> @pr:Pair(Pool, Result<&1, &1, Err, Stream>) -> Pair(Pool, Pair(Hop, Result<&1, &1, Err, Stream>))

def stream.one.of source · line 5289 · 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, Cert> -> @+ca:String -> IO(Pair(Pool, Pair(Hop, Result<&1, &1, 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 5301 · raw

@p:Pool -> @h:Hop -> @+ms:U32 -> @cert:Maybe<&2, Cert> -> @+ca:String -> @jar:Maybe<&2, Jar> -> IO(Pair(Pool, Pair(Hop, Result<&1, &1, 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 5311 · raw

@n:Next -> Sn

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

@st:Stream -> @m:Result<&1, &1, Err, Res> -> Sn

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

@st:Stream -> @n:Next -> Sn

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

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

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

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

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

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

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

def stream.decide source · line 5359 · raw

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

def stream.step source · line 5367 · raw

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

@st:Stream -> @opened:Opened -> IO(Result<&1, &1, Err, Stream>)

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

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

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

@+enc:String -> @st:Stream -> IO(Result<&1, &1, Err, Stream>)

def stream.init source · line 5474 · raw

@+enc:String -> @r:Result<&1, &1, Err, Stream> -> IO(Result<&1, &1, Err, Stream>)

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

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

def stream.start source · line 5487 · 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 5494 · raw

@x:Pair(Maybe<&2, Jar>, Result<&1, &1, Err, Stream>) -> Result<&1, &1, Err, Stream>

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

@x:Pair(Pool, Pair(Maybe<&2, Jar>, Result<&1, &1, Err, Stream>)) -> Pair(Pool, Result<&1, &1, Err, Stream>)

def stream.unpooled source · line 5503 · raw

@x:Pair(Pool, Pair(Maybe<&2, Jar>, Result<&1, &1, Err, Stream>)) -> IO(Pair(Maybe<&2, Jar>, Result<&1, &1, 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 5510 · raw

@p:Pool -> @mode:Mode -> @cert:Maybe<&2, Cert> -> @ca:String -> @jar:Maybe<&2, Jar> -> @method:String -> @url:String -> @headers:Map<&2, List<&2, String>> -> @body:0xec25e4adfb02e59e4b817801115988ee/bytes.Bytes -> @+ms:U32 -> IO(Pair(Pool, Pair(Maybe<&2, Jar>, Result<&1, &1, 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 5517 · raw

@mode:Mode -> @cert:Maybe<&2, Cert> -> @ca:String -> @jar:Maybe<&2, Jar> -> @method:String -> @url:String -> @headers:Map<&2, List<&2, String>> -> @body:0xec25e4adfb02e59e4b817801115988ee/bytes.Bytes -> @+ms:U32 -> IO(Pair(Maybe<&2, Jar>, Result<&1, &1, 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 5524 · raw

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

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

def open.raw source · line 5529 · raw

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

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

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

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

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

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

def pool.open.with source · line 5546 · 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, Err, Stream>))

def pool.open source · line 5552 · raw

@p:Pool -> @method:String -> @url:String -> @headers:Map<&2, List<&2, String>> -> @body:0xec25e4adfb02e59e4b817801115988ee/bytes.Bytes -> IO(Pair(Pool, Result<&1, &1, 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 5555 · raw

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

def open.how source · line 5562 · raw

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

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

def open.with source · line 5569 · raw

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

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

def open source · line 5574 · raw

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

def hex.digit source · line 5581 · raw

@+n:U32 -> Char

def hex.go source · line 5584 · raw

@k:Nat -> @+n:U32 -> @acc:String -> String

def hex.trim source · line 5591 · raw

@+s:String -> String

def hex source · line 5598 · raw

@+n:U32 -> String

def up.sent source · line 5601 · raw

@+tls:Bool -> @+ms:U32 -> @+head:Bool -> @m:Pair(Socket, Result<&1, &1, Pair(U32, String), Unit>) -> Up

def up.conn source · line 5609 · raw

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

def up.head source · line 5624 · raw

@+method:String -> @+target:String -> @+hf:String -> @+headers:Map<&2, List<&2, String>> -> String

def up.route source · line 5627 · raw

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

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

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

def up.origin source · line 5646 · raw

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

def up.url source · line 5659 · raw

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

def upload.how source · line 5669 · raw

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

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

def upload.with source · line 5673 · raw

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

def upload source · line 5676 · raw

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

def up.wrote source · line 5679 · raw

@+tls:Bool -> @+ms:U32 -> @+head:Bool -> @m:Pair(Socket, Result<&1, &1, Pair(U32, String), Unit>) -> Pair(Up, Result<&2, &2, Err, Unit>)

def up.put source · line 5689 · raw

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

One write per chunk, so the size line and the data do not wait on each other (Nagle).

def up.chunk source · line 5698 · raw

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

def upload.write source · line 5703 · raw

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

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

def upload.finish source · line 5712 · raw

@up:Up -> IO(Result<&1, &1, Err, Stream>)

Ends the body and returns the response as a stream.

def limits.representable source · line 5736 · raw

U32

Bytes.words rounds with len+3 in U32. A retained cap plus the fixed 65536 receive overshoot must still fit before that addition, including temporary copies.

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

@valid:Bool -> IO(Unit)

def limits.validate source · line 5746 · raw

@+max:Nat -> IO(Unit)

def limits source · line 5749 · raw

@max:Nat -> Limits

def limits.config source · line 5752 · raw

@config:ServerConfig -> Limits

def phase.new source · line 5760 · raw

@+kind:U32 -> @ms:U32 -> @now:0x0d2a146cd1cbaedf76cc532bcd3594b0/time.Duration -> Phase

def phase.remaining source · line 5763 · raw

@+until:0x0d2a146cd1cbaedf76cc532bcd3594b0/time.Duration -> @+now:0x0d2a146cd1cbaedf76cc532bcd3594b0/time.Duration -> U32

def bounded.sent source · line 5767 · raw

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

def bounded.send.ready source · line 5771 · 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 5781 · raw

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

def reply.bytes source · line 5787 · raw

@res:Res -> @head:Bool -> @close:Bool -> 0xec25e4adfb02e59e4b817801115988ee/bytes.Bytes

def reply.fail.bytes source · line 5791 · raw

@+status:U32 -> Res

def reply.drain.of source · line 5794 · raw

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

def reply.drain source · line 5804 · raw

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

ponytail: cap drain at 32 MiB and 2.55 s; use socket half-close if larger peers need guaranteed delivery.

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

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

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

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

def reply_fail source · line 5849 · raw

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

def serve.max source · line 5875 · raw

Nat

def sv.none source · line 5878 · raw

Sv

def sv.body source · line 5881 · raw

@req:Req -> @+v11:Bool -> @parts:List<&1, 0xec25e4adfb02e59e4b817801115988ee/bytes.Bytes> -> @rest:0xec25e4adfb02e59e4b817801115988ee/bytes.Bytes -> Turn

def sv.len.cut source · line 5885 · raw

@req:Req -> @+v11:Bool -> @parts:List<&1, 0xec25e4adfb02e59e4b817801115988ee/bytes.Bytes> -> @+len:U32 -> @+left:U32 -> @r:Pair(0xec25e4adfb02e59e4b817801115988ee/bytes.Bytes, 0xec25e4adfb02e59e4b817801115988ee/bytes.Bytes) -> Turn

def sv.len.have source · line 5889 · raw

@short:Bool -> @req:Req -> @+v11:Bool -> @+left:U32 -> @parts:List<&1, 0xec25e4adfb02e59e4b817801115988ee/bytes.Bytes> -> @+len:U32 -> @piece:0xec25e4adfb02e59e4b817801115988ee/bytes.Bytes -> Turn

def sv.len source · line 5896 · raw

@req:Req -> @+v11:Bool -> @+left:U32 -> @parts:List<&1, 0xec25e4adfb02e59e4b817801115988ee/bytes.Bytes> -> @piece:0xec25e4adfb02e59e4b817801115988ee/bytes.Bytes -> Turn

def sv.chunk.of source · line 5900 · raw

@req:Req -> @+v11:Bool -> @+n:U32 -> @c:Ck -> Turn

def sv.chunk.parts.cons source · line 5922 · raw

@+len:U32 -> @buf:Array<U32> -> @counted:Pair(List<&1, 0xec25e4adfb02e59e4b817801115988ee/bytes.Bytes>, Nat) -> Pair(List<&1, 0xec25e4adfb02e59e4b817801115988ee/bytes.Bytes>, Nat)

def sv.chunk.parts source · line 5926 · raw

@xs:List<&1, 0xec25e4adfb02e59e4b817801115988ee/bytes.Bytes> -> @old:List<&1, 0xec25e4adfb02e59e4b817801115988ee/bytes.Bytes> -> Pair(List<&1, 0xec25e4adfb02e59e4b817801115988ee/bytes.Bytes>, Nat)

def sv.chunk.cap source · line 5934 · raw

@big:Bool -> @req:Req -> @+v11:Bool -> @n:U32 -> @st:Dc -> @parts:List<&1, 0xec25e4adfb02e59e4b817801115988ee/bytes.Bytes> -> @rest:0xec25e4adfb02e59e4b817801115988ee/bytes.Bytes -> Turn

def sv.chunk.counted source · line 5941 · raw

@+max:Nat -> @req:Req -> @v11:Bool -> @n:U32 -> @st:Dc -> @rest:0xec25e4adfb02e59e4b817801115988ee/bytes.Bytes -> @counted:Pair(List<&1, 0xec25e4adfb02e59e4b817801115988ee/bytes.Bytes>, Nat) -> Turn

def sv.chunk.decoded source · line 5947 · raw

@max:Nat -> @req:Req -> @v11:Bool -> @n:U32 -> @old:List<&1, 0xec25e4adfb02e59e4b817801115988ee/bytes.Bytes> -> @c:Ck -> Turn

def sv.chunk source · line 5951 · raw

@+max:Nat -> @req:Req -> @+v11:Bool -> @+n:U32 -> @st:Dc -> @parts:List<&1, 0xec25e4adfb02e59e4b817801115988ee/bytes.Bytes> -> @piece:0xec25e4adfb02e59e4b817801115988ee/bytes.Bytes -> Turn

def sv.cont source · line 5955 · raw

@want:Bool -> @t:Turn -> Turn

RFC 9110 §10.1.1: answer 100 Continue only when the body is still to come.

def sv.cl.k source · line 5968 · raw

@big:Bool -> @req:Req -> @+v11:Bool -> @+k:U32 -> @rest:0xec25e4adfb02e59e4b817801115988ee/bytes.Bytes -> Turn

def sv.cl source · line 5975 · raw

@+max:Nat -> @req:Req -> @+v11:Bool -> @rest:0xec25e4adfb02e59e4b817801115988ee/bytes.Bytes -> @n:Maybe<&2, U32> -> Turn

def sv.frame source · line 5982 · raw

@+max:Nat -> @req:Req -> @+v11:Bool -> @rest:0xec25e4adfb02e59e4b817801115988ee/bytes.Bytes -> @te:Bool -> Turn

def sv.expects source · line 5990 · raw

@+v11:Bool -> @+headers:Map<&2, List<&2, String>> -> Bool

def sv.got.head source · line 5993 · raw

@+max:Nat -> @+v11:Bool -> @rest:0xec25e4adfb02e59e4b817801115988ee/bytes.Bytes -> @req:Req -> Turn

def sv.parsed source · line 5997 · raw

@+max:Nat -> @+v11:Bool -> @rest:0xec25e4adfb02e59e4b817801115988ee/bytes.Bytes -> @g:Got -> Turn

def sv.split source · line 6008 · raw

@+max:Nat -> @+hlen:U32 -> @+len:U32 -> @r:Pair(0xec25e4adfb02e59e4b817801115988ee/bytes.Bytes, 0xec25e4adfb02e59e4b817801115988ee/bytes.Bytes) -> Turn

def sv.hit.none source · line 6013 · raw

@big:Bool -> @buf:0xec25e4adfb02e59e4b817801115988ee/bytes.Bytes -> Turn

def sv.hit.some source · line 6020 · raw

@big:Bool -> @+max:Nat -> @+hlen:U32 -> @+len:U32 -> @buf:0xec25e4adfb02e59e4b817801115988ee/bytes.Bytes -> Turn

def sv.hit source · line 6028 · raw

@+max:Nat -> @+headers:U32 -> @+len:U32 -> @buf:0xec25e4adfb02e59e4b817801115988ee/bytes.Bytes -> @at:Maybe<&2, U32> -> Turn

RFC 6585 §5: refuse a head over the configured byte limit.

def sv.seek.of source · line 6036 · raw

@+max:Nat -> @+headers:U32 -> @+len:U32 -> @+from:U32 -> @buf:0xec25e4adfb02e59e4b817801115988ee/bytes.Bytes -> @r:Pair(0xec25e4adfb02e59e4b817801115988ee/bytes.Bytes, Maybe<&2, U32>) -> Turn

def sv.seek source · line 6040 · raw

@+max:Nat -> @+headers:U32 -> @+len:U32 -> @+from:U32 -> @r:Pair(0xec25e4adfb02e59e4b817801115988ee/bytes.Bytes, 0xec25e4adfb02e59e4b817801115988ee/bytes.Bytes) -> Turn

def sv.head.at source · line 6045 · raw

@+max:Nat -> @+headers:U32 -> @+from:U32 -> @buf:0xec25e4adfb02e59e4b817801115988ee/bytes.Bytes -> Turn

Only the new bytes, and the 3 before them, can finish the blank line.

def sv.head source · line 6049 · raw

@+max:Nat -> @+headers:U32 -> @buf:0xec25e4adfb02e59e4b817801115988ee/bytes.Bytes -> @piece:0xec25e4adfb02e59e4b817801115988ee/bytes.Bytes -> Turn

def sv.closed.pick source · line 6053 · raw

@empty:Bool -> Turn

def sv.closed.head source · line 6060 · raw

@buf:0xec25e4adfb02e59e4b817801115988ee/bytes.Bytes -> Turn

def sv.step source · line 6065 · raw

@closed:Bool -> @+max:Nat -> @+headers:U32 -> @sv:Sv -> @piece:0xec25e4adfb02e59e4b817801115988ee/bytes.Bytes -> Turn

A close mid-request is a request cut short (RFC 9112 §8).

def sv.frame.req source · line 6084 · raw

@t:Turn -> Maybe<&1, Pair(String, String)>

def sv.frame.go source · line 6098 · raw

@xs:List<&2, String> -> @t:Turn -> Maybe<&1, Pair(String, String)>

def serve.frame source · line 6116 · raw

@xs:List<&2, String> -> Maybe<&1, Pair(String, String)>

The body and the bytes after it, once the pieces make a whole request; None otherwise.

def talk.piece source · line 6119 · raw

@settings:Limits -> @sv:Sv -> @p:Pair(U32, Array<U32>) -> Turn

def talk.next source · line 6124 · raw

@settings:Limits -> @sv:Sv -> @m:Pair(Socket, Result<&1, &1, Pair(U32, String), Pair(U32, Array<U32>)>) -> Pair(Socket, Turn)

def talk.after.pick source · line 6132 · raw

@empty:Bool -> @settings:Limits -> @rest:0xec25e4adfb02e59e4b817801115988ee/bytes.Bytes -> Turn

def talk.after.rest source · line 6140 · raw

@settings:Limits -> @rest:0xec25e4adfb02e59e4b817801115988ee/bytes.Bytes -> @s:Socket -> Pair(Socket, Turn)

def talk.after.keep source · line 6144 · raw

@keep:Bool -> @settings:Limits -> @rest:0xec25e4adfb02e59e4b817801115988ee/bytes.Bytes -> @s:Socket -> Pair(Socket, Turn)

def talk.after source · line 6151 · raw

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

def talk.send source · line 6159 · raw

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

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

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

def talk.completed source · line 6185 · raw

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

def talk.respond source · line 6195 · raw

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

def talk.cont source · line 6202 · raw

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

def phase.head source · line 6211 · raw

@empty:Bool -> @settings:Limits -> @now:0x0d2a146cd1cbaedf76cc532bcd3594b0/time.Duration -> Phase

def phase.start source · line 6220 · raw

@settings:Limits -> @sv:Sv -> @now:0x0d2a146cd1cbaedf76cc532bcd3594b0/time.Duration -> Pair(Phase, Sv)

def phase.select source · line 6231 · raw

@settings:Limits -> @sv:Sv -> @now:0x0d2a146cd1cbaedf76cc532bcd3594b0/time.Duration -> @previous:Maybe<&2, Phase> -> Pair(Phase, Sv)

def phase.body source · line 6239 · raw

@previous:Maybe<&2, Phase> -> @settings:Limits -> @now:0x0d2a146cd1cbaedf76cc532bcd3594b0/time.Duration -> Phase

Buffered pipelined headers have already ended before upload callbacks run.

def phase.after source · line 6247 · raw

@+settings:Limits -> @+now:0x0d2a146cd1cbaedf76cc532bcd3594b0/time.Duration -> @+phase:Phase -> @t:Turn -> Pair(Turn, Phase)

def phase.expired source · line 6268 · raw

@phase:Phase -> Turn

def talk.received.state source · line 6272 · raw

@s:Socket -> @next:Pair(Turn, Phase) -> Pair(Pair(Socket, Turn), Phase)

def talk.received.phase source · line 6276 · raw

@settings:Limits -> @phase:Phase -> @now:0x0d2a146cd1cbaedf76cc532bcd3594b0/time.Duration -> @next:Pair(Socket, Turn) -> Pair(Pair(Socket, Turn), Phase)

def talk.received.late source · line 6280 · raw

@expired:Bool -> @+settings:Limits -> @+phase:Phase -> @now:0x0d2a146cd1cbaedf76cc532bcd3594b0/time.Duration -> @sv:Sv -> @m:Pair(Socket, Result<&1, &1, Pair(U32, String), Pair(U32, Array<U32>)>) -> Pair(Pair(Socket, Turn), Phase)

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

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

A real host read slice returns its socket; no raced operation is abandoned. The original absolute phase survives slice timeouts and stop observations. Admitted streamed uploads retain their state and finish; unadmitted input closes.

def talk.read source · line 6353 · raw

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

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

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

def talk.recv source · line 6368 · raw

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

def talk.state source · line 6376 · raw

@received:Pair(Pair(Socket, Turn), Phase) -> Serving

def serve.write.state source · line 6380 · raw

@after:Maybe<&1, Pair(Socket, Turn)> -> Maybe<&1, Serving>

def admission.done source · line 6390 · raw

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

A buffered-work unit owns one connection's incomplete request, decoded body, and pipelined remainder from before its first recv until the task really returns. ponytail: idle sockets also reserve buffer units; split idle/read leases if idle utilization matters.

def admission.head source · line 6395 · raw

@req:Req -> Bool

def admission.turn.head source · line 6399 · raw

@turn:Turn -> Bool

def admission.reject source · line 6419 · raw

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

This rejection has parsed metadata, so normal HEAD body suppression still applies.

def server.config source · line 6497 · raw

@host:String -> @port:U32 -> ServerConfig

def server.config.with source · line 6500 · raw

@host:String -> @port:U32 -> @max:Nat -> ServerConfig

def server.deadline.valid source · line 6504 · raw

@+ms:U32 -> Bool

Host deadline effects use signed 32-bit milliseconds.

def server.config.valid source · line 6507 · raw

@config:ServerConfig -> Bool

def server.counts source · line 6577 · raw

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

def server.stats source · line 6586 · raw

@observer:ServerStats -> IO(Maybe<&2, 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 6600 · raw

@control:ServerControl -> IO(Bool)

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

@counts:0x0a045079b0f843dd1eb3dfc9de50dbd6/admission.Counts -> ServerCounts

def server.finished source · line 6623 · raw

@stopped:Bool -> @error:Pair(U32, String) -> @counts:ServerCounts -> ServerExit

def error.stopped source · line 6705 · raw

@error:Pair(U32, String) -> Bool

def error.capacity source · line 6714 · raw

@error:Pair(U32, String) -> Bool

def server.exited source · line 6749 · raw

@result:ServerExit -> IO(Unit)

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

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

@error:StartupError -> IO(Unit)

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

@result:Result<&2, &2, StartupError, Unit> -> IO(Unit)

def admission.ready source · line 6805 · raw

@t:Turn -> Pair(Bool, Turn)

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

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

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

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

def writer.sent source · line 6998 · raw

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

def writer.raw source · line 7008 · raw

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

def writer.chunk source · line 7018 · raw

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

def writer.known source · line 7024 · raw

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

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

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

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

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

def writer.write source · line 7051 · raw

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

def writer.result source · line 7059 · raw

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

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

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

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

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

def writer.finish source · line 7083 · raw

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

def writer.header.one source · line 7091 · raw

@m:Map<&2, List<&2, String>> -> @+key:String -> @vs:List<&2, String> -> @framing:Bool -> Map<&2, List<&2, String>>

def writer.headers source · line 7098 · raw

@xs:List<&2, Sigma<&2, &2, String, _ => List<&2, String>>> -> @m:Map<&2, List<&2, String>> -> Map<&2, List<&2, String>>

def writer.plan.body source · line 7107 · raw

@headers:Map<&2, List<&2, String>> -> @length:Maybe<&2, U32> -> Pair(WriterMode, Map<&2, List<&2, String>>)

def writer.plan source · line 7114 · raw

@nobody:Bool -> @headers:Map<&2, List<&2, String>> -> @length:Maybe<&2, U32> -> Pair(WriterMode, Map<&2, List<&2, String>>)

def serve.write.after source · line 7121 · raw

@settings:Limits -> @keep:Bool -> @rest:0xec25e4adfb02e59e4b817801115988ee/bytes.Bytes -> @socket:Maybe<&1, Socket> -> Maybe<&1, Pair(Socket, Turn)>

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

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

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

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

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

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

def writer.connection source · line 7178 · raw

@keep:Bool -> @headers:Map<&2, List<&2, String>> -> Map<&2, List<&2, String>>

Templates

template reply.complete source · line 37 · raw

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

template ce.eff source · line 4230 · 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>)

A decoded body stops at 16 MiB, like a received one.

template codings.has source · line 4343 · raw

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

template admission.request source · line 6426 · raw

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

template conn.admitted source · line 6469 · raw

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

template conn source · line 6481 · raw

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

template server.opened source · line 6515 · raw

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

template server.started source · line 6520 · raw

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

template server.bound source · line 6531 · raw

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

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

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

template server.start source · line 6554 · raw

@-C:Data -> @-O:Type -> @context:C -> @owner:O -> @+config:ServerConfig -> IO(Pair(O, Result<&2, &1, 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 6558 · raw

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

Observe the actual bound port without releasing the listener.

template server.observer source · line 6573 · raw

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

template server.control source · line 6596 · 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 6610 · raw

@-C:Data -> @server:Server<C> -> IO(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 6631 · raw

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

template server.admitted source · line 6636 · raw

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

template server.accepted source · line 6647 · raw

@-C:Data -> @-operation:(@_:C -> @_:Limits -> @_:Chan(0x0a045079b0f843dd1eb3dfc9de50dbd6/admission.Command) -> @_:Socket -> IO(Unit)) -> @+context:C -> @+config:ServerConfig -> @+inbox:Chan(0x0a045079b0f843dd1eb3dfc9de50dbd6/admission.Command) -> @drained:Chan(0x0a045079b0f843dd1eb3dfc9de50dbd6/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 6696 · raw

@-C:Data -> @-operation:(@_:C -> @_:Limits -> @_:Chan(0x0a045079b0f843dd1eb3dfc9de50dbd6/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 6700 · raw

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

template server.run source · line 6743 · raw

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

template serve.stream.nonempty source · line 6764 · 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 6772 · 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 6780 · 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 6790 · raw

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

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

@-S:Type -> @-finish:(@_:S -> IO(Reply)) -> @-observe:(@_:U32 -> @_:0x0a045079b0f843dd1eb3dfc9de50dbd6/completion.Outcome -> IO(Unit)) -> @+settings: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, Turn)>)

template serve.stream.after source · line 6837 · raw

@-S:Type -> @next:Maybe<&1, Pair(Socket, Turn)> -> StreamServing<S>

template serve.stream.ready source · line 6844 · raw

@-S:Type -> @held:Bool -> @socket:Socket -> @phase:Maybe<&2, Phase> -> @state:Maybe<&1, Pair(S, Bool)> -> @result:Pair(Bool, Turn) -> StreamServing<S>

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

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

The application consumes its real affine state on unsuccessful upload paths. An abort that does not return remains admitted work, not a fabricated drain.

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

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

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

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

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

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

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

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

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

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

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

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

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

@-S:Type -> @-write:(@_:S -> @_:Writer -> @_:0x0a045079b0f843dd1eb3dfc9de50dbd6/completion.Receipt -> IO(Pair(Writer, 0x0a045079b0f843dd1eb3dfc9de50dbd6/completion.Receipt))) -> @-dispose:(@_:S -> IO(Unit)) -> @observer:0x0a045079b0f843dd1eb3dfc9de50dbd6/completion.Receipt -> @settings: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, Turn)>)

template admission.write source · line 7211 · raw

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

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

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

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

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

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

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

template serve.started source · line 7290 · raw

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

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

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

template serve.on source · line 7308 · raw

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

template serve.with source · line 7311 · raw

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

template serve source · line 7314 · raw

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

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

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

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

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

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

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

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

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

Unsafe

unsafe fetch.loop source · line 2591 · raw

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

Reads until the response is whole or cannot be; an empty read means the server closed.

unsafe pool.hops source · line 4083 · raw

@+mode:Mode -> @+ms:U32 -> @st:Hops -> IO(Pair(Pool, Pair(Result<&1, &1, Err, Res>, Maybe<&2, 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 4983 · raw

@st:Stream -> IO(Pair(Stream, Result<&1, &1, 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 5095 · raw

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

Reads until the final head is in; the body bytes that came with it are the first piece.

unsafe stream.hops source · line 5375 · raw

@+mode:Mode -> @+ms:U32 -> @x:Pair(Pool, StreamHops) -> IO(Pair(Pool, Pair(Maybe<&2, Jar>, Result<&1, &1, 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 6307 · raw

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

One state machine owns the socket through each actual host return.

unsafe talk source · line 6446 · raw

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

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

@-C:Data -> @-operation:(@_:C -> @_:Limits -> @_:Chan(0x0a045079b0f843dd1eb3dfc9de50dbd6/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 6721 · raw

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

A single recursive state machine avoids recursion hidden inside a template.

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

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

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

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

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