LAWS.bend open laws/TODOs
raw source on the hub · import bend-kube-runtime@0.2.0.0/LAWS.bend as LAWS
10 imports
import Base import ./src/json.bend as J import ./src/core.bend as C import ./src/watcher.bend as W import ./src/store.bend as S import ./src/queue.bend as Q import ./src/finalizer.bend as F import ./src/http.bend as H import ./src/utf8.bend as U import ./src/proxy.bend as P
Laws
law watch_gone_relists provedin PROOF.bendsource · line 23 · raw
@rv:String -> @f:U32 -> @first:Bool -> @r:String -> @m:String -> {0x3e7c8cdf5aa942d4279f8d34c4f1be54/src/watcher.Watcher.step(0x3e7c8cdf5aa942d4279f8d34c4f1be54/src/watcher.WState{0x3e7c8cdf5aa942d4279f8d34c4f1be54/src/watcher.WWatch{rv}, f, first}, 0x3e7c8cdf5aa942d4279f8d34c4f1be54/src/watcher.IEvent{0x3e7c8cdf5aa942d4279f8d34c4f1be54/src/core.WError{0x3e7c8cdf5aa942d4279f8d34c4f1be54/src/core.Status{410, r, m}}}) == 0x3e7c8cdf5aa942d4279f8d34c4f1be54/src/watcher.Step{0x3e7c8cdf5aa942d4279f8d34c4f1be54/src/watcher.WState{0x3e7c8cdf5aa942d4279f8d34c4f1be54/src/watcher.WList{""}, f, True{}}, [], False{}} : 0x3e7c8cdf5aa942d4279f8d34c4f1be54/src/watcher.Step}A watch that answers 410 Gone relists from scratch, at once.
law watch_request_gone_relists provedin PROOF.bendsource · line 33 · raw
@rv:String -> @f:U32 -> @first:Bool -> {0x3e7c8cdf5aa942d4279f8d34c4f1be54/src/watcher.Watcher.step(0x3e7c8cdf5aa942d4279f8d34c4f1be54/src/watcher.WState{0x3e7c8cdf5aa942d4279f8d34c4f1be54/src/watcher.WWatch{rv}, f, first}, 0x3e7c8cdf5aa942d4279f8d34c4f1be54/src/watcher.IWatchErr{410}) == 0x3e7c8cdf5aa942d4279f8d34c4f1be54/src/watcher.Step{0x3e7c8cdf5aa942d4279f8d34c4f1be54/src/watcher.WState{0x3e7c8cdf5aa942d4279f8d34c4f1be54/src/watcher.WList{""}, f, True{}}, [], False{}} : 0x3e7c8cdf5aa942d4279f8d34c4f1be54/src/watcher.Step}So does a watch request the server refuses with 410.
law list_gone_relists provedin PROOF.bendsource · line 41 · raw
@c:String -> @f:U32 -> @first:Bool -> {0x3e7c8cdf5aa942d4279f8d34c4f1be54/src/watcher.Watcher.step(0x3e7c8cdf5aa942d4279f8d34c4f1be54/src/watcher.WState{0x3e7c8cdf5aa942d4279f8d34c4f1be54/src/watcher.WList{c}, f, first}, 0x3e7c8cdf5aa942d4279f8d34c4f1be54/src/watcher.IListErr{410}) == 0x3e7c8cdf5aa942d4279f8d34c4f1be54/src/watcher.Step{0x3e7c8cdf5aa942d4279f8d34c4f1be54/src/watcher.WState{0x3e7c8cdf5aa942d4279f8d34c4f1be54/src/watcher.WList{""}, f, True{}}, [], False{}} : 0x3e7c8cdf5aa942d4279f8d34c4f1be54/src/watcher.Step}An expired continue token restarts the list from its first page.
law watch_error_backs_off provedin PROOF.bendsource · line 50 · raw
@rv:String -> @f:U32 -> @first:Bool -> {0x3e7c8cdf5aa942d4279f8d34c4f1be54/src/watcher.Watcher.step(0x3e7c8cdf5aa942d4279f8d34c4f1be54/src/watcher.WState{0x3e7c8cdf5aa942d4279f8d34c4f1be54/src/watcher.WWatch{rv}, f, first}, 0x3e7c8cdf5aa942d4279f8d34c4f1be54/src/watcher.IWatchErr{500}) == 0x3e7c8cdf5aa942d4279f8d34c4f1be54/src/watcher.Step{0x3e7c8cdf5aa942d4279f8d34c4f1be54/src/watcher.WState{0x3e7c8cdf5aa942d4279f8d34c4f1be54/src/watcher.WWatch{rv}, U32.add(f, 1), False{}}, [], True{}} : 0x3e7c8cdf5aa942d4279f8d34c4f1be54/src/watcher.Step}A failed watch request (not 410) retries from the same version after a backoff, counting the failure.
law watch_end_resumes provedin PROOF.bendsource · line 59 · raw
@rv:String -> @f:U32 -> @first:Bool -> {0x3e7c8cdf5aa942d4279f8d34c4f1be54/src/watcher.Watcher.step(0x3e7c8cdf5aa942d4279f8d34c4f1be54/src/watcher.WState{0x3e7c8cdf5aa942d4279f8d34c4f1be54/src/watcher.WWatch{rv}, f, first}, 0x3e7c8cdf5aa942d4279f8d34c4f1be54/src/watcher.IWatchEnd{}) == 0x3e7c8cdf5aa942d4279f8d34c4f1be54/src/watcher.Step{0x3e7c8cdf5aa942d4279f8d34c4f1be54/src/watcher.WState{0x3e7c8cdf5aa942d4279f8d34c4f1be54/src/watcher.WWatch{rv}, 0, False{}}, [], False{}} : 0x3e7c8cdf5aa942d4279f8d34c4f1be54/src/watcher.Step}A watch that ends (the server's timeout) resumes from the same version, with no backoff and no events.
law bookmark_advances provedin PROOF.bendsource · line 67 · raw
@rv:String -> @v:String -> @f:U32 -> @first:Bool -> {0x3e7c8cdf5aa942d4279f8d34c4f1be54/src/watcher.Watcher.step(0x3e7c8cdf5aa942d4279f8d34c4f1be54/src/watcher.WState{0x3e7c8cdf5aa942d4279f8d34c4f1be54/src/watcher.WWatch{rv}, f, first}, 0x3e7c8cdf5aa942d4279f8d34c4f1be54/src/watcher.IEvent{0x3e7c8cdf5aa942d4279f8d34c4f1be54/src/core.WBookmark{v}}) == 0x3e7c8cdf5aa942d4279f8d34c4f1be54/src/watcher.Step{0x3e7c8cdf5aa942d4279f8d34c4f1be54/src/watcher.WState{0x3e7c8cdf5aa942d4279f8d34c4f1be54/src/watcher.WWatch{v}, 0, False{}}, [], False{}} : 0x3e7c8cdf5aa942d4279f8d34c4f1be54/src/watcher.Step}A bookmark moves the resume version and emits nothing.
law last_page_watches provedin PROOF.bendsource · line 77 · raw
@c:String -> @f:U32 -> @first:Bool -> @items:List<&2, 0x3e7c8cdf5aa942d4279f8d34c4f1be54/src/json.Json> -> @rv:String -> {0x3e7c8cdf5aa942d4279f8d34c4f1be54/src/watcher.Watcher.step(0x3e7c8cdf5aa942d4279f8d34c4f1be54/src/watcher.WState{0x3e7c8cdf5aa942d4279f8d34c4f1be54/src/watcher.WList{c}, f, first}, 0x3e7c8cdf5aa942d4279f8d34c4f1be54/src/watcher.IPage{0x3e7c8cdf5aa942d4279f8d34c4f1be54/src/core.Page{items, rv, ""}}) == 0x3e7c8cdf5aa942d4279f8d34c4f1be54/src/watcher.Step{0x3e7c8cdf5aa942d4279f8d34c4f1be54/src/watcher.WState{0x3e7c8cdf5aa942d4279f8d34c4f1be54/src/watcher.WWatch{rv}, 0, True{}}, 0x3e7c8cdf5aa942d4279f8d34c4f1be54/src/watcher.Watcher.init_out(first, 0x3e7c8cdf5aa942d4279f8d34c4f1be54/src/watcher.Watcher.page_outs(items, [0x3e7c8cdf5aa942d4279f8d34c4f1be54/src/watcher.OInitDone{}])), False{}} : 0x3e7c8cdf5aa942d4279f8d34c4f1be54/src/watcher.Step}The last page of a list (no continue token) emits its objects, closes the relist with InitDone, and starts watching from the list's version.
law first_page_inits provedin PROOF.bendsource · line 88 · raw
@items:List<&2, 0x3e7c8cdf5aa942d4279f8d34c4f1be54/src/json.Json> -> {0x3e7c8cdf5aa942d4279f8d34c4f1be54/src/watcher.Watcher.init_out(True{}, 0x3e7c8cdf5aa942d4279f8d34c4f1be54/src/watcher.Watcher.page_outs(items, [])) == 0x3e7c8cdf5aa942d4279f8d34c4f1be54/src/watcher.OInit{} <> 0x3e7c8cdf5aa942d4279f8d34c4f1be54/src/watcher.Watcher.page_outs(items, []) : List<&2, 0x3e7c8cdf5aa942d4279f8d34c4f1be54/src/watcher.Out>}The first page of a relist opens it with Init.
law watch_backoff_capped provedin PROOF.bendsource · line 94 · raw
{0x3e7c8cdf5aa942d4279f8d34c4f1be54/src/watcher.Backoff.delay(6) == 30000 : U32}The watcher's backoff never exceeds 30s, however many failures.
law init_clears_buffer provedin PROOF.bendsource · line 101 · raw
@objs:Map<&2, 0x3e7c8cdf5aa942d4279f8d34c4f1be54/src/json.Json> -> @buf:Map<&2, 0x3e7c8cdf5aa942d4279f8d34c4f1be54/src/json.Json> -> @r:Bool -> {0x3e7c8cdf5aa942d4279f8d34c4f1be54/src/store.Store.apply(0x3e7c8cdf5aa942d4279f8d34c4f1be54/src/store.Store{objs, buf, r}, 0x3e7c8cdf5aa942d4279f8d34c4f1be54/src/watcher.OInit{}) == 0x3e7c8cdf5aa942d4279f8d34c4f1be54/src/store.Store{objs, Map.new(&2, 0x3e7c8cdf5aa942d4279f8d34c4f1be54/src/json.Json), r} : 0x3e7c8cdf5aa942d4279f8d34c4f1be54/src/store.Store}A relist starts from an empty buffer, whatever the store held.
law init_done_swaps provedin PROOF.bendsource · line 110 · raw
@objs:Map<&2, 0x3e7c8cdf5aa942d4279f8d34c4f1be54/src/json.Json> -> @buf:Map<&2, 0x3e7c8cdf5aa942d4279f8d34c4f1be54/src/json.Json> -> @r:Bool -> {0x3e7c8cdf5aa942d4279f8d34c4f1be54/src/store.Store.apply(0x3e7c8cdf5aa942d4279f8d34c4f1be54/src/store.Store{objs, buf, r}, 0x3e7c8cdf5aa942d4279f8d34c4f1be54/src/watcher.OInitDone{}) == 0x3e7c8cdf5aa942d4279f8d34c4f1be54/src/store.Store{buf, Map.new(&2, 0x3e7c8cdf5aa942d4279f8d34c4f1be54/src/json.Json), True{}} : 0x3e7c8cdf5aa942d4279f8d34c4f1be54/src/store.Store}InitDone swaps the relisted buffer in whole: objects absent from the relist leave the store, and the store is ready.
law add_running_marks_dirty provedin PROOF.bendsource · line 122 · raw
@f:List<&2, String> -> @b:List<&2, String> -> @inq:Map<&2, U32> -> @run:Map<&2, U32> -> @d:Map<&2, U32> -> @g:Map<&2, U32> -> @fl:Map<&2, U32> -> @n:U32 -> @mx:U32 -> @key:String -> @running:{0x3e7c8cdf5aa942d4279f8d34c4f1be54/src/queue.Mp.has(run, key) == True{} : Bool} -> {0x3e7c8cdf5aa942d4279f8d34c4f1be54/src/queue.Queue.add(0x3e7c8cdf5aa942d4279f8d34c4f1be54/src/queue.Queue{f, b, inq, run, d, g, fl, n, mx}, key) == 0x3e7c8cdf5aa942d4279f8d34c4f1be54/src/queue.Queue{f, b, inq, run, 0x3e7c8cdf5aa942d4279f8d34c4f1be54/src/queue.Mp.on(d, key), 0x3e7c8cdf5aa942d4279f8d34c4f1be54/src/queue.Mp.bump(g, key), fl, n, mx} : 0x3e7c8cdf5aa942d4279f8d34c4f1be54/src/queue.Queue}Adding a key that is running does not queue it a second time: it is marked dirty, to run again when the current run ends.
law add_waiting_dedups provedin PROOF.bendsource · line 138 · raw
@f:List<&2, String> -> @b:List<&2, String> -> @inq:Map<&2, U32> -> @run:Map<&2, U32> -> @d:Map<&2, U32> -> @g:Map<&2, U32> -> @fl:Map<&2, U32> -> @n:U32 -> @mx:U32 -> @key:String -> @idle:{0x3e7c8cdf5aa942d4279f8d34c4f1be54/src/queue.Mp.has(run, key) == False{} : Bool} -> @waiting:{0x3e7c8cdf5aa942d4279f8d34c4f1be54/src/queue.Mp.has(inq, key) == True{} : Bool} -> {0x3e7c8cdf5aa942d4279f8d34c4f1be54/src/queue.Queue.add(0x3e7c8cdf5aa942d4279f8d34c4f1be54/src/queue.Queue{f, b, inq, run, d, g, fl, n, mx}, key) == 0x3e7c8cdf5aa942d4279f8d34c4f1be54/src/queue.Queue{f, b, inq, run, d, 0x3e7c8cdf5aa942d4279f8d34c4f1be54/src/queue.Mp.bump(g, key), fl, n, mx} : 0x3e7c8cdf5aa942d4279f8d34c4f1be54/src/queue.Queue}Adding a key that already waits changes nothing but its timer.
law pop_respects_limit provedin PROOF.bendsource · line 155 · raw
@f:List<&2, String> -> @b:List<&2, String> -> @inq:Map<&2, U32> -> @run:Map<&2, U32> -> @d:Map<&2, U32> -> @g:Map<&2, U32> -> @fl:Map<&2, U32> -> @n:U32 -> @mx:U32 -> @full:{U32.is_lt(n, mx) == False{} : Bool} -> {0x3e7c8cdf5aa942d4279f8d34c4f1be54/src/queue.Queue.pop(0x3e7c8cdf5aa942d4279f8d34c4f1be54/src/queue.Queue{f, b, inq, run, d, g, fl, n, mx}) == (0x3e7c8cdf5aa942d4279f8d34c4f1be54/src/queue.Queue{f, b, inq, run, d, g, fl, n, mx}, None{}) : Pair(0x3e7c8cdf5aa942d4279f8d34c4f1be54/src/queue.Queue, Maybe<&2, String>)}No key starts while every worker slot is taken.
law retry_backoff_capped provedin PROOF.bendsource · line 170 · raw
{0x3e7c8cdf5aa942d4279f8d34c4f1be54/src/queue.Queue.backoff(18) == 1000000 : U32}A failing key backs off for at most 1000s.
law done_idle_noop provedin PROOF.bendsource · line 174 · raw
@q:0x3e7c8cdf5aa942d4279f8d34c4f1be54/src/queue.Queue -> @key:String -> @a:0x3e7c8cdf5aa942d4279f8d34c4f1be54/src/queue.Action -> @idle:{0x3e7c8cdf5aa942d4279f8d34c4f1be54/src/queue.Queue.running(q, key) == False{} : Bool} -> {0x3e7c8cdf5aa942d4279f8d34c4f1be54/src/queue.Queue.done(q, key, a) == (q, []) : Pair(0x3e7c8cdf5aa942d4279f8d34c4f1be54/src/queue.Queue, List<&2, 0x3e7c8cdf5aa942d4279f8d34c4f1be54/src/queue.Timer>)}Finishing a key that is not running changes nothing and arms no timer.
law forget_running_keeps provedin PROOF.bendsource · line 182 · raw
@q:0x3e7c8cdf5aa942d4279f8d34c4f1be54/src/queue.Queue -> @key:String -> @running:{0x3e7c8cdf5aa942d4279f8d34c4f1be54/src/queue.Queue.running(q, key) == True{} : Bool} -> {0x3e7c8cdf5aa942d4279f8d34c4f1be54/src/queue.Queue.forget(q, key) == q : 0x3e7c8cdf5aa942d4279f8d34c4f1be54/src/queue.Queue}Forgetting never disturbs a key that is running.
law fin_live_applies provedin PROOF.bendsource · line 192 · raw
@fs:List<&2, String> -> @name:String -> @i:U32 -> {0x3e7c8cdf5aa942d4279f8d34c4f1be54/src/finalizer.Fin.state.go(fs, name, Some{i}, False{}) == 0x3e7c8cdf5aa942d4279f8d34c4f1be54/src/finalizer.FApply{} : 0x3e7c8cdf5aa942d4279f8d34c4f1be54/src/finalizer.FState}A live object that carries our finalizer is applied.
law fin_gone_done provedin PROOF.bendsource · line 199 · raw
@fs:List<&2, String> -> @name:String -> {0x3e7c8cdf5aa942d4279f8d34c4f1be54/src/finalizer.Fin.state.go(fs, name, None{}, True{}) == 0x3e7c8cdf5aa942d4279f8d34c4f1be54/src/finalizer.FDone{} : 0x3e7c8cdf5aa942d4279f8d34c4f1be54/src/finalizer.FState}A deleted object that no longer carries it needs nothing more.
law fin_cleanup_tests provedin PROOF.bendsource · line 206 · raw
@fs:List<&2, String> -> @name:String -> @i:U32 -> {0x3e7c8cdf5aa942d4279f8d34c4f1be54/src/finalizer.Fin.state.go(fs, name, Some{i}, True{}) == 0x3e7c8cdf5aa942d4279f8d34c4f1be54/src/finalizer.FCleanup{0x3e7c8cdf5aa942d4279f8d34c4f1be54/src/finalizer.Fin.remove_patch(i, name)} : 0x3e7c8cdf5aa942d4279f8d34c4f1be54/src/finalizer.FState}A deleted object that still carries it is cleaned up, and the finalizer is removed only through a patch that tests it is still ours, at its index.
law eof_before_response_is_lost provedin PROOF.bendsource · line 217 · raw
@t:U32 -> @h:Maybe<&2, 0x3e7c8cdf5aa942d4279f8d34c4f1be54/src/http.Head> -> @o:List<&2, U32> -> {0x3e7c8cdf5aa942d4279f8d34c4f1be54/src/http.Http.eof(0x3e7c8cdf5aa942d4279f8d34c4f1be54/src/http.Resp{0x3e7c8cdf5aa942d4279f8d34c4f1be54/src/http.PHead{[], t}, h, o}) == 0x3e7c8cdf5aa942d4279f8d34c4f1be54/src/http.Resp{0x3e7c8cdf5aa942d4279f8d34c4f1be54/src/http.PLost{"connection closed before a response"}, h, o} : 0x3e7c8cdf5aa942d4279f8d34c4f1be54/src/http.Resp}A connection that ends before any byte of a response is lost, not broken: only then may a request on a reused connection be retried.
law eof_mid_response_is_broken provedin PROOF.bendsource · line 225 · raw
@b:U32 -> @bs:List<&2, U32> -> @t:U32 -> @h:Maybe<&2, 0x3e7c8cdf5aa942d4279f8d34c4f1be54/src/http.Head> -> @o:List<&2, U32> -> {0x3e7c8cdf5aa942d4279f8d34c4f1be54/src/http.Http.eof(0x3e7c8cdf5aa942d4279f8d34c4f1be54/src/http.Resp{0x3e7c8cdf5aa942d4279f8d34c4f1be54/src/http.PHead{b <> bs, t}, h, o}) == 0x3e7c8cdf5aa942d4279f8d34c4f1be54/src/http.Resp{0x3e7c8cdf5aa942d4279f8d34c4f1be54/src/http.PErr{"connection closed mid-response"}, h, o} : 0x3e7c8cdf5aa942d4279f8d34c4f1be54/src/http.Resp}Bytes of a response make an early end a broken response, never retried.
law proxy_skips_localhost provedin PROOF.bendsource · line 239 · raw
@url:String -> @no:String -> @port:U32 -> {0x3e7c8cdf5aa942d4279f8d34c4f1be54/src/proxy.Proxy.route(url, no, "localhost", port) == 0x3e7c8cdf5aa942d4279f8d34c4f1be54/src/proxy.Direct{} : 0x3e7c8cdf5aa942d4279f8d34c4f1be54/src/proxy.Route}localhost and loopback addresses never go through a proxy, whatever HTTPS_PROXY and NO_PROXY say.
law proxy_skips_loopback provedin PROOF.bendsource · line 245 · raw
@url:String -> @no:String -> @port:U32 -> {0x3e7c8cdf5aa942d4279f8d34c4f1be54/src/proxy.Proxy.route(url, no, "127.0.0.1", port) == 0x3e7c8cdf5aa942d4279f8d34c4f1be54/src/proxy.Direct{} : 0x3e7c8cdf5aa942d4279f8d34c4f1be54/src/proxy.Route}
law no_proxy_star_bypasses provedin PROOF.bendsource · line 252 · raw
@url:String -> @port:U32 -> {0x3e7c8cdf5aa942d4279f8d34c4f1be54/src/proxy.Proxy.route(url, "*", "api.example.com", port) == 0x3e7c8cdf5aa942d4279f8d34c4f1be54/src/proxy.Direct{} : 0x3e7c8cdf5aa942d4279f8d34c4f1be54/src/proxy.Route}NO_PROXY=* sends every host around the proxy.
law no_proxy_url_is_direct provedin PROOF.bendsource · line 258 · raw
@port:U32 -> {0x3e7c8cdf5aa942d4279f8d34c4f1be54/src/proxy.Proxy.route("", "", "api.example.com", port) == 0x3e7c8cdf5aa942d4279f8d34c4f1be54/src/proxy.Direct{} : 0x3e7c8cdf5aa942d4279f8d34c4f1be54/src/proxy.Route}Without HTTPS_PROXY, connections are direct.
law unsupported_proxy_fails provedin PROOF.bendsource · line 264 · raw
@port:U32 -> {0x3e7c8cdf5aa942d4279f8d34c4f1be54/src/proxy.Proxy.route("socks5://proxy:1080", "", "api.example.com", port) == 0x3e7c8cdf5aa942d4279f8d34c4f1be54/src/proxy.NoRoute{"HTTPS_PROXY: only http:// proxies are supported"} : 0x3e7c8cdf5aa942d4279f8d34c4f1be54/src/proxy.Route}A proxy bend-kube cannot speak fails the connection: it never falls back to connecting directly.
law no_proxy_dot_is_subdomains_only provedin PROOF.bendsource · line 270 · raw
{0x3e7c8cdf5aa942d4279f8d34c4f1be54/src/proxy.Proxy.route("http://proxy:3128", ".corp", "corp", 443) == 0x3e7c8cdf5aa942d4279f8d34c4f1be54/src/proxy.Via{0x3e7c8cdf5aa942d4279f8d34c4f1be54/src/proxy.Proxy{"proxy", 3128, ""}} : 0x3e7c8cdf5aa942d4279f8d34c4f1be54/src/proxy.Route}".corp" bypasses the subdomains of corp, not corp itself.
law no_proxy_respects_labels provedin PROOF.bendsource · line 276 · raw
{0x3e7c8cdf5aa942d4279f8d34c4f1be54/src/proxy.Proxy.route("http://proxy:3128", "corp", "evilcorp", 443) == 0x3e7c8cdf5aa942d4279f8d34c4f1be54/src/proxy.Via{0x3e7c8cdf5aa942d4279f8d34c4f1be54/src/proxy.Proxy{"proxy", 3128, ""}} : 0x3e7c8cdf5aa942d4279f8d34c4f1be54/src/proxy.Route}"corp" bypasses corp and its subdomains, never a name that merely ends in the same letters.
law no_proxy_port_narrows provedin PROOF.bendsource · line 281 · raw
{0x3e7c8cdf5aa942d4279f8d34c4f1be54/src/proxy.Proxy.route("http://proxy:3128", "api.corp:6443", "api.corp", 443) == 0x3e7c8cdf5aa942d4279f8d34c4f1be54/src/proxy.Via{0x3e7c8cdf5aa942d4279f8d34c4f1be54/src/proxy.Proxy{"proxy", 3128, ""}} : 0x3e7c8cdf5aa942d4279f8d34c4f1be54/src/proxy.Route}An entry with a port bypasses only that port.
law tunnel_needs_200 provedin PROOF.bendsource · line 286 · raw
{0x3e7c8cdf5aa942d4279f8d34c4f1be54/src/proxy.Tunnel.feed(0x3e7c8cdf5aa942d4279f8d34c4f1be54/src/proxy.Tunnel.init, 0x3e7c8cdf5aa942d4279f8d34c4f1be54/src/utf8.Utf8.encode("HTTP/1.1 407 Proxy Authentication Required\r\n\r\n")) == 0x3e7c8cdf5aa942d4279f8d34c4f1be54/src/proxy.TFail{"proxy refused CONNECT: HTTP/1.1 407 Proxy Authentication Required"} : 0x3e7c8cdf5aa942d4279f8d34c4f1be54/src/proxy.Tunnel}Only a 200 opens the tunnel; any other answer fails it, quoted.
law tunnel_rejects_early_bytes provedin PROOF.bendsource · line 293 · raw
@b:U32 -> @bs:List<&2, U32> -> {0x3e7c8cdf5aa942d4279f8d34c4f1be54/src/proxy.Tunnel.feed(0x3e7c8cdf5aa942d4279f8d34c4f1be54/src/proxy.Tunnel.init, List.append(&2, U32, 0x3e7c8cdf5aa942d4279f8d34c4f1be54/src/utf8.Utf8.encode("HTTP/1.1 200 OK\r\n\r\n"), b <> bs)) == 0x3e7c8cdf5aa942d4279f8d34c4f1be54/src/proxy.TFail{"proxy sent bytes before the TLS handshake"} : 0x3e7c8cdf5aa942d4279f8d34c4f1be54/src/proxy.Tunnel}Bytes after the proxy's answer, before we spoke TLS, fail the tunnel: nothing the proxy says may become part of the TLS stream.
law tunnel_end_before_answer provedin PROOF.bendsource · line 301 · raw
@h:List<&2, U32> -> {0x3e7c8cdf5aa942d4279f8d34c4f1be54/src/proxy.Tunnel.feed(0x3e7c8cdf5aa942d4279f8d34c4f1be54/src/proxy.TMore{h}, []) == 0x3e7c8cdf5aa942d4279f8d34c4f1be54/src/proxy.TFail{"proxy closed the connection before answering CONNECT"} : 0x3e7c8cdf5aa942d4279f8d34c4f1be54/src/proxy.Tunnel}A proxy that hangs up before its answer is whole fails the tunnel.