pure.bend checks
raw source on the hub · import bend-kit-http@0.45.0.2/pure.bend as Pure
Pure HTTP codecs, framing, redirect, retry, and cookie rules.
8 imports
import Base import bend-kit-time@0.3.0.5/pure.bend as Time import bend-kit-int@0.2.0.0/int.bend as Int import bend-kit-url@0.4.1.0/url.bend as Url import bend-kit-encoding@0.5.0.3/encoding.bend as Enc import bend-kit-json@0.7.3.2/json.bend as Json import bend-kit-bytes@0.3.3.3/bytes.bend as Bytes import bend-kit-zlib@0.7.0.4/zlib.bend as Zlib
Types
type Req source · line 11 · raw
Type
Req@method:String -> @path:String -> @headers:Map<&2, List<&2, String>> -> @body:0x3f4d48cfd4df31741ee4b528a4e7773e/bytes.Bytes -> Req
type Res source · line 14 · raw
Type
Res@status:U32 -> @headers:Map<&2, List<&2, String>> -> @body:0x3f4d48cfd4df31741ee4b528a4e7773e/bytes.Bytes -> Res
type Err source · line 33 · 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.
ErrUrlErr
ErrDnsErr
ErrConnect@code:U32 -> @why:String -> Err
ErrTls@code:U32 -> @why:String -> Err
ErrRead@code:U32 -> @why:String -> Err
ErrWrite@code:U32 -> @why:String -> Err
ErrTimeoutErr
ErrRedirectErr
ErrBadErr
type Fields source · line 57 · raw
Data
FieldsBadFields
FieldsOk@m:Map<&2, List<&2, String>> -> Fields
type Hold source · line 389 · raw
Data
More: a valid prefix. Bad: cannot become a body. Body: a whole chunked body.
HoldMoreHold
HoldBadHold
HoldBody@b:String -> Hold
HoldUntil@b:String -> Hold
type Dc source · line 403 · 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.
DcSize@acc:U32 -> @seen:Bool -> Dc
DcExt@n:U32 -> Dc
DcSizeLf@n:U32 -> Dc
DcData@k:U32 -> Dc
DcDataCrDc
DcDataLfDc
DcTr@j:U32 -> Dc
DcDoneDc
DcBadDc
type Dco source · line 415 · raw
Data
st: where the decoder is. racc: the body so far, reversed. rest: bytes after a Done body.
Dco@st:Dc -> @racc:String -> @rest:String -> Dco
type Cs source · line 652 · raw
Type
A chunked body decoded from piece[i..]: a data run is sliced whole, and every other byte steps dc.
Cs@piece:0x3f4d48cfd4df31741ee4b528a4e7773e/bytes.Bytes -> @i:U32 -> @st:Dc -> @parts:List<&1, 0x3f4d48cfd4df31741ee4b528a4e7773e/bytes.Bytes> -> Cs
type Ck source · line 656 · raw
Type
st: where the decoder stopped. parts: the data so far, newest first. rest: the bytes after a Done body.
Ck@st:Dc -> @parts:List<&1, 0x3f4d48cfd4df31741ee4b528a4e7773e/bytes.Bytes> -> @rest:0x3f4d48cfd4df31741ee4b528a4e7773e/bytes.Bytes -> Ck
type Got source · line 777 · 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.
GotBadGot
GotMoreGot
GotHead@req:Req -> Got
GotReq@req:Req -> Got
type Frame source · line 907 · raw
Type
Bad: never a message. More: a valid prefix; read on. Done: a whole response.
FrameBadFrame
FrameMoreFrame
FrameDone@res:Res -> Frame
type Lead source · line 997 · raw
Data
LeadCutLead
LeadFinalLead
LeadSkip@+rest:String -> Lead
type Rb source · line 1118 · 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.
RbLen@left:U32 -> Rb
RbChunk@st:Dc -> Rb
RbCloseRb
RbDoneRb
RbBadRb
type Bf source · line 1155 · raw
Type
rb: how the body goes on. parts: body bytes so far, newest first. rest: bytes past a Done body.
Bf@rb:Rb -> @parts:List<&1, 0x3f4d48cfd4df31741ee4b528a4e7773e/bytes.Bytes> -> @rest:0x3f4d48cfd4df31741ee4b528a4e7773e/bytes.Bytes -> Bf
type Hs source · line 1225 · 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.
HsSeek@buf:0x3f4d48cfd4df31741ee4b528a4e7773e/bytes.Bytes -> @from:U32 -> @k:U32 -> Hs
HsWait@buf:0x3f4d48cfd4df31741ee4b528a4e7773e/bytes.Bytes -> @k:U32 -> Hs
HsBadHs
HsRes@res:Res -> @rb:Rb -> @rest:0x3f4d48cfd4df31741ee4b528a4e7773e/bytes.Bytes -> Hs
type Rv source · line 1325 · 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.
RvHead@buf:0x3f4d48cfd4df31741ee4b528a4e7773e/bytes.Bytes -> @k:U32 -> Rv
RvBody@res:Res -> @rb:Rb -> @parts:List<&1, 0x3f4d48cfd4df31741ee4b528a4e7773e/bytes.Bytes> -> Rv
RvLen@res:Res -> @left:U32 -> @body:0x3f4d48cfd4df31741ee4b528a4e7773e/bytes.Bytes -> Rv
type Rt source · line 1331 · raw
Type
More: read on. Done: the response, and the bytes after it when the body is self-delimited.
RtMore@rv:Rv -> Rt
RtBadRt
RtDone@res:Res -> @rest:Maybe<&1, 0x3f4d48cfd4df31741ee4b528a4e7773e/bytes.Bytes> -> Rt
type Reason source · line 1637 · raw
Data
RFC 9110 §15. An unknown code gets an empty reason, which RFC 9112 §4 allows.
Reason@code:U32 -> @text:String -> Reason
type Hop source · line 1733 · raw
Type
One request to make: headers are already lowercased (see req.put).
Hop@method:String -> @url:0x1f2d80f53f971b16c6de6a65cb1918ae/url.Abs -> @headers:Map<&2, List<&2, String>> -> @body:0x3f4d48cfd4df31741ee4b528a4e7773e/bytes.Bytes -> Hop
type Cookie source · line 1793 · raw
Data
A stored cookie. domain is lowercase, with no leading dot; host_only sends it to that host alone. expiry None is a session cookie. http_only and same_site ("strict", "lax", "none" or "default") are kept, not enforced: fetch has no browsing client, so its requests are same-site (§5.2).
Cookie@name:String -> @value:String -> @domain:String -> @host_only:Bool -> @path:String -> @secure:Bool -> @http_only:Bool -> @same_site:String -> @expiry:Maybe<&2, 0x05acb84fe7d232c08b57d385772acf76/pure.Instant> -> Cookie
type Jar source · line 1797 · raw
Data
The cookies, oldest first, and the caller's clock. No cookie in it has expired by now.
Jar@now:0x05acb84fe7d232c08b57d385772acf76/pure.Instant -> @cookies:List<&2, Cookie> -> Jar
type Hms source · line 1920 · raw
Data
Hms@h:U32 -> @m:U32 -> @s:U32 -> Hms
type Cdate source · line 1924 · raw
Data
§5.1.1 cookie-date: the first time, day, month and year tokens found.
Cdate@time:Maybe<&2, Hms> -> @day:Maybe<&2, U32> -> @month:Maybe<&2, U32> -> @year:Maybe<&2, U32> -> Cdate
type Cav source · line 2126 · 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).
Cav@expires:Maybe<&2, 0x05acb84fe7d232c08b57d385772acf76/pure.Instant> -> @max_age:Maybe<&2, U32> -> @domain:String -> @path:Maybe<&2, String> -> @secure:Bool -> @http_only:Bool -> @same_site:String -> Cav
type Av source · line 2194 · raw
Data
AvExpiresAv
AvMaxAgeAv
AvDomainAv
AvPathAv
AvSecureAv
AvHttpOnlyAv
AvSameSiteAv
AvOtherAv
type Out source · line 2454 · raw
Type
OutDone@res:Res -> @sock:Maybe<&1, Socket> -> @rest:0x3f4d48cfd4df31741ee4b528a4e7773e/bytes.Bytes -> Out
OutFail@e:Err -> @none:Bool -> Out
type Fl source · line 2465 · raw
Type
FlMore@rv:Rv -> @n:U32 -> Fl
FlBad@err:Maybe<&2, Err> -> @none:Bool -> Fl
FlDone@res:Res -> @rest:Maybe<&1, 0x3f4d48cfd4df31741ee4b528a4e7773e/bytes.Bytes> -> Fl
type Cert source · line 2512 · raw
Data
One request on an open socket. Some{socket}: it can take another request.
Cert@chain:String -> @key:String -> Cert
type Proxy source · line 2515 · raw
Data
ProxyDirectProxy
ProxyVia@host:String -> @port:U32 -> @authorization:String -> Proxy
type Route source · line 2519 · raw
Data
RouteDirect@tls:Bool -> @host:String -> @port:U32 -> @cert:Maybe<&2, Cert> -> @ca:String -> Route
RouteProxy@tls:Bool -> @host:String -> @port:U32 -> @sni:String -> @authority:String -> @authorization:String -> @cert:Maybe<&2, Cert> -> @ca:String -> Route
type Send source · line 2527 · raw
Type
Send@method:String -> @target:String -> @authority:String -> @headers:Map<&2, List<&2, String>> -> @body:0x3f4d48cfd4df31741ee4b528a4e7773e/bytes.Bytes -> Send
type TunnelStep source · line 2531 · raw
Type
TunnelRead@s:Socket -> @raw:String -> TunnelStep
TunnelHead@s:Socket -> @raw:String -> @frame:Frame -> TunnelStep
TunnelGot@raw:String -> @answer:Pair(Socket, Result<&1, &1, Pair(U32, String), Pair(U32, Array<U32>)>) -> TunnelStep
type Next source · line 2822 · raw
Type
NDone@res:Result<&1, &1, Err, Res> -> Next
NStopNext
NGo@left:Nat -> @hop:Hop -> Next
type Mode source · line 2827 · raw
Data
ModeFollowMode
ModeManualMode
ModeErrorMode
type Dec source · line 2931 · raw
Type
Ok: decoded so far. Bad: a coding failed. Skip: a coding we cannot decode, so the body stays as sent.
DecOk@b:0x3f4d48cfd4df31741ee4b528a4e7773e/bytes.Bytes -> Dec
DecBadDec
DecSkipDec
type Fetch source · line 3089 · raw
Type
gzip and deflate, then br and zstd when their C library loads.
Fetch@method:String -> @url:String -> @headers:Map<&2, List<&2, String>> -> @body:0x3f4d48cfd4df31741ee4b528a4e7773e/bytes.Bytes -> Fetch
type Po source · line 3215 · raw
Type
One fetch of the copy; the body comes back for the next try.
PoNonePo
PoPiece@b:0x3f4d48cfd4df31741ee4b528a4e7773e/bytes.Bytes -> Po
PoReady@b:0x3f4d48cfd4df31741ee4b528a4e7773e/bytes.Bytes -> Po
PoEndPo
PoBad@e:Err -> Po
type Pc source · line 3222 · raw
Type
Pc@rb:Rb -> @out:Po -> Pc
type Sh source · line 3320 · raw
Type
ShMore@buf:0x3f4d48cfd4df31741ee4b528a4e7773e/bytes.Bytes -> @k:U32 -> Sh
ShBad@err:Maybe<&2, Err> -> @none:Bool -> Sh
ShRes@res:Res -> @rb:Rb -> @rest:0x3f4d48cfd4df31741ee4b528a4e7773e/bytes.Bytes -> Sh
type Up source · line 3357 · raw
Type
Reads until the final head is in; the body bytes that came with it are the first piece.
Up@tls:Bool -> @s:Socket -> @ms:U32 -> @head:Bool -> @err:Maybe<&2, Err> -> Up
type ServerConfig source · line 3401 · raw
Data
One write per chunk, so the size line and the data do not wait on each other (Nagle).
ServerConfig@host:String -> @port:U32 -> @body_bytes:U32 -> @header_bytes:U32 -> @connections:U32 -> @requests:U32 -> @buffered:U32 -> @header_ms:U32 -> @body_ms:U32 -> @idle_ms:U32 -> @write_ms:U32 -> ServerConfig
type Limits source · line 3407 · raw
Data
Shared framing settings; all live readers reserve admission before allocation.
Limits@body:Nat -> @headers:U32 -> @header_ms:U32 -> @body_ms:U32 -> @idle_ms:U32 -> @write_ms:U32 -> Limits
type Phase source · line 3423 · raw
Data
One absolute deadline, never replenished by progress.
Phase@kind:U32 -> @until:0x05acb84fe7d232c08b57d385772acf76/pure.Duration -> Phase
type Sv source · line 3454 · raw
Type
ponytail: cap drain at 32 MiB and 2.55 s; use socket half-close if larger peers need guaranteed delivery.
SvHead@buf:0x3f4d48cfd4df31741ee4b528a4e7773e/bytes.Bytes -> Sv
SvLen@req:Req -> @v11:Bool -> @left:U32 -> @parts:List<&1, 0x3f4d48cfd4df31741ee4b528a4e7773e/bytes.Bytes> -> Sv
SvChunk@req:Req -> @v11:Bool -> @n:U32 -> @st:Dc -> @parts:List<&1, 0x3f4d48cfd4df31741ee4b528a4e7773e/bytes.Bytes> -> Sv
type InputOperation source · line 3459 · raw
Data
ReadInputInputOperation
SendContinueInputOperation
type Turn source · line 3464 · raw
Type
More: read on, first answering 100 Continue when cont is set.
TurnCloseTurn
TurnInputFailed@operation:InputOperation -> @code:U32 -> @message:String -> Turn
TurnFail@status:U32 -> Turn
TurnReq@req:Req -> @rest:0x3f4d48cfd4df31741ee4b528a4e7773e/bytes.Bytes -> @v11:Bool -> Turn
TurnMore@sv:Sv -> @cont:Bool -> Turn
type ReadStep source · line 3827 · raw
Type
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.
ReadChecking@socket:Socket -> @state:Sv -> @phase:Phase -> ReadStep
ReadAllowed@running:Bool -> @socket:Socket -> @state:Sv -> @phase:Phase -> ReadStep
ReadBudget@ms:U32 -> @socket:Socket -> @state:Sv -> @phase:Phase -> ReadStep
ReadReceived@state:Sv -> @phase:Phase -> @now:0x05acb84fe7d232c08b57d385772acf76/pure.Duration -> @result:Pair(Socket, Result<&1, &1, Pair(U32, String), Pair(U32, Array<U32>)>) -> ReadStep
ReadFailed@retry:Bool -> @socket:Socket -> @state:Sv -> @phase:Phase -> @now:0x05acb84fe7d232c08b57d385772acf76/pure.Duration -> @error:Pair(U32, String) -> ReadStep
type Serving source · line 3837 · raw
Type
One state machine owns the socket through each actual host return.
Serving@connection:Pair(Socket, Turn) -> @phase:Maybe<&2, Phase> -> Serving
type StartupError source · line 3878 · raw
Data
This rejection has parsed metadata, so normal HEAD body suppression still applies.
InvalidConfigStartupError
BindError@code:U32 -> @message:String -> StartupError
type ServerCounts source · line 3901 · raw
Data
ServerCounts@connections:U32 -> @active:U32 -> @buffered:U32 -> @connection_high:U32 -> @active_high:U32 -> @buffered_high:U32 -> @connection_rejected:Nat -> @active_rejected:Nat -> @buffered_rejected:Nat -> ServerCounts
type ServerExit source · line 3906 · raw
Data
ServerStopped@counts:ServerCounts -> ServerExit
ServerAcceptFailed@code:U32 -> @message:String -> @counts:ServerCounts -> ServerExit
type StreamServing source · line 3947 · raw
@-S:Type -> Type
StreamCheck@-S:Type -> @held:Bool -> @connection:Serving -> @state:Maybe<&1, Pair(S, Bool)> -> StreamServing<S>
StreamReady@-S:Type -> @held:Bool -> @ready:Bool -> @connection:Serving -> @state:Maybe<&1, Pair(S, Bool)> -> StreamServing<S>
StreamChecked@-S:Type -> @held:Bool -> @admitted:Bool -> @connection:Serving -> @state:Maybe<&1, Pair(S, Bool)> -> StreamServing<S>
StreamDone@-S:Type -> StreamServing<S>
type StreamAbort source · line 3965 · raw
Data
StreamClosedStreamAbort
StreamFailed@status:U32 -> StreamAbort
StreamInputFailed@operation:InputOperation -> @code:U32 -> @message:String -> StreamAbort
type WriterMode source · line 3972 · raw
Data
The application consumes its real affine state on unsuccessful upload paths. An abort that does not return remains admitted work, not a fabricated drain.
WriteKnown@left:U32 -> WriterMode
WriteChunkWriterMode
WriteNoneWriterMode
Definitions
def Body source · line 18 · raw
Type
A typed Data payload can be captured in receipt; the response remains affine.
def from_string source · line 22 · raw
@+s:String -> 0x3f4d48cfd4df31741ee4b528a4e7773e/bytes.Bytes
A byte string (one Char per octet) to a body, and back.
def to_string source · line 25 · raw
@b:0x3f4d48cfd4df31741ee4b528a4e7773e/bytes.Bytes -> String
def length source · line 28 · raw
@b:0x3f4d48cfd4df31741ee4b528a4e7773e/bytes.Bytes -> Pair(0x3f4d48cfd4df31741ee4b528a4e7773e/bytes.Bytes, U32)
def err.late source · line 44 · raw
@+code:U32 -> Bool
def err.pick source · line 47 · raw
@e:Err -> @late:Bool -> Err
def err.or_late source · line 54 · raw
@code:U32 -> @e:Err -> Err
def empty source · line 63 · 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 66 · raw
@r:Pair(Map<&2, List<&2, String>>, List<&2, String>) -> List<&2, String>
def fields source · line 70 · raw
@+h:Map<&2, List<&2, String>> -> @k:String -> List<&2, String>
def header.first source · line 73 · raw
@xs:List<&2, String> -> String
def header source · line 80 · raw
@+h:Map<&2, List<&2, String>> -> @k:String -> String
def field.last source · line 83 · raw
@xs:List<&2, String> -> String
def header.last source · line 93 · 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 96 · raw
@xs:List<&2, String> -> @v:String -> List<&2, String>
def set source · line 103 · raw
@m:Map<&2, List<&2, String>> -> @k:String -> @v:String -> Map<&2, List<&2, String>>
def add source · line 106 · raw
@+m:Map<&2, List<&2, String>> -> @+k:String -> @v:String -> Map<&2, List<&2, String>>
def sanitize.cons source · line 109 · raw
@ch:Char -> @rest:String -> @drop:Bool -> String
def sanitize source · line 116 · raw
@s:String -> String
def drop_cr.last.if source · line 123 · raw
@cr:Bool -> @c:U32 -> String
def drop_cr.last source · line 130 · raw
@+c:U32 -> String
def drop_cr.go source · line 134 · 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 141 · raw
@s:String -> String
def blank_end.go source · line 149 · raw
@s:String -> @w:U32 -> Bool
w holds the last four octets; a char past 255 clears it.
def blank_end source · line 157 · 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 160 · raw
@h:Char -> @r:String -> @space:Bool -> String
def trim_end source · line 172 · raw
@s:String -> String
String.trim_end without the two reversed copies.
def trim source · line 179 · raw
@s:String -> String
def take.cut source · line 183 · 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 187 · 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 202 · raw
@s:String -> Pair(String, String)
def start_line.ver source · line 205 · raw
@m:String -> @pv:Pair(String, String) -> Pair(String, Pair(String, String))
def start_line.rest source · line 209 · raw
@mr:Pair(String, String) -> Pair(String, Pair(String, String))
def start_line source · line 213 · raw
@s:String -> Pair(String, Pair(String, String))
def split_at_blank.go source · line 216 · raw
@s:String -> @e:Bool -> @w:U32 -> @acc:String -> Pair(String, String)
def split_at_blank.flag.go source · line 229 · 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 242 · raw
@r:Pair(String, Pair(String, Bool)) -> Pair(String, String)
def split_at_blank source · line 246 · raw
@+s:String -> Pair(String, String)
def split_colon.go source · line 249 · raw
@s:String -> @acc:String -> @hit:Bool -> Pair(String, String)
def split_colon source · line 264 · raw
@+s:String -> Pair(String, String)
def has_header.of source · line 267 · raw
@r:Pair(Map<&2, List<&2, String>>, Bool) -> Bool
def has_header source · line 271 · raw
@+h:Map<&2, List<&2, String>> -> @k:String -> Bool
def folded source · line 274 · raw
@+line:String -> Bool
def tracked source · line 277 · raw
@+k:String -> Bool
def fields_put.dup source · line 280 · raw
@m:Map<&2, List<&2, String>> -> @k:String -> @v:String -> @bad:Bool -> Fields
def fields_put.tracked source · line 287 · raw
@+m:Map<&2, List<&2, String>> -> @+k:String -> @v:String -> @t:Bool -> Fields
def fields_put.key source · line 294 · raw
@+m:Map<&2, List<&2, String>> -> @+k:String -> @v:String -> Fields
def fields_put.kv source · line 297 · raw
@m:Map<&2, List<&2, String>> -> @kv:Pair(String, String) -> Fields
def fields_put.fold source · line 301 · raw
@m:Map<&2, List<&2, String>> -> @line:String -> @fold:Bool -> Fields
def fields_put.empty source · line 308 · raw
@m:Map<&2, List<&2, String>> -> @+line:String -> @e:Bool -> Fields
def fields_put.ok source · line 315 · raw
@m:Map<&2, List<&2, String>> -> @+line:String -> Fields
def fields_put source · line 318 · raw
@acc:Fields -> @line:String -> Fields
def parse.headers.done source · line 325 · raw
@acc:Fields -> Maybe<&2, Map<&2, List<&2, String>>>
def parse.headers.scan.line source · line 333 · raw
@acc:String -> @fields:Fields -> Fields
def parse.headers.scan source · line 340 · raw
@s:String -> @acc:String -> @fields:Fields -> Fields
def parse.headers.raw source · line 349 · raw
@s:String -> Maybe<&2, Map<&2, List<&2, String>>>
def parse.first source · line 352 · raw
@s:String -> @acc:String -> Pair(String, String)
def parse_u32.digit source · line 361 · raw
@+c:U32 -> Bool
def parse_u32.add source · line 364 · raw
@acc:U32 -> @c:U32 -> U32
def parse_u32.done source · line 367 · raw
@acc:U32 -> @bad:Bool -> Maybe<&2, U32>
def parse_u32.go source · line 374 · raw
@s:String -> @acc:U32 -> @bad:Bool -> Maybe<&2, U32>
def parse_u32 source · line 381 · raw
@s:String -> Maybe<&2, U32>
def is_hex source · line 395 · raw
@+c:U32 -> Bool
def hexv source · line 398 · raw
@+c:U32 -> U32
def dc.start source · line 418 · raw
Dc
def dc.size.semi source · line 421 · raw
@+n:U32 -> @semi:Bool -> Dc
def dc.size.cr source · line 428 · raw
@+n:U32 -> @+c:U32 -> @cr:Bool -> Dc
def dc.size.end source · line 435 · raw
@+n:U32 -> @+c:U32 -> @seen:Bool -> Dc
def dc.size source · line 443 · 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 451 · 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 458 · raw
@+n:U32 -> @+c:U32 -> @cr:Bool -> Dc
def dc.sized source · line 465 · raw
@+n:U32 -> @zero:Bool -> Dc
def dc.size.lf source · line 472 · raw
@+n:U32 -> @lf:Bool -> Dc
def dc.data source · line 480 · raw
@+k:U32 -> @+m:U32 -> Dc
k data bytes are left and m of them were just read.
def dc.pick source · line 483 · raw
@ok:Bool -> @next:Dc -> Dc
def dc.tr.hit source · line 491 · raw
@+j:U32 -> Dc
ponytail: trailer fields are dropped unparsed (§7.1.2 allows discarding)
def dc.tr source · line 494 · raw
@+j:U32 -> @+c:U32 -> @hit:Bool -> Dc
def dc.tr.want source · line 501 · raw
@+j:U32 -> U32
def dc.byte source · line 504 · raw
@h:Char -> U32
def dc.step source · line 509 · 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 530 · raw
@st:Dc -> Bool
def dc.feed source · line 551 · raw
@s:String -> @st:Dc -> @racc:String -> Dco
def chunk.hold source · line 576 · raw
@o:Dco -> Hold
def chunk.live source · line 598 · raw
@s:String -> Hold
def chunk.rest source · line 601 · raw
@o:Dco -> Maybe<&2, String>
def chunk.suffix source · line 623 · raw
@s:String -> Maybe<&2, String>
def chunk.decode.hold source · line 626 · raw
@h:Hold -> Maybe<&2, String>
def chunk.decode source · line 637 · raw
@s:String -> Maybe<&2, String>
def bytes.snd source · line 640 · raw
@r:Pair(0x3f4d48cfd4df31741ee4b528a4e7773e/bytes.Bytes, 0x3f4d48cfd4df31741ee4b528a4e7773e/bytes.Bytes) -> 0x3f4d48cfd4df31741ee4b528a4e7773e/bytes.Bytes
def found.at source · line 644 · raw
@+from:U32 -> @m:Maybe<&2, U32> -> Maybe<&2, U32>
def ck.next source · line 659 · raw
@+len:U32 -> @+i:U32 -> @+st:Dc -> @piece:0x3f4d48cfd4df31741ee4b528a4e7773e/bytes.Bytes -> @parts:List<&1, 0x3f4d48cfd4df31741ee4b528a4e7773e/bytes.Bytes> -> Pair(Bool, Cs)
def ck.data source · line 662 · raw
@+len:U32 -> @+i:U32 -> @+k:U32 -> @+m:U32 -> @parts:List<&1, 0x3f4d48cfd4df31741ee4b528a4e7773e/bytes.Bytes> -> @r:Pair(0x3f4d48cfd4df31741ee4b528a4e7773e/bytes.Bytes, 0x3f4d48cfd4df31741ee4b528a4e7773e/bytes.Bytes) -> Pair(Bool, Cs)
def ck.byte source · line 666 · raw
@+len:U32 -> @+i:U32 -> @st:Dc -> @parts:List<&1, 0x3f4d48cfd4df31741ee4b528a4e7773e/bytes.Bytes> -> @r:Pair(0x3f4d48cfd4df31741ee4b528a4e7773e/bytes.Bytes, Maybe<&2, U32>) -> Pair(Bool, Cs)
def ck.step source · line 674 · raw
@+len:U32 -> @cs:Cs -> Pair(Bool, Cs)
def ck.rest source · line 697 · raw
@st:Dc -> @parts:List<&1, 0x3f4d48cfd4df31741ee4b528a4e7773e/bytes.Bytes> -> @r:Pair(0x3f4d48cfd4df31741ee4b528a4e7773e/bytes.Bytes, 0x3f4d48cfd4df31741ee4b528a4e7773e/bytes.Bytes) -> Ck
def ck.end source · line 701 · raw
@+len:U32 -> @cs:Cs -> Ck
def ck.feed source · line 706 · 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 719 · raw
@piece:0x3f4d48cfd4df31741ee4b528a4e7773e/bytes.Bytes -> @+st:Dc -> @parts:List<&1, 0x3f4d48cfd4df31741ee4b528a4e7773e/bytes.Bytes> -> Ck
def parse.res.cl.have source · line 723 · raw
@+rest:String -> @+k:Nat -> @short:Bool -> Hold
def parse.res.cl.k source · line 730 · raw
@+rest:String -> @+k:Nat -> Hold
def parse.res.cl.n source · line 733 · raw
@rest:String -> @n:Maybe<&2, U32> -> Hold
def parse.body.cl source · line 740 · raw
@+h:Map<&2, List<&2, String>> -> @rest:String -> @hascl:Bool -> Hold
def parse.body.chunked.eq source · line 748 · 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 755 · raw
@te:String -> @rest:String -> Hold
def parse.body.chunked source · line 758 · raw
@+h:Map<&2, List<&2, String>> -> @rest:String -> @hascl:Bool -> Hold
def parse.body.te source · line 765 · raw
@+h:Map<&2, List<&2, String>> -> @rest:String -> @te:Bool -> Hold
def parse.body source · line 772 · raw
@+h:Map<&2, List<&2, String>> -> @rest:String -> Hold
def parse.finish source · line 783 · raw
@method:String -> @path:String -> @h:Map<&2, List<&2, String>> -> @body:Hold -> Got
def parse.host source · line 794 · raw
@method:String -> @path:String -> @+h:Map<&2, List<&2, String>> -> @rest:String -> @has:Bool -> Got
def parse.fields source · line 802 · 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 809 · raw
@+p:String -> Bool
def parse.target source · line 812 · raw
@method:String -> @+path:String -> @headers:String -> @rest:String -> @v11:Bool -> @ok:Bool -> Got
def parse.ver source · line 819 · raw
@method:String -> @+path:String -> @+v:String -> @headers:String -> @rest:String -> @ok:Bool -> Got
def parse.empty_method source · line 826 · raw
@method:String -> @path:String -> @+v:String -> @headers:String -> @rest:String -> @empty:Bool -> Got
def parse.start3 source · line 833 · raw
@mpv:Pair(String, Pair(String, String)) -> @headers:String -> @rest:String -> Got
def parse.lines source · line 837 · raw
@lr:Pair(String, String) -> @rest:String -> Got
def parse.head source · line 842 · raw
@+head:String -> @rest:String -> @whole:Bool -> Got
def parse.of source · line 849 · raw
@hb:Pair(String, Pair(String, Bool)) -> Got
def parse.got source · line 854 · raw
@+raw:String -> Got
serve reads until this is not GotMore.
def parse.req source · line 858 · raw
@g:Got -> Maybe<&1, Req>
def parse source · line 869 · raw
@raw:String -> Maybe<&1, Req>
def parse.res.cl source · line 872 · raw
@+h:Map<&2, List<&2, String>> -> @rest:String -> @hascl:Bool -> Hold
def parse.res.chunked.eq source · line 879 · raw
@rest:String -> @ok:Bool -> Hold
def parse.res.chunked.val source · line 886 · raw
@te:String -> @rest:String -> Hold
def parse.res.chunked source · line 889 · raw
@+h:Map<&2, List<&2, String>> -> @rest:String -> @hascl:Bool -> Hold
def parse.res.te source · line 896 · raw
@+h:Map<&2, List<&2, String>> -> @rest:String -> @te:Bool -> Hold
def parse.res.body source · line 903 · raw
@+h:Map<&2, List<&2, String>> -> @rest:String -> Hold
def frame.cut source · line 913 · raw
@closed:Bool -> Frame
RFC 9112 §8: a message cut short by close is incomplete, not valid.
def frame.wait source · line 920 · raw
@res:Res -> @wait:Bool -> Frame
def frame.done source · line 927 · raw
@status:U32 -> @h:Map<&2, List<&2, String>> -> @body:Hold -> @+closed:Bool -> @open:Bool -> Frame
def frame.open source · line 939 · 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 943 · 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 947 · raw
@+status:U32 -> Bool
101 is the final response. Other 1xx are interim; a final response follows.
def frame.status source · line 950 · raw
@status:U32 -> @+h:Map<&2, List<&2, String>> -> @rest:String -> @closed:Bool -> @nobody:Bool -> Frame
def parse.res.fields source · line 957 · raw
@+status:U32 -> @rest:String -> @fs:Maybe<&2, Map<&2, List<&2, String>>> -> @closed:Bool -> @head:Bool -> Frame
def parse.res.num source · line 964 · raw
@code:Maybe<&2, U32> -> @headers:String -> @rest:String -> @closed:Bool -> @head:Bool -> Frame
def parse.res.ver source · line 971 · raw
@code:String -> @headers:String -> @rest:String -> @closed:Bool -> @head:Bool -> @ok:Bool -> Frame
def parse.res.start3 source · line 978 · raw
@mpv:Pair(String, Pair(String, String)) -> @headers:String -> @rest:String -> @closed:Bool -> @head:Bool -> Frame
def parse.res.lines source · line 982 · raw
@lr:Pair(String, String) -> @rest:String -> @closed:Bool -> @head:Bool -> Frame
def parse.res.blank source · line 986 · raw
@hd:String -> @rest:String -> @+closed:Bool -> @head:Bool -> @ok:Bool -> Frame
def parse.res.of source · line 993 · raw
@hb:Pair(String, String) -> @closed:Bool -> @head:Bool -> Frame
def frame.lead.if source · line 1002 · raw
@rest:String -> @interim:Bool -> Lead
def frame.lead.num source · line 1009 · raw
@n:Maybe<&2, U32> -> @rest:String -> Lead
def frame.lead.code source · line 1016 · raw
@mpv:Pair(String, Pair(String, String)) -> @rest:String -> Lead
def frame.lead.lines source · line 1020 · raw
@xs:List<&2, String> -> @rest:String -> Lead
def frame.lead.blank source · line 1027 · raw
@+hd:String -> @rest:String -> @ok:Bool -> Lead
def frame.lead source · line 1034 · raw
@hb:Pair(String, String) -> Lead
def frame.at.cont source · line 1038 · raw
@+raw:String -> @lead:Lead -> String
def frame.at.zero.go source · line 1047 · raw
@+raw:String -> @closed:Bool -> @head:Bool -> @lead:Lead -> Frame
def frame.at.zero.of source · line 1056 · raw
@+raw:String -> @closed:Bool -> @head:Bool -> Frame
def frame.at.pos.do source · line 1059 · raw
@f:Nat -> @+raw:String -> @closed:Bool -> @head:Bool -> @hb:Pair(String, String) -> @lead:Lead -> Frame
def frame.at.zero source · line 1078 · raw
@+raw:String -> @closed:Bool -> @head:Bool -> Frame
def frame.at source · line 1082 · 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 1090 · raw
@raw:String -> @closed:Bool -> @head:Bool -> Frame
frame(bytes so far, server closed?, request was HEAD?)
def frame.res source · line 1093 · raw
@f:Frame -> Maybe<&1, Res>
def parse_res source · line 1102 · raw
@raw:String -> Maybe<&1, Res>
def res_fields.res source · line 1105 · raw
@res:Res -> @k:String -> List<&2, String>
def res_fields source · line 1109 · raw
@m:Maybe<&1, Res> -> @k:String -> List<&2, String>
def rb.cl source · line 1125 · raw
@n:Maybe<&2, U32> -> Maybe<&2, Rb>
def rb.te source · line 1132 · raw
@+h:Map<&2, List<&2, String>> -> @cl:Bool -> Maybe<&2, Rb>
def rb.len source · line 1139 · raw
@+h:Map<&2, List<&2, String>> -> @te:Bool -> Maybe<&2, Rb>
def rb.of source · line 1147 · 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 1158 · raw
@parts:List<&1, 0x3f4d48cfd4df31741ee4b528a4e7773e/bytes.Bytes> -> @+len:U32 -> @+left:U32 -> @r:Pair(0x3f4d48cfd4df31741ee4b528a4e7773e/bytes.Bytes, 0x3f4d48cfd4df31741ee4b528a4e7773e/bytes.Bytes) -> Bf
def rb.len.have source · line 1162 · raw
@short:Bool -> @+left:U32 -> @parts:List<&1, 0x3f4d48cfd4df31741ee4b528a4e7773e/bytes.Bytes> -> @+len:U32 -> @piece:0x3f4d48cfd4df31741ee4b528a4e7773e/bytes.Bytes -> Bf
def rb.chunk source · line 1169 · raw
@c:Ck -> Bf
def rb.feed source · line 1192 · raw
@rb:Rb -> @parts:List<&1, 0x3f4d48cfd4df31741ee4b528a4e7773e/bytes.Bytes> -> @piece:0x3f4d48cfd4df31741ee4b528a4e7773e/bytes.Bytes -> Bf
The body bytes in piece, added to parts.
def rb.eof source · line 1207 · raw
@rb:Rb -> Bool
RFC 9112 §8: only a close-delimited body may end at close.
def rb.body source · line 1220 · raw
@parts:List<&1, 0x3f4d48cfd4df31741ee4b528a4e7773e/bytes.Bytes> -> 0x3f4d48cfd4df31741ee4b528a4e7773e/bytes.Bytes
def hs.final source · line 1231 · raw
@+status:U32 -> @+h:Map<&2, List<&2, String>> -> @rest:0x3f4d48cfd4df31741ee4b528a4e7773e/bytes.Bytes -> @m:Maybe<&2, Rb> -> Hs
def hs.skip source · line 1238 · raw
@more:Bool -> @+k:U32 -> @rest:0x3f4d48cfd4df31741ee4b528a4e7773e/bytes.Bytes -> Hs
def hs.pick source · line 1245 · raw
@interim:Bool -> @+head:Bool -> @+k:U32 -> @+status:U32 -> @+h:Map<&2, List<&2, String>> -> @rest:0x3f4d48cfd4df31741ee4b528a4e7773e/bytes.Bytes -> Hs
def hs.res source · line 1252 · raw
@+head:Bool -> @+k:U32 -> @rest:0x3f4d48cfd4df31741ee4b528a4e7773e/bytes.Bytes -> @res:Res -> Hs
def hs.parsed source · line 1257 · raw
@+head:Bool -> @+k:U32 -> @rest:0x3f4d48cfd4df31741ee4b528a4e7773e/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 1266 · raw
@+head:Bool -> @+k:U32 -> @+hlen:U32 -> @+len:U32 -> @r:Pair(0x3f4d48cfd4df31741ee4b528a4e7773e/bytes.Bytes, 0x3f4d48cfd4df31741ee4b528a4e7773e/bytes.Bytes) -> Hs
def hs.hit source · line 1270 · raw
@+head:Bool -> @+k:U32 -> @+len:U32 -> @buf:0x3f4d48cfd4df31741ee4b528a4e7773e/bytes.Bytes -> @at:Maybe<&2, U32> -> Hs
def hs.seek.of source · line 1278 · raw
@+head:Bool -> @+k:U32 -> @+len:U32 -> @+from:U32 -> @buf:0x3f4d48cfd4df31741ee4b528a4e7773e/bytes.Bytes -> @r:Pair(0x3f4d48cfd4df31741ee4b528a4e7773e/bytes.Bytes, Maybe<&2, U32>) -> Hs
def hs.seek source · line 1282 · raw
@+head:Bool -> @+k:U32 -> @+len:U32 -> @+from:U32 -> @r:Pair(0x3f4d48cfd4df31741ee4b528a4e7773e/bytes.Bytes, 0x3f4d48cfd4df31741ee4b528a4e7773e/bytes.Bytes) -> Hs
def hs.step source · line 1286 · raw
@+head:Bool -> @st:Hs -> Hs
def hs.scan source · line 1299 · 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 1315 · raw
@+head:Bool -> @+k:U32 -> @buf:0x3f4d48cfd4df31741ee4b528a4e7773e/bytes.Bytes -> @piece:0x3f4d48cfd4df31741ee4b528a4e7773e/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 1320 · raw
Nat
Untrusted servers must not grow the buffer without bound.
def rv.start source · line 1336 · raw
Rv
def rv.whole source · line 1339 · raw
@res:Res -> @b:0x3f4d48cfd4df31741ee4b528a4e7773e/bytes.Bytes -> @rest:Maybe<&1, 0x3f4d48cfd4df31741ee4b528a4e7773e/bytes.Bytes> -> Rt
def rv.done source · line 1343 · raw
@res:Res -> @parts:List<&1, 0x3f4d48cfd4df31741ee4b528a4e7773e/bytes.Bytes> -> @rest:Maybe<&1, 0x3f4d48cfd4df31741ee4b528a4e7773e/bytes.Bytes> -> Rt
def rl.put.of source · line 1346 · raw
@+total:U32 -> @+len:U32 -> @r:Pair(Array<U32>, Array<U32>) -> Pair(0x3f4d48cfd4df31741ee4b528a4e7773e/bytes.Bytes, 0x3f4d48cfd4df31741ee4b528a4e7773e/bytes.Bytes)
def rl.put source · line 1351 · raw
@+m:U32 -> @+left:U32 -> @body:0x3f4d48cfd4df31741ee4b528a4e7773e/bytes.Bytes -> @piece:0x3f4d48cfd4df31741ee4b528a4e7773e/bytes.Bytes -> Pair(0x3f4d48cfd4df31741ee4b528a4e7773e/bytes.Bytes, 0x3f4d48cfd4df31741ee4b528a4e7773e/bytes.Bytes)
The first m bytes of piece, written into body after the total - left bytes already there.
def rl.fed source · line 1356 · raw
@short:Bool -> @res:Res -> @+left:U32 -> @+len:U32 -> @r:Pair(0x3f4d48cfd4df31741ee4b528a4e7773e/bytes.Bytes, 0x3f4d48cfd4df31741ee4b528a4e7773e/bytes.Bytes) -> Rt
def rl.feed source · line 1365 · raw
@res:Res -> @+left:U32 -> @body:0x3f4d48cfd4df31741ee4b528a4e7773e/bytes.Bytes -> @piece:0x3f4d48cfd4df31741ee4b528a4e7773e/bytes.Bytes -> Rt
def rv.fed source · line 1369 · raw
@res:Res -> @bf:Bf -> Rt
def rb.buf source · line 1384 · 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 1397 · raw
@m:Maybe<&2, U32> -> @res:Res -> @rb:Rb -> @rest:0x3f4d48cfd4df31741ee4b528a4e7773e/bytes.Bytes -> Rt
def rv.head source · line 1404 · raw
@hs:Hs -> Rt
def rv.eof source · line 1415 · raw
@res:Res -> @parts:List<&1, 0x3f4d48cfd4df31741ee4b528a4e7773e/bytes.Bytes> -> @ok:Bool -> Rt
def rv.step source · line 1423 · raw
@closed:Bool -> @+head:Bool -> @rv:Rv -> @piece:0x3f4d48cfd4df31741ee4b528a4e7773e/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 1442 · raw
@closed:Bool -> @+head:Bool -> @t:Rt -> Rt
def rv.go source · line 1455 · raw
@xs:List<&2, String> -> @closed:Bool -> @+head:Bool -> @t:Rt -> Rt
def rt.frame source · line 1468 · raw
@t:Rt -> Frame
def res.frame source · line 1478 · 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 1481 · raw
@t:Rt -> Maybe<&1, 0x3f4d48cfd4df31741ee4b528a4e7773e/bytes.Bytes>
def after.of source · line 1490 · raw
@m:Maybe<&1, 0x3f4d48cfd4df31741ee4b528a4e7773e/bytes.Bytes> -> Maybe<&2, String>
def after source · line 1498 · 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 1501 · raw
@mpv:Pair(String, Pair(String, String)) -> Bool
def req.v11.line source · line 1505 · raw
@+line:String -> Bool
def req.v11.lines source · line 1508 · raw
@xs:List<&2, String> -> Bool
def req.v11.pick source · line 1515 · raw
@+head:String -> @ok:Bool -> Bool
def req.v11.of source · line 1522 · raw
@hb:Pair(String, String) -> Bool
def req.v11 source · line 1526 · raw
@+raw:String -> Bool
def req.conn_close source · line 1529 · raw
@+headers:Map<&2, List<&2, String>> -> Bool
def res.conn_close source · line 1532 · raw
@+headers:Map<&2, List<&2, String>> -> Bool
def serve.fail_close source · line 1535 · raw
@+status:U32 -> Bool
def serve.keep.ok source · line 1538 · raw
@fail:Bool -> @res_close:Bool -> Bool
def serve.keep.v11 source · line 1545 · raw
@v11:Bool -> @+req_close:Bool -> @+status:U32 -> @res_close:Bool -> Bool
def serve.keep source · line 1556 · raw
@+headers:Map<&2, List<&2, String>> -> @v11:Bool -> @+status:U32 -> @+res:Map<&2, List<&2, String>> -> Bool
def again.keep source · line 1560 · raw
@close:Bool -> @x:0x3f4d48cfd4df31741ee4b528a4e7773e/bytes.Bytes -> Maybe<&1, 0x3f4d48cfd4df31741ee4b528a4e7773e/bytes.Bytes>
def again.rest source · line 1567 · raw
@close:Bool -> @rest:Maybe<&1, 0x3f4d48cfd4df31741ee4b528a4e7773e/bytes.Bytes> -> Maybe<&1, 0x3f4d48cfd4df31741ee4b528a4e7773e/bytes.Bytes>
def again source · line 1576 · raw
@close:Bool -> @+h:Map<&2, List<&2, String>> -> @rest:Maybe<&1, 0x3f4d48cfd4df31741ee4b528a4e7773e/bytes.Bytes> -> Maybe<&1, 0x3f4d48cfd4df31741ee4b528a4e7773e/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 1583 · raw
@res:Res -> 0x3f4d48cfd4df31741ee4b528a4e7773e/bytes.Bytes
def res_body source · line 1587 · raw
@m:Maybe<&1, Res> -> 0x3f4d48cfd4df31741ee4b528a4e7773e/bytes.Bytes
def text source · line 1594 · raw
@res:Res -> String
def json source · line 1598 · raw
@res:Res -> Maybe<&1, 0xf0522b83dc131e118217178347c696c7/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 1601 · raw
@req:Req -> 0x3f4d48cfd4df31741ee4b528a4e7773e/bytes.Bytes
def got_body source · line 1605 · raw
@m:Maybe<&1, Req> -> 0x3f4d48cfd4df31741ee4b528a4e7773e/bytes.Bytes
def body.of source · line 1612 · raw
@hb:Pair(String, String) -> String
def body source · line 1616 · raw
@s:String -> String
def headers_lines source · line 1619 · raw
@+k:String -> @vs:List<&2, String> -> @acc:String -> String
def headers_block.go source · line 1626 · raw
@xs:List<&2, Sigma<&2, &2, String, _ => List<&2, String>>> -> @acc:String -> String
def headers_block source · line 1633 · raw
@h:Map<&2, List<&2, String>> -> String
def reasons source · line 1640 · raw
List<&2, Reason>
def reason.go source · line 1647 · raw
@xs:List<&2, Reason> -> @+status:U32 -> String
def reason source · line 1654 · raw
@+status:U32 -> String
def response source · line 1657 · raw
@+status:U32 -> @headers:Map<&2, List<&2, String>> -> @body:String -> String
def encode.body source · line 1660 · raw
@head:Bool -> @top:0x3f4d48cfd4df31741ee4b528a4e7773e/bytes.Bytes -> @body:0x3f4d48cfd4df31741ee4b528a4e7773e/bytes.Bytes -> 0x3f4d48cfd4df31741ee4b528a4e7773e/bytes.Bytes
def encode.len source · line 1667 · raw
@+status:U32 -> @headers:Map<&2, List<&2, String>> -> @head:Bool -> @body:0x3f4d48cfd4df31741ee4b528a4e7773e/bytes.Bytes -> 0x3f4d48cfd4df31741ee4b528a4e7773e/bytes.Bytes
def encode.pick source · line 1672 · raw
@+status:U32 -> @headers:Map<&2, List<&2, String>> -> @body:0x3f4d48cfd4df31741ee4b528a4e7773e/bytes.Bytes -> @head:Bool -> @nobody:Bool -> 0x3f4d48cfd4df31741ee4b528a4e7773e/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 1679 · raw
@r:Res -> @head:Bool -> 0x3f4d48cfd4df31741ee4b528a4e7773e/bytes.Bytes
def encode source · line 1683 · raw
@r:Res -> 0x3f4d48cfd4df31741ee4b528a4e7773e/bytes.Bytes
def request source · line 1686 · raw
@method:String -> @path:String -> @headers:Map<&2, List<&2, String>> -> @body:String -> String
def req.reserved source · line 1689 · raw
@+k:String -> Bool
def req.put.one source · line 1692 · 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 1699 · 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 1708 · 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 1714 · 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 1721 · raw
@+method:String -> @target:String -> @host:String -> @headers:Map<&2, List<&2, String>> -> @body:0x3f4d48cfd4df31741ee4b528a4e7773e/bytes.Bytes -> @close:Bool -> 0x3f4d48cfd4df31741ee4b528a4e7773e/bytes.Bytes
def encode_req source · line 1726 · raw
@+method:String -> @target:String -> @host:String -> @headers:Map<&2, List<&2, String>> -> @body:0x3f4d48cfd4df31741ee4b528a4e7773e/bytes.Bytes -> 0x3f4d48cfd4df31741ee4b528a4e7773e/bytes.Bytes
def redirect.code source · line 1736 · raw
@+s:U32 -> Bool
def redirect.origin source · line 1739 · raw
@a:0x1f2d80f53f971b16c6de6a65cb1918ae/url.Abs -> String
def redirect.del source · line 1743 · raw
@ks:List<&2, String> -> @m:Map<&2, List<&2, String>> -> Map<&2, List<&2, String>>
def redirect.hdrs source · line 1750 · raw
@+h:Map<&2, List<&2, String>> -> @drop:Bool -> @cross:Bool -> Map<&2, List<&2, String>>
def redirect.body source · line 1757 · raw
@drop:Bool -> @body:0x3f4d48cfd4df31741ee4b528a4e7773e/bytes.Bytes -> 0x3f4d48cfd4df31741ee4b528a4e7773e/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 1764 · raw
@+status:U32 -> @+method:String -> @+from:0x1f2d80f53f971b16c6de6a65cb1918ae/url.Abs -> @headers:Map<&2, List<&2, String>> -> @body:0x3f4d48cfd4df31741ee4b528a4e7773e/bytes.Bytes -> @next:Maybe<&2, 0x1f2d80f53f971b16c6de6a65cb1918ae/url.Abs> -> Maybe<&1, Hop>
def redirect.hop source · line 1772 · raw
@status:U32 -> @h:Hop -> @loc:String -> Maybe<&1, Hop>
def redirect.if source · line 1776 · raw
@status:U32 -> @h:Hop -> @loc:String -> @ok:Bool -> Maybe<&1, Hop>
def redirect source · line 1784 · 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 1800 · raw
@now:0x05acb84fe7d232c08b57d385772acf76/pure.Instant -> Jar
def jar.cookies source · line 1803 · raw
@j:Jar -> List<&2, Cookie>
def cookie.live.at source · line 1807 · raw
@+now:0x05acb84fe7d232c08b57d385772acf76/pure.Instant -> @e:Maybe<&2, 0x05acb84fe7d232c08b57d385772acf76/pure.Instant> -> Bool
def cookie.live source · line 1815 · raw
@+now:0x05acb84fe7d232c08b57d385772acf76/pure.Instant -> @c:Cookie -> Bool
Alive at now: no expiry, or an expiry after now.
def jar.live source · line 1819 · raw
@cs:List<&2, Cookie> -> @+now:0x05acb84fe7d232c08b57d385772acf76/pure.Instant -> List<&2, Cookie>
def jar.at source · line 1827 · raw
@j:Jar -> @+now:0x05acb84fe7d232c08b57d385772acf76/pure.Instant -> Jar
The jar at a later time: cookies expired by now are evicted (§5.7).
def cookie.cut.found source · line 1831 · raw
@r:Pair(String, String) -> Pair(String, Pair(String, Bool))
def cookie.cut.go source · line 1836 · 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 1852 · 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 1855 · raw
@r:Pair(String, Pair(String, Bool)) -> String
def cookie.target_path source · line 1860 · raw
@t:String -> String
The path of an origin-form target: the part before "?".
def cookie.over source · line 1864 · raw
@s:String -> @+n:U32 -> Bool
Longer than n octets.
def cookie.ctl source · line 1872 · raw
@s:String -> Bool
%x00-08 / %x0A-1F / %x7F: control characters other than HTAB.
def cookie.ascii source · line 1879 · raw
@s:String -> Bool
def cookie.ip4 source · line 1886 · raw
@s:String -> Bool
def cookie.ip source · line 1894 · 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 1898 · 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 1902 · raw
@rs:String -> String
A reversed path with its last segment and slash dropped.
def cookie.default_path source · line 1912 · raw
@+p:String -> String
§5.1.4: the request path up to its last "/", or "/".
def cookie.path_match source · line 1917 · raw
@+p:String -> @+c:String -> Bool
§5.1.4: request path p path-matches cookie path c.
def cookie.date.delim source · line 1927 · raw
@+c:U32 -> Bool
def cookie.date.push source · line 1930 · raw
@acc:String -> @ts:List<&2, String> -> List<&2, String>
def cookie.date.step source · line 1937 · raw
@d:Bool -> @+c:U32 -> @acc:String -> @ts:List<&2, String> -> Pair(String, List<&2, String>)
def cookie.date.tokens source · line 1945 · 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 1954 · raw
@+s:String -> Bool
def cookie.date.run source · line 1962 · 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 1973 · raw
@r:Pair(U32, Pair(U32, String)) -> @+lo:U32 -> @+hi:U32 -> Maybe<&1, Pair(U32, String)>
def cookie.date.num source · line 1978 · 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 1981 · raw
@m:Maybe<&1, Pair(U32, String)> -> Maybe<&2, U32>
def cookie.date.colon source · line 1988 · raw
@s:String -> Maybe<&2, String>
def cookie.date.sec source · line 1997 · raw
@+h:U32 -> @+m:U32 -> @r:Maybe<&1, Pair(U32, String)> -> Maybe<&2, Hms>
def cookie.date.min.c source · line 2004 · raw
@+h:U32 -> @+m:U32 -> @c:Maybe<&2, String> -> Maybe<&2, Hms>
def cookie.date.min source · line 2011 · raw
@+h:U32 -> @r:Maybe<&1, Pair(U32, String)> -> Maybe<&2, Hms>
def cookie.date.hour.c source · line 2018 · raw
@+h:U32 -> @c:Maybe<&2, String> -> Maybe<&2, Hms>
def cookie.date.hour source · line 2025 · raw
@r:Maybe<&1, Pair(U32, String)> -> Maybe<&2, Hms>
def cookie.date.time source · line 2033 · 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 2036 · raw
@xs:List<&2, String> -> @+w:String -> @+i:U32 -> Maybe<&2, U32>
def cookie.date.month source · line 2044 · raw
@+tok:String -> Maybe<&2, U32>
The month named by the first three letters, from 1.
def cookie.date.year source · line 2048 · 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 2055 · 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 2062 · 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 2069 · 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 2076 · 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 2083 · 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 2090 · 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 2097 · raw
@ts:List<&2, String> -> @st:Cdate -> Cdate
def cookie.date.fix source · line 2106 · raw
@+y:U32 -> U32
70–99 are 19xx, 0–69 are 20xx.
def cookie.date.at source · line 2109 · raw
@+y:U32 -> @+d:U32 -> @mo:U32 -> @h:U32 -> @mi:U32 -> @s:U32 -> Maybe<&2, 0x05acb84fe7d232c08b57d385772acf76/pure.Instant>
def cookie.date.fin source · line 2112 · raw
@st:Cdate -> Maybe<&2, 0x05acb84fe7d232c08b57d385772acf76/pure.Instant>
def cookie.date source · line 2121 · raw
@s:String -> Maybe<&2, 0x05acb84fe7d232c08b57d385772acf76/pure.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 2129 · raw
Cav
def cookie.limit source · line 2133 · raw
U32
§5.5: 400 days, the longest a cookie lives.
def cookie.later source · line 2136 · raw
@+now:0x05acb84fe7d232c08b57d385772acf76/pure.Instant -> @+secs:U32 -> 0x05acb84fe7d232c08b57d385772acf76/pure.Instant
def cookie.expires.cap source · line 2139 · raw
@+now:0x05acb84fe7d232c08b57d385772acf76/pure.Instant -> @m:Maybe<&2, 0x05acb84fe7d232c08b57d385772acf76/pure.Instant> -> Maybe<&2, 0x05acb84fe7d232c08b57d385772acf76/pure.Instant>
def cookie.max_age.zero source · line 2147 · raw
@m:Maybe<&2, U32> -> Maybe<&2, U32>
def cookie.max_age.nz source · line 2154 · raw
@s:String -> String
def cookie.max_age.cap source · line 2164 · 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 2171 · raw
@+v:String -> @neg:Bool -> Maybe<&2, U32>
def cookie.max_age.at source · line 2179 · raw
@+now:0x05acb84fe7d232c08b57d385772acf76/pure.Instant -> @m:Maybe<&2, U32> -> Maybe<&2, 0x05acb84fe7d232c08b57d385772acf76/pure.Instant>
Zero or less is the earliest time, so the cookie is already expired.
def cookie.max_age source · line 2187 · raw
@+v:String -> Maybe<&2, U32>
§5.6.2: DIGIT*, or "-" and DIGIT*. Anything else is ignored.
def cookie.same_site source · line 2190 · raw
@+v:String -> String
def cookie.av.kind source · line 2204 · raw
@+k:String -> Av
def cookie.av.put source · line 2208 · 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 2228 · 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 2233 · raw
@xs:List<&2, String> -> @a:Cav -> Cav
def cookie.nv source · line 2241 · 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 2249 · raw
@+s:String -> @+p:String -> Bool
def cookie.domain.of source · line 2255 · 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 2262 · raw
@p:Maybe<&2, String> -> @+req:String -> String
def cookie.make.dm source · line 2270 · 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, 0x05acb84fe7d232c08b57d385772acf76/pure.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 2282 · raw
@+now:0x05acb84fe7d232c08b57d385772acf76/pure.Instant -> @m:Maybe<&2, U32> -> @e:Maybe<&2, 0x05acb84fe7d232c08b57d385772acf76/pure.Instant> -> Maybe<&2, 0x05acb84fe7d232c08b57d385772acf76/pure.Instant>
Max-Age wins over Expires, whatever their order (§5.7 step 6). Both count from now.
def cookie.make source · line 2285 · raw
@+now:0x05acb84fe7d232c08b57d385772acf76/pure.Instant -> @a:0x1f2d80f53f971b16c6de6a65cb1918ae/url.Abs -> @+name:String -> @+value:String -> @c:Cav -> Maybe<&2, Cookie>
def cookie.parse.nv source · line 2291 · raw
@+now:0x05acb84fe7d232c08b57d385772acf76/pure.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 2295 · raw
@+now:0x05acb84fe7d232c08b57d385772acf76/pure.Instant -> @a:0x1f2d80f53f971b16c6de6a65cb1918ae/url.Abs -> @xs:List<&2, String> -> Maybe<&2, Cookie>
def cookie.parse source · line 2303 · raw
@+now:0x05acb84fe7d232c08b57d385772acf76/pure.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 2306 · raw
@a:0x1f2d80f53f971b16c6de6a65cb1918ae/url.Abs -> Bool
def cookie.secure source · line 2310 · raw
@c:Cookie -> Bool
def cookie.same source · line 2315 · 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 2321 · 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 2326 · raw
@cs:List<&2, Cookie> -> @+c:Cookie -> Bool
def cookie.put source · line 2335 · 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 2342 · raw
@m:Maybe<&2, Cookie> -> @j:Jar -> @+https:Bool -> Jar
def jar.put.one source · line 2351 · raw
@j:Jar -> @+a:0x1f2d80f53f971b16c6de6a65cb1918ae/url.Abs -> @x:String -> Jar
def jar.put.all source · line 2355 · raw
@xs:List<&2, String> -> @j:Jar -> @+a:0x1f2d80f53f971b16c6de6a65cb1918ae/url.Abs -> Jar
def jar.store.abs source · line 2363 · 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 2366 · raw
@j:Jar -> @u:Maybe<&2, 0x1f2d80f53f971b16c6de6a65cb1918ae/url.Abs> -> @+h:Map<&2, List<&2, String>> -> Jar
def jar.store source · line 2375 · 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 2380 · 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 2384 · raw
@cs:List<&2, Cookie> -> @+host:String -> @+path:String -> @+https:Bool -> List<&2, Cookie>
def cookie.longer source · line 2392 · 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 2397 · raw
@c:Cookie -> String
def cookie.pairs source · line 2401 · raw
@cs:List<&2, Cookie> -> List<&2, String>
def jar.string source · line 2409 · 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 2415 · 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 2419 · 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 2428 · 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 2432 · 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 2439 · 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 2447 · 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 fetch.boxed source · line 2458 · raw
@r:Result<&1, &1, Err, Res> -> @none:Bool -> Out
def fetch.rt source · line 2470 · raw
@+n:U32 -> @t:Rt -> Fl
def fetch.over source · line 2480 · raw
@+n:U32 -> Bool
64 KiB of head past the body cap, as serve allows.
def fetch.piece.cap source · line 2483 · raw
@over:Bool -> @+head:Bool -> @rv:Rv -> @+n2:U32 -> @+len:U32 -> @buf:Array<U32> -> Fl
def fetch.piece source · line 2490 · raw
@+head:Bool -> @rv:Rv -> @+n:U32 -> @p:Pair(U32, Array<U32>) -> Fl
def fetch.next source · line 2495 · 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.tup source · line 2504 · raw
@o:Out -> Pair(Maybe<&1, Socket>, Pair(Result<&1, &1, Err, Res>, 0x3f4d48cfd4df31741ee4b528a4e7773e/bytes.Bytes))
Reads until the response is whole or cannot be; an empty read means the server closed.
def pool.key source · line 2537 · raw
@+scheme:String -> @+host:String -> @+port:U32 -> String
def pool.key.cert source · line 2540 · raw
@+base:String -> @cert:Maybe<&2, Cert> -> String
def pool.key.ca source · line 2548 · raw
@+base:String -> @+ca:String -> @empty:Bool -> String
def pool.key.trust source · line 2555 · raw
@+base:String -> @cert:Maybe<&2, Cert> -> @+ca:String -> String
def pool.idempotent source · line 2558 · raw
@+method:String -> Bool
def proxy.auth.safe source · line 2561 · raw
@s:String -> Bool
def proxy.auth.checked source · line 2568 · raw
@+decoded:String -> @valid:Bool -> Maybe<&2, String>
def proxy.auth.value source · line 2575 · raw
@m:Maybe<&2, String> -> Maybe<&2, String>
def proxy.from.abs source · line 2582 · raw
@authorization:String -> @m:Maybe<&2, 0x1f2d80f53f971b16c6de6a65cb1918ae/url.Abs> -> Maybe<&2, Proxy>
def proxy.from.user source · line 2589 · raw
@user:String -> @host:String -> Maybe<&2, Proxy>
def proxy.from.authority source · line 2594 · raw
@has_user:Bool -> @authority:String -> @split:Pair(String, String) -> Maybe<&2, Proxy>
def proxy.from.parts source · line 2603 · raw
@parts:Pair(String, String) -> Maybe<&2, Proxy>
def proxy.from.url.if source · line 2611 · raw
@valid:Bool -> @raw:String -> Maybe<&2, Proxy>
def proxy.from.url source · line 2618 · raw
@+raw:String -> Maybe<&2, Proxy>
def proxy.no.domain source · line 2621 · raw
@+host:String -> @+suffix:String -> Bool
def proxy.no.suffix source · line 2624 · raw
@+host:String -> @+raw:String -> Bool
def proxy.no.port source · line 2631 · raw
@valid:Bool -> @+host:String -> @suffix:String -> Bool
def proxy.no.named source · line 2638 · raw
@+host:String -> @+port:U32 -> @parts:Pair(String, String) -> Bool
def proxy.no.literal source · line 2646 · raw
@+host:String -> @+port:U32 -> @+name:String -> Bool
def proxy.no.token source · line 2651 · raw
@+host:String -> @+port:U32 -> @token:String -> Bool
def proxy.no.list source · line 2658 · raw
@xs:List<&2, String> -> @+host:String -> @+port:U32 -> Bool
def proxy.no_match source · line 2665 · raw
@+host:String -> @+port:U32 -> @no_proxy:String -> Bool
def proxy.env.value source · line 2668 · raw
@r:Result<&1, &1, Pair(U32, String), String> -> String
def proxy.from.env source · line 2675 · raw
@value:String -> Maybe<&2, Proxy>
def proxy.choose source · line 2682 · raw
@bypass:Bool -> @value:String -> Maybe<&2, Proxy>
def h2.header.skip source · line 2689 · raw
@+name:String -> Bool
def h2.header.mode source · line 2699 · raw
@+name:String -> U32
def h2.header.tokens source · line 2705 · raw
@vs:List<&2, String> -> List<&2, String>
def h2.header.nominated.one source · line 2712 · raw
@enabled:Bool -> @vs:List<&2, String> -> @rest:List<&2, String> -> List<&2, String>
def h2.header.nominated source · line 2720 · raw
@xs:List<&2, Sigma<&2, &2, String, _ => List<&2, String>>> -> List<&2, String>
def h2.header.has source · line 2729 · raw
@xs:List<&2, String> -> @+key:String -> Bool
def h2.response.status.value source · line 2736 · raw
@+value:String -> @valid:Bool -> Maybe<&2, U32>
def h2.buffered.head.result source · line 2743 · raw
@r:Result<&1, &1, Err, Maybe<&1, Res>> -> Maybe<&1, Res>
def proxy.connect.frame source · line 2750 · raw
@raw:String -> @over:Bool -> Frame
def proxy.connect.chunk source · line 2757 · raw
@empty:Bool -> @s:Socket -> @raw:String -> @+len:U32 -> @buf:Array<U32> -> TunnelStep
def proxy.connect.header source · line 2765 · raw
@+authority:String -> @authorization:String -> String
def pool.retry source · line 2773 · raw
@+none:Bool -> @+idem:Bool -> Bool
def proxy.http.headers source · line 2776 · raw
@headers:Map<&2, List<&2, String>> -> @authorization:String -> Map<&2, List<&2, String>>
def proxy.absolute source · line 2784 · raw
@scheme:String -> @host_field:String -> @target:String -> String
def proxy.request source · line 2787 · raw
@secure:Bool -> @+scheme:String -> @method:String -> @+target:String -> @+hf:String -> @headers:Map<&2, List<&2, String>> -> @body:0x3f4d48cfd4df31741ee4b528a4e7773e/bytes.Bytes -> @authorization:String -> Send
def origin.route source · line 2799 · raw
@+method:String -> @headers:Map<&2, List<&2, String>> -> @body:0x3f4d48cfd4df31741ee4b528a4e7773e/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.scheme.ok source · line 2818 · raw
@a:0x1f2d80f53f971b16c6de6a65cb1918ae/url.Abs -> Bool
def fetch.hop source · line 2833 · raw
@left:Nat -> @h:Hop -> Next
left: redirects still allowed after the request we just finished.
def fetch.decide.r source · line 2840 · raw
@left:Nat -> @r:Res -> @next:Maybe<&1, Hop> -> Next
def fetch.decide.res source · line 2847 · raw
@left:Nat -> @h:Hop -> @r:Res -> Next
def fetch.decide source · line 2851 · raw
@left:Nat -> @h:Hop -> @m:Result<&1, &1, Err, Res> -> Next
def fetch.error.res source · line 2858 · raw
@r:Res -> @bad:Bool -> Next
def fetch.error source · line 2865 · raw
@h:Hop -> @m:Result<&1, &1, Err, Res> -> Next
def fetch.policy source · line 2873 · raw
@mode:Mode -> @left:Nat -> @h:Hop -> @m:Result<&1, &1, Err, Res> -> Next
def accept.enc source · line 2883 · 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 2886 · raw
@method:String -> @headers:Map<&2, List<&2, String>> -> @body:0x3f4d48cfd4df31741ee4b528a4e7773e/bytes.Bytes -> @u:Maybe<&2, 0x1f2d80f53f971b16c6de6a65cb1918ae/url.Abs> -> @+enc:String -> Next
def pool.next.ca source · line 2894 · raw
@same:Bool -> @+ca:String -> String
The redirect loop's state: the pool, what to do next, the client identity, the jar, and the CA file.
def next.trust source · line 2902 · 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 ce.keep source · line 2913 · raw
@+w:String -> @+rest:List<&2, String> -> List<&2, String>
def ce.norm source · line 2916 · raw
@xs:List<&2, String> -> List<&2, String>
def ce.split source · line 2923 · raw
@xs:List<&2, String> -> List<&2, String>
def ce.of source · line 2936 · raw
@m:Maybe<&1, 0x3f4d48cfd4df31741ee4b528a4e7773e/bytes.Bytes> -> Dec
def ce.deflate.raw source · line 2944 · raw
@b:0x3f4d48cfd4df31741ee4b528a4e7773e/bytes.Bytes -> @m:Maybe<&1, 0x3f4d48cfd4df31741ee4b528a4e7773e/bytes.Bytes> -> Dec
Servers send deflate both with and without the zlib wrapper.
def ce.deflate.of source · line 2951 · raw
@r:Pair(0x3f4d48cfd4df31741ee4b528a4e7773e/bytes.Bytes, 0x3f4d48cfd4df31741ee4b528a4e7773e/bytes.Bytes) -> Dec
def ce.deflate source · line 2955 · raw
@b:0x3f4d48cfd4df31741ee4b528a4e7773e/bytes.Bytes -> Dec
def ce.apply.id source · line 2958 · raw
@on:Bool -> @b:0x3f4d48cfd4df31741ee4b528a4e7773e/bytes.Bytes -> Dec
def ce.apply.de source · line 2965 · raw
@on:Bool -> @+c:String -> @b:0x3f4d48cfd4df31741ee4b528a4e7773e/bytes.Bytes -> Dec
def ce.apply.gz source · line 2972 · raw
@on:Bool -> @+c:String -> @b:0x3f4d48cfd4df31741ee4b528a4e7773e/bytes.Bytes -> Dec
def ce.apply source · line 2979 · raw
@+c:String -> @b:0x3f4d48cfd4df31741ee4b528a4e7773e/bytes.Bytes -> Dec
def ce.go source · line 2982 · raw
@cs:List<&2, String> -> @d:Dec -> Dec
def decoded.pick source · line 2995 · raw
@d:Dec -> @+status:U32 -> @headers:Map<&2, List<&2, String>> -> @body:0x3f4d48cfd4df31741ee4b528a4e7773e/bytes.Bytes -> Result<&1, &1, Err, Res>
def decoded.both source · line 3005 · raw
@+status:U32 -> @+headers:Map<&2, List<&2, String>> -> @cs:List<&2, String> -> @r:Pair(0x3f4d48cfd4df31741ee4b528a4e7773e/bytes.Bytes, 0x3f4d48cfd4df31741ee4b528a4e7773e/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 3009 · raw
@+status:U32 -> @+headers:Map<&2, List<&2, String>> -> @body:0x3f4d48cfd4df31741ee4b528a4e7773e/bytes.Bytes -> @cs:List<&2, String> -> Result<&1, &1, Err, Res>
def decoded.go source · line 3016 · raw
@empty:Bool -> @+status:U32 -> @+headers:Map<&2, List<&2, String>> -> @body:0x3f4d48cfd4df31741ee4b528a4e7773e/bytes.Bytes -> Result<&1, &1, Err, Res>
def decoded source · line 3024 · 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 3029 · raw
@r:Result<&1, &1, Err, Res> -> Maybe<&1, Res>
def decoded.some source · line 3036 · raw
@res:Res -> Maybe<&1, Res>
def ce.words source · line 3039 · raw
@r:Result<&1, &1, Pair(U32, String), 0x3f4d48cfd4df31741ee4b528a4e7773e/bytes.Bytes> -> Maybe<&1, 0x3f4d48cfd4df31741ee4b528a4e7773e/bytes.Bytes>
def ce.dec source · line 3047 · raw
@d:Dec -> Maybe<&1, 0x3f4d48cfd4df31741ee4b528a4e7773e/bytes.Bytes>
A decoded body stops at 16 MiB, like a received one.
def ce.has source · line 3057 · raw
@xs:List<&2, String> -> @+c:String -> Bool
ponytail: deflate runs on the pure decoder, which also takes raw DEFLATE; servers rarely send it.
def ce.known source · line 3064 · raw
@cs:List<&2, String> -> @+ok:List<&2, String> -> Bool
def decoded.io.pick source · line 3071 · raw
@m:Maybe<&1, 0x3f4d48cfd4df31741ee4b528a4e7773e/bytes.Bytes> -> @+status:U32 -> @headers:Map<&2, List<&2, String>> -> Result<&1, &1, Err, Res>
def codings.ok source · line 3078 · raw
@r:Result<&1, &1, Pair(U32, String), 0x3f4d48cfd4df31741ee4b528a4e7773e/bytes.Bytes> -> Bool
def codings.add source · line 3085 · raw
@has:Bool -> @+enc:String -> @+c:String -> String
def resolve.show source · line 3092 · raw
@a:0x1f2d80f53f971b16c6de6a65cb1918ae/url.Abs -> String
def resolve.to source · line 3096 · raw
@m:Maybe<&2, 0x1f2d80f53f971b16c6de6a65cb1918ae/url.Abs> -> Maybe<&2, String>
def resolve.base source · line 3103 · raw
@m:Maybe<&2, 0x1f2d80f53f971b16c6de6a65cb1918ae/url.Abs> -> @+ref:String -> Maybe<&2, String>
def resolve source · line 3110 · raw
@base:String -> @+ref:String -> Maybe<&2, String>
def retry.cap source · line 3115 · 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 3118 · raw
@n:Nat -> U32
def retry.backoff.half source · line 3125 · raw
@+half:U32 -> @+r:U32 -> U32
def retry.backoff source · line 3128 · raw
@n:Nat -> @+r:U32 -> U32
def retry.after.ms source · line 3132 · raw
@+ms:0x4eed9d7ac6ece61523d747a9d804e4f0/int.I64 -> U32
ms clamped to 0 .. retry.cap().
def retry.after.date source · line 3136 · raw
@m:Maybe<&2, 0x05acb84fe7d232c08b57d385772acf76/pure.Instant> -> @now:0x05acb84fe7d232c08b57d385772acf76/pure.Instant -> Maybe<&2, U32>
def retry.after.secs source · line 3144 · raw
@+v:String -> @now:0x05acb84fe7d232c08b57d385772acf76/pure.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 3153 · raw
@+v:String -> @now:0x05acb84fe7d232c08b57d385772acf76/pure.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 3156 · raw
@m:Maybe<&2, U32> -> @n:Nat -> @+r:U32 -> U32
def retry.delay source · line 3164 · raw
@+v:String -> @now:0x05acb84fe7d232c08b57d385772acf76/pure.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 3168 · raw
@+s:U32 -> Bool
Statuses a later try may clear.
def retry.fail source · line 3173 · 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 3182 · raw
@res:Res -> Pair(Result<&1, &1, Err, Res>, Maybe<&2, String>)
def retry.judge.try source · line 3186 · raw
@r:Result<&1, &1, Err, Res> -> Pair(Result<&1, &1, Err, Res>, Maybe<&2, String>)
def retry.judge source · line 3195 · 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 3203 · 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.kept source · line 3210 · raw
@body:0x3f4d48cfd4df31741ee4b528a4e7773e/bytes.Bytes -> @j:Pair(Result<&1, &1, Err, Res>, Maybe<&2, String>) -> Pair(0x3f4d48cfd4df31741ee4b528a4e7773e/bytes.Bytes, Pair(Result<&1, &1, Err, Res>, Maybe<&2, String>))
def pc.po source · line 3226 · raw
@more:Bool -> @empty:Bool -> @b:0x3f4d48cfd4df31741ee4b528a4e7773e/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 3233 · raw
@more:Bool -> @+rb:Rb -> @b:0x3f4d48cfd4df31741ee4b528a4e7773e/bytes.Bytes -> Pc
def pc.fed.of source · line 3237 · raw
@b:0x3f4d48cfd4df31741ee4b528a4e7773e/bytes.Bytes -> @st:Rb -> Pc
def pc.fed source · line 3250 · raw
@bf:Bf -> Pc
def pc.of source · line 3255 · raw
@rb:Rb -> @piece:0x3f4d48cfd4df31741ee4b528a4e7773e/bytes.Bytes -> Pc
The body bytes that just arrived: what they add to the body, and how it ends.
def pc.end source · line 3259 · raw
@ok:Bool -> Pc
The server closed. Only a close-delimited body may end this way (RFC 9112 §8).
def pc.eof source · line 3266 · raw
@st:Rb -> Pc
def stream.pc.of source · line 3270 · raw
@bf:Bf -> Pair(Pc, Bool)
pc.of, and whether bytes came past the end of the body.
def stream.pc source · line 3275 · raw
@rb:Rb -> @piece:0x3f4d48cfd4df31741ee4b528a4e7773e/bytes.Bytes -> Pair(Pc, Bool)
def stream.after source · line 3279 · raw
@+rb:Rb -> Po
Bytes past the body put the socket out of step with the server, so it cannot go back to a pool.
def stream.ready source · line 3292 · raw
@empty:Bool -> @+rb:Rb -> @b:0x3f4d48cfd4df31741ee4b528a4e7773e/bytes.Bytes -> Po
def stream.finish.ok source · line 3299 · raw
@r:Result<&1, &1, Pair(U32, String), Unit> -> Bool
def stream.po.end source · line 3306 · raw
@out:Po -> Bool
def stream.rb.done source · line 3313 · raw
@+rb:Rb -> Bool
def sh.of source · line 3325 · raw
@hs:Hs -> Sh
def sh.none source · line 3336 · raw
@buf:0x3f4d48cfd4df31741ee4b528a4e7773e/bytes.Bytes -> @+k:U32 -> Bool
def sh.piece source · line 3340 · raw
@+head:Bool -> @buf:0x3f4d48cfd4df31741ee4b528a4e7773e/bytes.Bytes -> @+k:U32 -> @p:Pair(U32, Array<U32>) -> Sh
def sh.next source · line 3345 · raw
@+head:Bool -> @buf:0x3f4d48cfd4df31741ee4b528a4e7773e/bytes.Bytes -> @+k:U32 -> @m:Pair(Socket, Result<&1, &1, Pair(U32, String), Pair(U32, Array<U32>)>) -> Pair(Socket, Sh)
def stream.back source · line 3353 · raw
@back:Maybe<&2, String> -> @+rb:Rb -> @+headers:Map<&2, List<&2, String>> -> Maybe<&2, String>
def hex.digit source · line 3360 · raw
@+n:U32 -> Char
def hex.go source · line 3363 · raw
@k:Nat -> @+n:U32 -> @acc:String -> String
def hex.trim source · line 3370 · raw
@+s:String -> String
def hex source · line 3377 · raw
@+n:U32 -> String
def up.sent source · line 3380 · raw
@+tls:Bool -> @+ms:U32 -> @+head:Bool -> @m:Pair(Socket, Result<&1, &1, Pair(U32, String), Unit>) -> Up
def up.head source · line 3388 · raw
@+method:String -> @+target:String -> @+hf:String -> @+headers:Map<&2, List<&2, String>> -> String
def up.wrote source · line 3391 · 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 limits.representable source · line 3412 · 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 source · line 3415 · raw
@max:Nat -> Limits
def limits.config source · line 3418 · raw
@config:ServerConfig -> Limits
def phase.new source · line 3426 · raw
@+kind:U32 -> @ms:U32 -> @now:0x05acb84fe7d232c08b57d385772acf76/pure.Duration -> Phase
def phase.remaining source · line 3429 · raw
@+until:0x05acb84fe7d232c08b57d385772acf76/pure.Duration -> @+now:0x05acb84fe7d232c08b57d385772acf76/pure.Duration -> U32
def bounded.sent source · line 3433 · raw
@m:Pair(Socket, Pair(U32, Result<&1, &1, Pair(U32, String), Unit>)) -> Pair(Socket, Result<&1, &1, Pair(U32, String), Unit>)
def reply.bytes source · line 3437 · raw
@res:Res -> @head:Bool -> @close:Bool -> 0x3f4d48cfd4df31741ee4b528a4e7773e/bytes.Bytes
def reply.fail.bytes source · line 3441 · raw
@+status:U32 -> Res
def reply.drain.of source · line 3444 · raw
@m:Pair(Socket, Result<&1, &1, Pair(U32, String), Pair(U32, Array<U32>)>) -> Pair(Socket, Bool)
def serve.max source · line 3471 · raw
Nat
def sv.none source · line 3474 · raw
Sv
def sv.body source · line 3477 · raw
@req:Req -> @+v11:Bool -> @parts:List<&1, 0x3f4d48cfd4df31741ee4b528a4e7773e/bytes.Bytes> -> @rest:0x3f4d48cfd4df31741ee4b528a4e7773e/bytes.Bytes -> Turn
def sv.len.cut source · line 3481 · raw
@req:Req -> @+v11:Bool -> @parts:List<&1, 0x3f4d48cfd4df31741ee4b528a4e7773e/bytes.Bytes> -> @+len:U32 -> @+left:U32 -> @r:Pair(0x3f4d48cfd4df31741ee4b528a4e7773e/bytes.Bytes, 0x3f4d48cfd4df31741ee4b528a4e7773e/bytes.Bytes) -> Turn
def sv.len.have source · line 3485 · raw
@short:Bool -> @req:Req -> @+v11:Bool -> @+left:U32 -> @parts:List<&1, 0x3f4d48cfd4df31741ee4b528a4e7773e/bytes.Bytes> -> @+len:U32 -> @piece:0x3f4d48cfd4df31741ee4b528a4e7773e/bytes.Bytes -> Turn
def sv.len source · line 3492 · raw
@req:Req -> @+v11:Bool -> @+left:U32 -> @parts:List<&1, 0x3f4d48cfd4df31741ee4b528a4e7773e/bytes.Bytes> -> @piece:0x3f4d48cfd4df31741ee4b528a4e7773e/bytes.Bytes -> Turn
def sv.chunk.of source · line 3496 · raw
@req:Req -> @+v11:Bool -> @+n:U32 -> @c:Ck -> Turn
def sv.chunk.parts.cons source · line 3518 · raw
@+len:U32 -> @buf:Array<U32> -> @counted:Pair(List<&1, 0x3f4d48cfd4df31741ee4b528a4e7773e/bytes.Bytes>, Nat) -> Pair(List<&1, 0x3f4d48cfd4df31741ee4b528a4e7773e/bytes.Bytes>, Nat)
def sv.chunk.parts source · line 3522 · raw
@xs:List<&1, 0x3f4d48cfd4df31741ee4b528a4e7773e/bytes.Bytes> -> @old:List<&1, 0x3f4d48cfd4df31741ee4b528a4e7773e/bytes.Bytes> -> Pair(List<&1, 0x3f4d48cfd4df31741ee4b528a4e7773e/bytes.Bytes>, Nat)
def sv.chunk.cap source · line 3530 · raw
@big:Bool -> @req:Req -> @+v11:Bool -> @n:U32 -> @st:Dc -> @parts:List<&1, 0x3f4d48cfd4df31741ee4b528a4e7773e/bytes.Bytes> -> @rest:0x3f4d48cfd4df31741ee4b528a4e7773e/bytes.Bytes -> Turn
def sv.chunk.counted source · line 3537 · raw
@+max:Nat -> @req:Req -> @v11:Bool -> @n:U32 -> @st:Dc -> @rest:0x3f4d48cfd4df31741ee4b528a4e7773e/bytes.Bytes -> @counted:Pair(List<&1, 0x3f4d48cfd4df31741ee4b528a4e7773e/bytes.Bytes>, Nat) -> Turn
def sv.chunk.decoded source · line 3543 · raw
@max:Nat -> @req:Req -> @v11:Bool -> @n:U32 -> @old:List<&1, 0x3f4d48cfd4df31741ee4b528a4e7773e/bytes.Bytes> -> @c:Ck -> Turn
def sv.chunk source · line 3547 · raw
@+max:Nat -> @req:Req -> @+v11:Bool -> @+n:U32 -> @st:Dc -> @parts:List<&1, 0x3f4d48cfd4df31741ee4b528a4e7773e/bytes.Bytes> -> @piece:0x3f4d48cfd4df31741ee4b528a4e7773e/bytes.Bytes -> Turn
def sv.cont source · line 3551 · 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 3564 · raw
@big:Bool -> @req:Req -> @+v11:Bool -> @+k:U32 -> @rest:0x3f4d48cfd4df31741ee4b528a4e7773e/bytes.Bytes -> Turn
def sv.cl source · line 3571 · raw
@+max:Nat -> @req:Req -> @+v11:Bool -> @rest:0x3f4d48cfd4df31741ee4b528a4e7773e/bytes.Bytes -> @n:Maybe<&2, U32> -> Turn
def sv.frame source · line 3578 · raw
@+max:Nat -> @req:Req -> @+v11:Bool -> @rest:0x3f4d48cfd4df31741ee4b528a4e7773e/bytes.Bytes -> @te:Bool -> Turn
def sv.expects source · line 3586 · raw
@+v11:Bool -> @+headers:Map<&2, List<&2, String>> -> Bool
def sv.got.head source · line 3589 · raw
@+max:Nat -> @+v11:Bool -> @rest:0x3f4d48cfd4df31741ee4b528a4e7773e/bytes.Bytes -> @req:Req -> Turn
def sv.parsed source · line 3593 · raw
@+max:Nat -> @+v11:Bool -> @rest:0x3f4d48cfd4df31741ee4b528a4e7773e/bytes.Bytes -> @g:Got -> Turn
def sv.split source · line 3604 · raw
@+max:Nat -> @+hlen:U32 -> @+len:U32 -> @r:Pair(0x3f4d48cfd4df31741ee4b528a4e7773e/bytes.Bytes, 0x3f4d48cfd4df31741ee4b528a4e7773e/bytes.Bytes) -> Turn
def sv.hit.none source · line 3609 · raw
@big:Bool -> @buf:0x3f4d48cfd4df31741ee4b528a4e7773e/bytes.Bytes -> Turn
def sv.hit.some source · line 3616 · raw
@big:Bool -> @+max:Nat -> @+hlen:U32 -> @+len:U32 -> @buf:0x3f4d48cfd4df31741ee4b528a4e7773e/bytes.Bytes -> Turn
def sv.hit source · line 3624 · raw
@+max:Nat -> @+headers:U32 -> @+len:U32 -> @buf:0x3f4d48cfd4df31741ee4b528a4e7773e/bytes.Bytes -> @at:Maybe<&2, U32> -> Turn
RFC 6585 §5: refuse a head over the configured byte limit.
def sv.seek.of source · line 3632 · raw
@+max:Nat -> @+headers:U32 -> @+len:U32 -> @+from:U32 -> @buf:0x3f4d48cfd4df31741ee4b528a4e7773e/bytes.Bytes -> @r:Pair(0x3f4d48cfd4df31741ee4b528a4e7773e/bytes.Bytes, Maybe<&2, U32>) -> Turn
def sv.seek source · line 3636 · raw
@+max:Nat -> @+headers:U32 -> @+len:U32 -> @+from:U32 -> @r:Pair(0x3f4d48cfd4df31741ee4b528a4e7773e/bytes.Bytes, 0x3f4d48cfd4df31741ee4b528a4e7773e/bytes.Bytes) -> Turn
def sv.head.at source · line 3641 · raw
@+max:Nat -> @+headers:U32 -> @+from:U32 -> @buf:0x3f4d48cfd4df31741ee4b528a4e7773e/bytes.Bytes -> Turn
Only the new bytes, and the 3 before them, can finish the blank line.
def sv.head source · line 3645 · raw
@+max:Nat -> @+headers:U32 -> @buf:0x3f4d48cfd4df31741ee4b528a4e7773e/bytes.Bytes -> @piece:0x3f4d48cfd4df31741ee4b528a4e7773e/bytes.Bytes -> Turn
def sv.closed.pick source · line 3649 · raw
@empty:Bool -> Turn
def sv.closed.head source · line 3656 · raw
@buf:0x3f4d48cfd4df31741ee4b528a4e7773e/bytes.Bytes -> Turn
def sv.step source · line 3661 · raw
@closed:Bool -> @+max:Nat -> @+headers:U32 -> @sv:Sv -> @piece:0x3f4d48cfd4df31741ee4b528a4e7773e/bytes.Bytes -> Turn
A close mid-request is a request cut short (RFC 9112 §8).
def sv.frame.req source · line 3680 · raw
@t:Turn -> Maybe<&1, Pair(String, String)>
def sv.frame.go source · line 3694 · raw
@xs:List<&2, String> -> @t:Turn -> Maybe<&1, Pair(String, String)>
def serve.frame source · line 3712 · 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 3715 · raw
@settings:Limits -> @sv:Sv -> @p:Pair(U32, Array<U32>) -> Turn
def talk.next source · line 3720 · 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 3728 · raw
@empty:Bool -> @settings:Limits -> @rest:0x3f4d48cfd4df31741ee4b528a4e7773e/bytes.Bytes -> Turn
def talk.after.rest source · line 3736 · raw
@settings:Limits -> @rest:0x3f4d48cfd4df31741ee4b528a4e7773e/bytes.Bytes -> @s:Socket -> Pair(Socket, Turn)
def talk.after.keep source · line 3740 · raw
@keep:Bool -> @settings:Limits -> @rest:0x3f4d48cfd4df31741ee4b528a4e7773e/bytes.Bytes -> @s:Socket -> Pair(Socket, Turn)
def phase.head source · line 3747 · raw
@empty:Bool -> @settings:Limits -> @now:0x05acb84fe7d232c08b57d385772acf76/pure.Duration -> Phase
def phase.start source · line 3756 · raw
@settings:Limits -> @sv:Sv -> @now:0x05acb84fe7d232c08b57d385772acf76/pure.Duration -> Pair(Phase, Sv)
def phase.select source · line 3767 · raw
@settings:Limits -> @sv:Sv -> @now:0x05acb84fe7d232c08b57d385772acf76/pure.Duration -> @previous:Maybe<&2, Phase> -> Pair(Phase, Sv)
def phase.body source · line 3775 · raw
@previous:Maybe<&2, Phase> -> @settings:Limits -> @now:0x05acb84fe7d232c08b57d385772acf76/pure.Duration -> Phase
Buffered pipelined headers have already ended before upload callbacks run.
def phase.after source · line 3783 · raw
@+settings:Limits -> @+now:0x05acb84fe7d232c08b57d385772acf76/pure.Duration -> @+phase:Phase -> @t:Turn -> Pair(Turn, Phase)
def phase.expired source · line 3804 · raw
@phase:Phase -> Turn
def talk.received.state source · line 3808 · raw
@s:Socket -> @next:Pair(Turn, Phase) -> Pair(Pair(Socket, Turn), Phase)
def talk.received.phase source · line 3812 · raw
@settings:Limits -> @phase:Phase -> @now:0x05acb84fe7d232c08b57d385772acf76/pure.Duration -> @next:Pair(Socket, Turn) -> Pair(Pair(Socket, Turn), Phase)
def talk.received.late source · line 3816 · raw
@expired:Bool -> @+settings:Limits -> @+phase:Phase -> @now:0x05acb84fe7d232c08b57d385772acf76/pure.Duration -> @sv:Sv -> @m:Pair(Socket, Result<&1, &1, Pair(U32, String), Pair(U32, Array<U32>)>) -> Pair(Pair(Socket, Turn), Phase)
def talk.state source · line 3840 · raw
@received:Pair(Pair(Socket, Turn), Phase) -> Serving
def serve.write.state source · line 3844 · raw
@after:Maybe<&1, Pair(Socket, Turn)> -> Maybe<&1, Serving>
def admission.head source · line 3854 · raw
@req:Req -> Bool
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.turn.head source · line 3858 · raw
@turn:Turn -> Bool
def server.config source · line 3883 · raw
@host:String -> @port:U32 -> ServerConfig
Application-owned affine dependencies never enter this transport owner.
def server.config.with source · line 3886 · raw
@host:String -> @port:U32 -> @max:Nat -> ServerConfig
def server.deadline.valid source · line 3890 · raw
@+ms:U32 -> Bool
Host deadline effects use signed 32-bit milliseconds.
def server.config.valid source · line 3893 · raw
@config:ServerConfig -> Bool
def server.finished source · line 3910 · raw
@stopped:Bool -> @error:Pair(U32, String) -> @counts:ServerCounts -> ServerExit
def error.stopped source · line 3918 · raw
@error:Pair(U32, String) -> Bool
def error.capacity source · line 3922 · raw
@error:Pair(U32, String) -> Bool
def admission.ready source · line 3928 · raw
@t:Turn -> Pair(Bool, Turn)
A single recursive state machine avoids recursion hidden inside a template.
def writer.header.one source · line 3977 · 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 3984 · 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 3993 · raw
@headers:Map<&2, List<&2, String>> -> @length:Maybe<&2, U32> -> Pair(WriterMode, Map<&2, List<&2, String>>)
def writer.plan source · line 4000 · 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 4007 · raw
@settings:Limits -> @keep:Bool -> @rest:0x3f4d48cfd4df31741ee4b528a4e7773e/bytes.Bytes -> @socket:Maybe<&1, Socket> -> Maybe<&1, Pair(Socket, Turn)>
def writer.connection source · line 4014 · raw
@keep:Bool -> @headers:Map<&2, List<&2, String>> -> Map<&2, List<&2, String>>
Templates
template serve.stream.after source · line 3953 · raw
@-S:Type -> @next:Maybe<&1, Pair(Socket, Turn)> -> StreamServing<S>
template serve.stream.ready source · line 3960 · raw
@-S:Type -> @held:Bool -> @socket:Socket -> @phase:Maybe<&2, Phase> -> @state:Maybe<&1, Pair(S, Bool)> -> @result:Pair(Bool, Turn) -> StreamServing<S>