~/bend-docscommunity

http.bend relies on unsafe/foreign

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

9 imports
import Base
import ./storage.bend as S
import ./pure.bend as P
import bend-kit-http@0.44.0.1/http.bend as Http
import bend-kit-http@0.44.0.1/pure.bend as Pure
import bend-kit-http@0.44.0.1/completion.bend as Completion
import bend-kit-files@0.4.0.1/files.bend as Files
import bend-kit-bytes@0.3.3.1/bytes.bend as Bytes
import bend-kit-http@0.44.0.1/admission.bend as Admission

Types

type Source source · line 11 · raw

Type

type Transfer source · line 84 · raw

Type

type Step source · line 391 · raw

Type

Definitions

def response source · line 16 · raw

@status:U32 -> @body:0x447471668985e2b96a635a7780cac836/pure.Body -> 0x447471668985e2b96a635a7780cac836/http.WriteHead<Source>

Git's dumb HTTP object walk: immutable objects are fetched by digest from a known root.

def source.size source · line 20 · raw

@info:0x5fea041be86f1677bfed779e7579233f/files.Info -> 0x4712ead2d67c3a158b76998e2ea2d17e/storage.Run(U32)

def source source · line 29 · raw

@+path:String -> 0x4712ead2d67c3a158b76998e2ea2d17e/storage.Run(Pair(File, U32))

def served source · line 36 · raw

@result:Result<&1, &1, Pair(U32, String), Pair(File, U32)> -> IO(0x447471668985e2b96a635a7780cac836/http.WriteHead<Source>)

def object source · line 43 · raw

@+dir:String -> @digest:Maybe<&2, 0x4712ead2d67c3a158b76998e2ea2d17e/pure.Digest> -> IO(0x447471668985e2b96a635a7780cac836/http.WriteHead<Source>)

def route source · line 52 · raw

@valid:Bool -> @dir:String -> @path:String -> IO(0x447471668985e2b96a635a7780cac836/http.WriteHead<Source>)

def handle source · line 60 · raw

@dir:String -> @request:0x447471668985e2b96a635a7780cac836/pure.Req -> IO(0x447471668985e2b96a635a7780cac836/http.WriteHead<Source>)

Mount on a read-only store; freeze collection while the server serves its roots.

def dispose source · line 64 · raw

@state:Source -> IO(Unit)

def close.socket source · line 71 · raw

@socket:Maybe<&1, Socket> -> IO(Unit)

def send.failed source · line 78 · raw

@writer:0x447471668985e2b96a635a7780cac836/http.Writer -> @code:U32 -> @message:String -> IO(0x447471668985e2b96a635a7780cac836/http.Writer)

def send.piece source · line 88 · raw

@empty:Bool -> @file:File -> @+left:U32 -> @body:0xec25e4adfb02e59e4b817801115988ee/bytes.Bytes -> @writer:0x447471668985e2b96a635a7780cac836/http.Writer -> IO(Pair(Transfer, 0x447471668985e2b96a635a7780cac836/http.Writer))

def send.read source · line 101 · raw

@writer:0x447471668985e2b96a635a7780cac836/http.Writer -> @+left:U32 -> @pair:Pair(File, Result<&1, &1, Pair(U32, String), 0xec25e4adfb02e59e4b817801115988ee/bytes.Bytes>) -> IO(Pair(Transfer, 0x447471668985e2b96a635a7780cac836/http.Writer))

def send.step source · line 111 · raw

@empty:Bool -> @file:File -> @+left:U32 -> @writer:0x447471668985e2b96a635a7780cac836/http.Writer -> IO(Pair(Transfer, 0x447471668985e2b96a635a7780cac836/http.Writer))

def send source · line 129 · raw

@fuel:Nat -> @state:Pair(Transfer, 0x447471668985e2b96a635a7780cac836/http.Writer) -> IO(0x447471668985e2b96a635a7780cac836/http.Writer)

def write source · line 142 · raw

