src/wirespec.bend checks
raw source on the hub · import emerging-ezhttp@0.11.0.0/src/wirespec.bend as Wirespec
ezhttp/src/wirespec: the text the wire effect reads, and what its answer means, pure. Kept apart from wire.bend (the effect) so the proof gate can import it.
Spec: scheme, host, port each on their own line; everything after the third newline is the request verbatim. The scheme line may carry a timeout after a space: 32 binary digits, least significant first, in milliseconds. A scheme line with no timeout means 60000 ms. SPEC.md HTTP-CLI lists what is guaranteed.
1 import
import Base
Definitions
def wire.scheme source · line 13 · raw
@secure:Bool -> String
the word the effect reads for a scheme that wants TLS
def wire.spec source · line 21 · raw
@secure:Bool -> @host:String -> @port:U32 -> @req:String -> String
the spec the effect reads
def wire.ms.dflt source · line 27 · raw
U32
the timeout a spec with none carries: 60 s, in milliseconds
def wire.bit source · line 31 · raw
@b:Bool -> Char
one bit as a binary digit
def wire.bits source · line 39 · raw
@n:Nat -> @w:Word(n) -> String
a word as binary digits, least significant first
def wire.bits.read source · line 49 · raw
@n:Nat -> @s:String -> Word(n)
binary digits, least significant first, as a word; a missing digit is 0
def wire.ms.text source · line 61 · raw
@ms:U32 -> String
a timeout as the scheme line carries it
def wire.head source · line 67 · raw
@secure:Bool -> @ms:U32 -> String
the first line of a timed spec: the scheme, a space, the timeout
def wire.rest source · line 71 · raw
@host:String -> @port:U32 -> @req:String -> String
the lines after the first: host, port, then the request verbatim
def wire.spec.timed source · line 75 · raw
@secure:Bool -> @ms:U32 -> @host:String -> @port:U32 -> @req:String -> String
the spec the effect reads, with a timeout in milliseconds
def wire.ms.words source · line 80 · raw
@ws:List<&2, String> -> U32
the timeout after the scheme word, or the default when there is none
def wire.line source · line 90 · raw
@ls:List<&2, String> -> String
the first line of a spec
def wire.ms source · line 98 · raw
@spec:String -> U32
the timeout the effect reads from a spec, in milliseconds
def wire.late source · line 105 · raw
U32
the wire status for an exchange that ran out of time (curl's CURLE_OPERATION_TIMEDOUT)
def wire.why.of source · line 110 · raw
@why:String -> @late:Bool -> String
what a failed exchange is reported as: a timeout is marked, any other failure's reason is kept as it is
def wire.why source · line 118 · raw
@code:Maybe<&2, U32> -> @why:String -> String
a failed exchange's status and reason as the reason the client reports
def wire.timed_out source · line 126 · raw
@why:String -> Bool
whether a reported reason is a timeout