~/bend-docscommunity

src/hub/get.bend relies on unsafe/foreign

raw source on the hub · import ezx@1.18.0.0/src/hub/get.bend as Get

hub/get: a file fetched from the hub over ezhttp, or read off the disk for a file: url, and judged by hub/hub against the hash that names it. The GET lives apart from the judging because ezhttp reaches foreign code, and bend 2.0.32 fails a proof whose imports reach foreign code, so a law may import hub/hub but never this.

Trusted, not proved: HTTP framing and URL parsing are correct. Framing is proved in ezhttp v0.14.0, the rev ez.toml pins; ez's gate does not re-check it. ez's GET rests on ezhttp's laws/RequestLineAndHost.bend, laws/ResponseCompleteByFraming.bend, laws/ReadsJudgedByCount.bend, laws/ExchangeCarriesMethod.bend and laws/InterimResponsesSkipped.bend (the request it writes, when a response is complete, and reading it by the GET method), with what ezhttp trusts of the wire effect and the read loop (trusted in ezhttp's src/wire.bend and src/client.bend); ezhttp has no law for parse_url itself, so URL parsing stays trusted here. ez imports its interface, main.bend, and src/client.bend and src/url.bend for the two types whose constructors this file matches, which main.bend names but does not define.

7 imports
import Base
import ezhttp@0.26.0.0/main.bend as Http
import ezhttp@0.26.0.0/src/client.bend as Client
import ezhttp@0.26.0.0/src/url.bend as Url
import snap@1.6.0.0/main.bend as R
import ../io/file.bend as F
import ./hub.bend as Hub

Definitions

def get.reply source · line 29 · raw

@response:0x0b59049ea5717d6f2fd30293c7271ede/src/client.Response -> String

what ezhttp answered. It folds a socket that would not open and a reply that came apart into one Err, so both are 6.

def get.http source · line 37 · raw

@url:String -> IO(String)

a url fetched over a socket

def get.file source · line 43 · raw

@+path:String -> IO(String)

a file url read off the disk

def get.scheme source · line 49 · raw

@file:Bool -> @url:String -> @path:String -> IO(String)

a url whose scheme decides where the body comes from

def get.loc source · line 57 · raw

@loc:0x0b59049ea5717d6f2fd30293c7271ede/src/url.Loc -> @url:String -> IO(String)

a url that came apart, or the reason it did not

def get source · line 65 · raw

@+url:String -> IO(String)

the body at a url: "0" and the body, or a status and the reason

def fetch source · line 69 · raw

@+url:String -> @want:String -> IO(0x2414c9622cab2353684d02a392804eb1/src/hub/hub.Got)

the file at a url, accepted only when it hashes to want