@state:Source -> @writer:0x447471668985e2b96a635a7780cac836/http.Writer -> @receipt:0x447471668985e2b96a635a7780cac836/completion.Receipt -> IO(Pair(0x447471668985e2b96a635a7780cac836/http.Writer, 0x447471668985e2b96a635a7780cac836/completion.Receipt))

def reject.admission source · line 153 · raw

@settings:0x447471668985e2b96a635a7780cac836/pure.Limits -> @receipt:0x447471668985e2b96a635a7780cac836/completion.Receipt -> @socket:Socket -> @head:Bool -> IO(Unit)

def reject source · line 173 · raw

@settings:0x447471668985e2b96a635a7780cac836/pure.Limits -> @receipt:0x447471668985e2b96a635a7780cac836/completion.Receipt -> @socket:Socket -> @status:U32 -> IO(Unit)

def Run source · line 208 · raw

@-A:Type -> Type

def Run.pure source · line 211 · raw

@-A:Type -> @x:A -> Run(A)

def Run.next source · line 214 · raw

@-A:Type -> @-B:Type -> @pair:Pair(0x447471668985e2b96a635a7780cac836/http.Pool, Result<&1, &1, Pair(U32, String), A>) -> @f:(@_:A -> Run(B)) -> IO(Pair(0x447471668985e2b96a635a7780cac836/http.Pool, Result<&1, &1, Pair(U32, String), B>))

def Run.bind source · line 222 · raw

@-A:Type -> @-B:Type -> @m:Run(A) -> @f:(@_:A -> Run(B)) -> Run(B)

def Run.lift source · line 225 · raw

@-A:Type -> @m:0x4712ead2d67c3a158b76998e2ea2d17e/storage.Run(A) -> Run(A)

def Run.close source · line 230 · raw

@-A:Type -> @pair:Pair(0x447471668985e2b96a635a7780cac836/http.Pool, Result<&1, &1, Pair(U32, String), A>) -> 0x4712ead2d67c3a158b76998e2ea2d17e/storage.Run(A)

def error source · line 237 · raw

@e:0x447471668985e2b96a635a7780cac836/pure.Err -> String

def copy.result source · line 258 · raw

@result:Result<&1, &1, 0x447471668985e2b96a635a7780cac836/pure.Err, Maybe<&1, 0x447471668985e2b96a635a7780cac836/pure.Body>> -> Result<&1, &1, Pair(U32, String), Maybe<&1, 0x447471668985e2b96a635a7780cac836/pure.Body>>

def copy.read source · line 265 · raw

@f:File -> @pair:Pair(0x447471668985e2b96a635a7780cac836/http.Stream, Result<&1, &1, 0x447471668985e2b96a635a7780cac836/pure.Err, Maybe<&1, 0x447471668985e2b96a635a7780cac836/pure.Body>>) -> Pair(0x447471668985e2b96a635a7780cac836/http.Stream, Pair(File, Result<&1, &1, Pair(U32, String), Maybe<&1, 0x447471668985e2b96a635a7780cac836/pure.Body>>))

def copy.next source · line 269 · raw

@st:0x447471668985e2b96a635a7780cac836/http.Stream -> @pair:Pair(File, Result<&1, &1, Pair(U32, String), Unit>) -> IO(Pair(0x447471668985e2b96a635a7780cac836/http.Stream, Pair(File, Result<&1, &1, Pair(U32, String), Maybe<&1, 0x447471668985e2b96a635a7780cac836/pure.Body>>)))

def copy.write source · line 279 · raw

@over:Bool -> @f:File -> @body:0x447471668985e2b96a635a7780cac836/pure.Body -> IO(Pair(File, Result<&1, &1, Pair(U32, String), Unit>))

def copy source · line 286 · raw

@fuel:Nat -> @pair:Pair(0x447471668985e2b96a635a7780cac836/http.Stream, Pair(File, Result<&1, &1, Pair(U32, String), Maybe<&1, 0x447471668985e2b96a635a7780cac836/pure.Body>>)) -> @+total:U32 -> IO(Pair(0x447471668985e2b96a635a7780cac836/http.Stream, Pair(File, Result<&1, &1, Pair(U32, String), Unit>)))

def status.result source · line 301 · raw

@good:Bool -> @message:String -> Result<&1, &1, Pair(U32, String), Unit>

def download.status source · line 308 · raw

@+status:U32 -> @st:0x447471668985e2b96a635a7780cac836/http.Stream -> @f:File -> IO(Pair(0x447471668985e2b96a635a7780cac836/http.Stream, Pair(File, Result<&1, &1, Pair(U32, String), Unit>)))

def download.path source · line 313 · raw

@tmp:String -> @result:Result<&1, &1, Pair(U32, String), Unit> -> Result<&1, &1, Pair(U32, String), String>

def download.closed source · line 320 · raw

@+tmp:String -> @pair:Pair(0x447471668985e2b96a635a7780cac836/http.Stream, Pair(File, Result<&1, &1, Pair(U32, String), Unit>)) -> IO(Pair(0x447471668985e2b96a635a7780cac836/http.Stream, Result<&1, &1, Pair(U32, String), String>))

def download.response source · line 327 · raw

@+tmp:String -> @f:File -> @pair:Pair(0x447471668985e2b96a635a7780cac836/http.Stream, 0x447471668985e2b96a635a7780cac836/pure.Res) -> IO(Pair(0x447471668985e2b96a635a7780cac836/http.Stream, Result<&1, &1, Pair(U32, String), String>))

def download.opened source · line 333 · raw

@st:0x447471668985e2b96a635a7780cac836/http.Stream -> @opened:Result<&1, &1, Pair(U32, String), Pair(String, File)> -> IO(Pair(0x447471668985e2b96a635a7780cac836/http.Stream, Result<&1, &1, Pair(U32, String), String>))

def download.idle source · line 340 · raw

@pool:0x447471668985e2b96a635a7780cac836/http.Pool -> @pair:Pair(0x447471668985e2b96a635a7780cac836/http.Stream, Result<&1, &1, Pair(U32, String), String>) -> IO(Pair(0x447471668985e2b96a635a7780cac836/http.Pool, Result<&1, &1, Pair(U32, String), String>))

def download.received source · line 346 · raw

@+dir:String -> @pair:Pair(0x447471668985e2b96a635a7780cac836/http.Pool, Result<&1, &1, 0x447471668985e2b96a635a7780cac836/pure.Err, 0x447471668985e2b96a635a7780cac836/http.Stream>) -> IO(Pair(0x447471668985e2b96a635a7780cac836/http.Pool, Result<&1, &1, Pair(U32, String), String>))

def download.context source · line 357 · raw

@+d:0x4712ead2d67c3a158b76998e2ea2d17e/pure.Digest -> @pair:Pair(0x447471668985e2b96a635a7780cac836/http.Pool, Result<&1, &1, Pair(U32, String), String>) -> Pair(0x447471668985e2b96a635a7780cac836/http.Pool, Result<&1, &1, Pair(U32, String), String>)

def download source · line 365 · raw

@base:String -> @dir:String -> @+d:0x4712ead2d67c3a158b76998e2ea2d17e/pure.Digest -> Run(String)

def publish source · line 371 · raw

@+tmp:String -> @path:String -> @d:0x4712ead2d67c3a158b76998e2ea2d17e/pure.Digest -> 0x4712ead2d67c3a158b76998e2ea2d17e/storage.Run(0x4712ead2d67c3a158b76998e2ea2d17e/pure.Obj<0x4712ead2d67c3a158b76998e2ea2d17e/pure.Digest, Unit>)

def publish.cleaned source · line 377 · raw

@+tmp:String -> @result:Result<&1, &1, Pair(U32, String), 0x4712ead2d67c3a158b76998e2ea2d17e/pure.Obj<0x4712ead2d67c3a158b76998e2ea2d17e/pure.Digest, Unit>> -> 0x4712ead2d67c3a158b76998e2ea2d17e/storage.Run(0x4712ead2d67c3a158b76998e2ea2d17e/pure.Obj<0x4712ead2d67c3a158b76998e2ea2d17e/pure.Digest, Unit>)

def receive source · line 386 · raw

@+dir:String -> @+d:0x4712ead2d67c3a158b76998e2ea2d17e/pure.Digest -> @+tmp:String -> 0x4712ead2d67c3a158b76998e2ea2d17e/storage.Run(0x4712ead2d67c3a158b76998e2ea2d17e/pure.Obj<0x4712ead2d67c3a158b76998e2ea2d17e/pure.Digest, Unit>)

def walk source · line 399 · raw

@fuel:Nat -> @+base:String -> @+dir:String -> @step:Step -> @+index:0x4712ead2d67c3a158b76998e2ea2d17e/pure.Index(0x4712ead2d67c3a158b76998e2ea2d17e/pure.Digest, Unit) -> @+sent:U32 -> Run(Pair(0x4712ead2d67c3a158b76998e2ea2d17e/pure.Index(0x4712ead2d67c3a158b76998e2ea2d17e/pure.Digest, Unit), U32))

The index holds only links and the visited set, never file payloads.

def complete source · line 427 · raw

@root:0x4712ead2d67c3a158b76998e2ea2d17e/pure.Digest -> @result:Pair(0x4712ead2d67c3a158b76998e2ea2d17e/pure.Index(0x4712ead2d67c3a158b76998e2ea2d17e/pure.Digest, Unit), U32) -> 0x4712ead2d67c3a158b76998e2ea2d17e/storage.Run(U32)

def sync source · line 434 · raw

@+base:String -> @+dir:String -> @+root:0x4712ead2d67c3a158b76998e2ea2d17e/pure.Digest -> 0x4712ead2d67c3a158b76998e2ea2d17e/storage.Run(U32)

base is an HTTP(S) origin without a trailing slash; root is supplied by the caller.

Templates

template admitted source · line 157 · raw

@-C:Data -> @-start:(@_:C -> @_:0x447471668985e2b96a635a7780cac836/pure.Req -> IO(0x447471668985e2b96a635a7780cac836/http.WriteHead<Source>)) -> @-observe:(@_:C -> @_:U32 -> @_:0x447471668985e2b96a635a7780cac836/completion.Outcome -> IO(Unit)) -> @allowed:Bool -> @+context:C -> @+inbox:Chan(0x447471668985e2b96a635a7780cac836/admission.Command) -> @+settings:0x447471668985e2b96a635a7780cac836/pure.Limits -> @socket:Socket -> @req:0x447471668985e2b96a635a7780cac836/pure.Req -> @rest:0xec25e4adfb02e59e4b817801115988ee/bytes.Bytes -> @v11:Bool -> IO(Maybe<&1, Pair(Socket, 0x447471668985e2b96a635a7780cac836/pure.Turn)>)

template server.run source · line 201 · raw

@-observe:(@_:String -> @_:U32 -> @_:0x447471668985e2b96a635a7780cac836/completion.Outcome -> IO(Unit)) -> @server:0x447471668985e2b96a635a7780cac836/http.Server<String> -> IO(0x447471668985e2b96a635a7780cac836/pure.ServerExit)

Unsafe

unsafe talk source · line 178 · raw

@-C:Data -> @-start:(@_:C -> @_:0x447471668985e2b96a635a7780cac836/pure.Req -> IO(0x447471668985e2b96a635a7780cac836/http.WriteHead<Source>)) -> @-observe:(@_:C -> @_:U32 -> @_:0x447471668985e2b96a635a7780cac836/completion.Outcome -> IO(Unit)) -> @+context:C -> @+settings:0x447471668985e2b96a635a7780cac836/pure.Limits -> @+inbox:Chan(0x447471668985e2b96a635a7780cac836/admission.Command) -> @state:Maybe<&1, 0x447471668985e2b96a635a7780cac836/pure.Serving> -> IO(Unit)