From 8570a8f3c9c6a8aa256db75cc59d34cba12ad7ff Mon Sep 17 00:00:00 2001 From: Elliot Glaysher Date: Tue, 5 Feb 2019 14:05:06 -0800 Subject: [PATCH] Separate interaces into %http-server and %http-client A repeating patern while developing was confusion over whether an operation was inbound or outbound. By putting this into the gift and tasks, we can avoid this: an [%http-server %request ...] is not an [%http-client %request ...]. (This requires corresponding vere changes since it changes the unix/vane interface.) --- sys/vane/light.hoon | 142 ++++++++++++------------- sys/zuse.hoon | 77 +++++++++----- tests/sys/vane/light.hoon | 211 +++++++++++++++++++++++--------------- 3 files changed, 244 insertions(+), 186 deletions(-) diff --git a/sys/vane/light.hoon b/sys/vane/light.hoon index cb59604b9..aec7f8b05 100644 --- a/sys/vane/light.hoon +++ b/sys/vane/light.hoon @@ -692,7 +692,9 @@ ++ per-client-event |= [[our=@p eny=@ =duct now=@da scry=sley] state=state:client] |% - ++ fetch + :: +request: makes an external web request + :: + ++ request |= [=http-request =outbound-config] ^- [(list move) state:client] :: get the next id for this request @@ -715,7 +717,7 @@ :: email discussions make it sound like fixing that might be hard, so :: maybe i should just live with the way it is now? :: - :- [outbound-duct.state %give %http-request id `http-request]~ + :- [outbound-duct.state %give %http-client %request id `http-request]~ state :: +receive: receives a response to an http-request we made :: @@ -794,7 +796,8 @@ :_ ~ :* duct.connection %give - %http-progress + %http-client + %progress (need response-headers.in-progress-http-request.connection) bytes-read.in-progress-http-request.connection expected-size.in-progress-http-request.connection @@ -826,7 +829,8 @@ u.mime-type :- :~ :* duct.connection %give - %http-finished + %http-client + %finished response-headers ?:(=(0 p.data) ~ `[mime data]) == == @@ -1496,8 +1500,8 @@ :: =? moves ?=([%| *] state.channel) :_ moves - :+ p.state.channel %give - :* %http-response %continue + :^ p.state.channel %give %http-server + :* %response %continue :: ^= data :- ~ @@ -1638,7 +1642,7 @@ :: ++ pass-response ^- [(list move) server-state] - [[duct %give %http-response raw-http-response]~ state] + [[duct %give %http-server %response raw-http-response]~ state] :: ++ log-complete-request :: todo: log the complete request @@ -1659,7 +1663,7 @@ :: respond to outside with %error :: ^- [(list move) server-state] - [[duct %give %http-response %cancel ~]~ state] + [[duct %give %http-server %response %cancel ~]~ state] -- :: +add-binding: conditionally add a pairing between binding and action :: @@ -1672,7 +1676,7 @@ |- ^- [(list move) server-state] ?~ to-search - :- [duct %give %bound %.y binding]~ + :- [duct %give %http-server %bound %.y binding]~ =. bindings.state :: store in reverse alphabetical order so that longer paths are first :: @@ -1688,7 +1692,7 @@ state :: ?: =(binding binding.i.to-search) - :- [duct %give %bound %.n binding]~ + :- [duct %give %http-server %bound %.n binding]~ state :: $(to-search t.to-search) @@ -1839,81 +1843,71 @@ ;: weld :: hand back default configuration for now :: - [duct %give %form *http-config]~ + [duct %give %http-server %set-config *http-config]~ :: closed-connections == :: - :: %live: no idea what this is for :: - %live - :: - ~& [%todo-live p.task q.task] - :: - [~ light-gate] - :: - :: %inbound-request: handles an inbound http request :: - %inbound-request - :: - :: TODO: This is uncommit - :: + %http-server =/ event-args [[our eny duct now scry-gate] server-state.ax] - =/ request request:(per-server-event event-args) - =^ moves server-state.ax - (request +.task) - [moves light-gate] + =/ server (per-server-event event-args) + ?- -.server-task.task + :: + :: %live: no idea what this is for + :: + %live + :: + ~! task + ~& [%todo-live server-task.task] + :: + [~ light-gate] + :: + %request + =^ moves server-state.ax (request:server +.server-task.task) + [moves light-gate] + :: + %cancel-request + =^ moves server-state.ax cancel-request:server + [moves light-gate] + :: + %connect + =^ moves server-state.ax + %+ add-binding:server binding.server-task.task + [%app app.server-task.task] + [moves light-gate] + :: + %serve + =^ moves server-state.ax + %+ add-binding:server binding.server-task.task + [%gen generator.server-task.task] + [moves light-gate] + :: + %disconnect + =. server-state.ax (remove-binding:server binding.server-task.task) + [~ light-gate] + == :: :: :: - %cancel-inbound-request - =/ event-args [[our eny duct now scry-gate] server-state.ax] - =/ cancel-request cancel-request:(per-server-event event-args) - =^ moves server-state.ax cancel-request - [moves light-gate] - :: - :: %fetch - :: - %fetch + %http-client =/ event-args [[our eny duct now scry-gate] client-state.ax] - =/ fetch fetch:(per-client-event event-args) - =^ moves client-state.ax (fetch +.task) - [moves light-gate] - :: - :: %cancel-fetch - :: - %cancel-fetch - ~& %todo-cancel-fetch - [~ light-gate] - :: - :: %receive: receives http data from unix - :: - %receive - =/ event-args [[our eny duct now scry-gate] client-state.ax] - =/ receive receive:(per-client-event event-args) - =^ moves client-state.ax (receive +.task) - [moves light-gate] - :: - :: %connect / %serve - :: - ?(%connect %serve) - =/ event-args [[our eny duct now scry-gate] server-state.ax] - =/ add-binding add-binding:(per-server-event event-args) - =^ moves server-state.ax - %+ add-binding binding.task - ?- -.task - %connect [%app app.task] - %serve [%gen generator.task] - == - [moves light-gate] - :: - :: %disconnect - :: - %disconnect - =/ event-args [[our eny duct now scry-gate] server-state.ax] - =/ remove-binding remove-binding:(per-server-event event-args) - =. server-state.ax (remove-binding binding.task) - [~ light-gate] + =/ client (per-client-event event-args) + ?- -.client-task.task + :: + %request + =^ moves client-state.ax (request:client +.client-task.task) + [moves light-gate] + :: + %cancel-request + ~& %todo-cancel-request + [~ light-gate] + :: + %receive + =^ moves client-state.ax (receive:client +.client-task.task) + [moves light-gate] + == == :: ++ take diff --git a/sys/zuse.hoon b/sys/zuse.hoon index 02d3576c5..d59bb1984 100644 --- a/sys/zuse.hoon +++ b/sys/zuse.hoon @@ -1994,34 +1994,45 @@ +| %vane-interface ++ able |% + :: +gift: %light responses + :: ++ gift - $% :: form: configures the http server + $% [%http-server server-gift] + [%http-client client-gift] + == + :: +server-gift: effects the server can emit + :: + ++ server-gift + $% :: set-config: configures the external http server :: :: TODO: We need to actually return a (map (unit @t) http-config) :: so we can apply configurations on a per-site basis :: - :: TODO: %form is a terrible name, but it's what vere currently - :: accepts. Rename it. + :: TODO: THIS WAS %form. When done renaming, be done renaming. :: - [%form =http-config] - :: http-response: response from urbit to earth + [%set-config =http-config] + :: response: response to an event from earth :: - [%http-response =raw-http-response] - :: %http-request: outbound http-request to earth - :: - :: TODO: id is sort of wrong for this interface; the duct should - :: be enough to identify which request we're talking about? - :: - [%http-request id=@ud request=(unit http-request)] + [%response =raw-http-response] :: response to a %connect or %serve :: :: :accepted is whether :binding was valid. Duplicate bindings are :: not allowed. :: [%bound accepted=? =binding] + == + :: +client-gift: effects the client can emit + :: + ++ client-gift + $% :: %http-request: outbound http-request to earth + :: + :: TODO: id is sort of wrong for this interface; the duct should + :: be enough to identify which request we're talking about? + :: + [%request id=@ud request=(unit http-request)] :: periodically sent as an update on the duct that sent %fetch :: - $: %http-progress + $: %progress :: http-response-header: full transaction header :: :: In case of a redirect chain, this is the target of the @@ -2040,7 +2051,7 @@ == :: final response of a download, parsed as mime-data if successful :: - [%http-finished =http-response-header full-file=(unit mime-data)] + [%finished =http-response-header full-file=(unit mime-data)] == :: ++ task @@ -2049,27 +2060,27 @@ :: TODO: Remove this once we single home. :: [%init our=@p] - :: new unix process (?) + :: new unix process :: [%born p=(list host)] - :: set http ports (?) + :: task for the http server + :: + [%http-server =server-task] + :: task for the http client + :: + [%http-client =client-task] + == + :: + ++ server-task + $% :: set http ports (?) :: [%live p=@ud q=(unit @ud)] :: starts handling an inbound http request :: - [%inbound-request secure=? =address =http-request] + [%request secure=? =address =http-request] :: cancels a previous request :: - [%cancel-inbound-request ~] - :: fetches a remote resource - :: - [%fetch =http-request =outbound-config] - :: cancels a previous fetch - :: - [%cancel-fetch ~] - :: receives http data from outside - :: - [%receive id=@ud =raw-http-response] + [%cancel-request ~] :: connects a binding to an app :: [%connect =binding app=term] @@ -2083,6 +2094,18 @@ :: [%disconnect =binding] == + :: + ++ client-task + $% :: fetches a remote resource + :: + [%request =http-request =outbound-config] + :: cancels a previous fetch + :: + [%cancel-request ~] + :: receives http data from outside + :: + [%receive id=@ud =raw-http-response] + == -- :: +| %bindings diff --git a/tests/sys/vane/light.hoon b/tests/sys/vane/light.hoon index 3525bae11..36f821625 100644 --- a/tests/sys/vane/light.hoon +++ b/tests/sys/vane/light.hoon @@ -37,8 +37,8 @@ light-gate now=~1111.1.2 scry=*sley - call-args=[duct=~[/app1] ~ [%connect [~ /] %app1]] - expected-moves=[duct=~[/app1] %give %bound %.y [~ /]]~ + call-args=[duct=~[/app1] ~ [%http-server %connect [~ /] %app1]] + expected-moves=[duct=~[/app1] %give %http-server %bound %.y [~ /]]~ == :: app2 tries to bind to the same path and fails :: @@ -47,8 +47,8 @@ light-gate now=~1111.1.3 scry=*sley - call-args=[duct=~[/app2] ~ [%connect [~ /] %app2]] - expected-moves=[duct=~[/app2] %give %bound %.n [~ /]]~ + call-args=[duct=~[/app2] ~ [%http-server %connect [~ /] %app2]] + expected-moves=[duct=~[/app2] %give %http-server %bound %.n [~ /]]~ == :: ;: weld @@ -74,8 +74,8 @@ light-gate now=~1111.1.2 scry=*sley - call-args=[duct=~[/app1] ~ [%connect [~ /] %app1]] - expected-moves=[duct=~[/app1] %give %bound %.y [~ /]]~ + call-args=[duct=~[/app1] ~ [%http-server %connect [~ /] %app1]] + expected-moves=[duct=~[/app1] %give %http-server %bound %.y [~ /]]~ == :: app1 unbinds :: @@ -84,7 +84,7 @@ light-gate now=~1111.1.3 scry=*sley - call-args=[duct=~[/app1] ~ [%disconnect [~ /]]] + call-args=[duct=~[/app1] ~ [%http-server %disconnect [~ /]]] expected-moves=~ == :: app2 binds successfully @@ -94,8 +94,8 @@ light-gate now=~1111.1.4 scry=*sley - call-args=[duct=~[/app2] ~ [%connect [~ /] %app2]] - expected-moves=[duct=~[/app2] %give %bound %.y [~ /]]~ + call-args=[duct=~[/app2] ~ [%http-server %connect [~ /] %app2]] + expected-moves=[duct=~[/app2] %give %http-server %bound %.y [~ /]]~ == :: ;: weld @@ -122,8 +122,8 @@ light-gate now=~1111.1.2 scry=*sley - call-args=[duct=~[/app1] ~ [%connect [~ /] %app1]] - expected-moves=[duct=~[/app1] %give %bound %.y [~ /]]~ + call-args=[duct=~[/app1] ~ [%http-server %connect [~ /] %app1]] + expected-moves=[duct=~[/app1] %give %http-server %bound %.y [~ /]]~ == :: app2 tries to steal the binding by disconnecting the path :: @@ -132,7 +132,7 @@ light-gate now=~1111.1.3 scry=*sley - call-args=[duct=~[/app2] ~ [%disconnect [~ /]]] + call-args=[duct=~[/app2] ~ [%http-server %disconnect [~ /]]] expected-moves=~ == :: app2 doesn't bind successfully because it couldn't remove app1's binding @@ -142,8 +142,8 @@ light-gate now=~1111.1.4 scry=*sley - call-args=[duct=~[/app2] ~ [%connect [~ /] %app2]] - expected-moves=[duct=~[/app2] %give %bound %.n [~ /]]~ + call-args=[duct=~[/app2] ~ [%http-server %connect [~ /] %app2]] + expected-moves=[duct=~[/app2] %give %http-server %bound %.n [~ /]]~ == :: ;: weld @@ -173,7 +173,8 @@ scry=*sley ^= call-args :* duct=~[/http-blah] ~ - %inbound-request + %http-server + %request %.n [%ipv4 .192.168.1.1] [%'GET' '/' ~ ~] @@ -182,7 +183,8 @@ ^- (list move:light-gate) :~ :* duct=~[/http-blah] %give - %http-response + %http-server + %response %start 404 :~ ['content-type' 'text/html'] @@ -215,8 +217,8 @@ light-gate now=~1111.1.2 scry=*sley - call-args=[duct=~[/app1] ~ [%connect [~ /] %app1]] - expected-moves=[duct=~[/app1] %give %bound %.y [~ /]]~ + call-args=[duct=~[/app1] ~ [%http-server %connect [~ /] %app1]] + expected-moves=[duct=~[/app1] %give %http-server %bound %.y [~ /]]~ == :: outside requests a path that app1 has bound to :: @@ -227,7 +229,8 @@ scry=*sley ^= call-args :* duct=~[/http-blah] ~ - %inbound-request + %http-server + %request %.n [%ipv4 .192.168.1.1] [%'GET' '/' ~ ~] @@ -266,12 +269,15 @@ :* wire=/run-app/app1 duct=~[/http-blah] ^- (hypo sign:light-gate) :- *type - :^ %g %unto %http-response - ^- raw-http-response:light-gate - [%start 200 ['content-type' 'text/html']~ [~ (as-octs:mimes:html 'Hiya!')] %.y] + :* %g %unto %http-response + %start 200 + ['content-type' 'text/html']~ + [~ (as-octs:mimes:html 'Hiya!')] + %.y + == == ^= expected-move - :~ :* duct=~[/http-blah] %give %http-response + :~ :* duct=~[/http-blah] %give %http-server %response [%start 200 ['content-type' 'text/html']~ `[5 'Hiya!'] %.y] == == == :: @@ -299,8 +305,8 @@ light-gate now=~1111.1.2 scry=*sley - call-args=[duct=~[/app1] ~ [%connect [~ /] %app1]] - expected-moves=[duct=~[/app1] %give %bound %.y [~ /]]~ + call-args=[duct=~[/app1] ~ [%http-server %connect [~ /] %app1]] + expected-moves=[duct=~[/app1] %give %http-server %bound %.y [~ /]]~ == :: outside requests a path that app1 has bound to :: @@ -311,7 +317,8 @@ scry=*sley ^= call-args :* duct=~[/http-blah] ~ - %inbound-request + %http-server + %request %.n [%ipv4 .192.168.1.1] [%'GET' '/' ~ ~] @@ -349,12 +356,14 @@ ^= take-args :* wire=/run-app/app1 duct=~[/http-blah] ^- (hypo sign:light-gate) :- *type - :^ %g %unto %http-response - ^- raw-http-response:light-gate - [%start 200 ['content-type' 'text/html']~ [~ (as-octs:mimes:html 'Hi')] %.n] + :* %g %unto %http-response + %start 200 ['content-type' 'text/html']~ + [~ (as-octs:mimes:html 'Hi')] + %.n + == == ^= expected-move - :~ :* duct=~[/http-blah] %give %http-response + :~ :* duct=~[/http-blah] %give %http-server %response [%start 200 ['content-type' 'text/html']~ `[2 'Hi'] %.n] == == == :: theoretical outside response @@ -367,12 +376,12 @@ ^= take-args :* wire=/run-app/app1 duct=~[/http-blah] ^- (hypo sign:light-gate) :- *type - :^ %g %unto %http-response - ^- raw-http-response:light-gate - [%continue [~ (as-octs:mimes:html 'ya!')] %.y] + :* %g %unto %http-response + [%continue [~ (as-octs:mimes:html 'ya!')] %.y] + == == ^= expected-move - :~ :* duct=~[/http-blah] %give %http-response + :~ :* duct=~[/http-blah] %give %http-server %response [%continue `[3 'ya!'] %.y] == == == :: @@ -403,8 +412,8 @@ light-gate now=~1111.1.2 scry=*sley - call-args=[duct=~[/app1] ~ [%connect [~ /'~landscape'] %app1]] - expected-moves=[duct=~[/app1] %give %bound %.y [~ /'~landscape']]~ + call-args=[duct=~[/app1] ~ [%http-server %connect [~ /'~landscape'] %app1]] + expected-moves=[duct=~[/app1] %give %http-server %bound %.y [~ /'~landscape']]~ == :: outside requests a path that app1 has bound to :: @@ -415,7 +424,8 @@ scry=*sley ^= call-args :* duct=~[/http-blah] ~ - %inbound-request + %http-server + %request %.n [%ipv4 .192.168.1.1] [%'GET' '/~landscape/inner-path' ~ ~] @@ -453,12 +463,12 @@ ^= take-args :* wire=/run-app/app1 duct=~[/http-blah] ^- (hypo sign:light-gate) :- *type - :^ %g %unto %http-response - ^- raw-http-response:light-gate - [%start 307 ['location' '/~/login?redirect=/~landscape/inner-path']~ ~ %.y] + :* %g %unto %http-response + [%start 307 ['location' '/~/login?redirect=/~landscape/inner-path']~ ~ %.y] + == == ^= expected-move - :~ :* duct=~[/http-blah] %give %http-response + :~ :* duct=~[/http-blah] %give %http-server %response [%start 307 ['location' '/~/login?redirect=/~landscape/inner-path']~ ~ %.y] == == == :: the browser then fetches the login page @@ -479,7 +489,8 @@ ^= call-args ^- [=duct type=* wrapped-task=(hobo task:able:light-gate)] :* duct=~[/http-blah] ~ - %inbound-request + %http-server + %request %.n [%ipv4 .192.168.1.1] %'GET' @@ -546,8 +557,8 @@ light-gate now=~1111.1.2 scry=*sley - call-args=[duct=~[/gen1] ~ [%serve [~ /] [%home /gen/handler/hoon ~]]] - expected-moves=[duct=~[/gen1] %give %bound %.y [~ /]]~ + call-args=[duct=~[/gen1] ~ [%http-server %serve [~ /] [%home /gen/handler/hoon ~]]] + expected-moves=[duct=~[/gen1] %give %http-server %bound %.y [~ /]]~ == :: outside requests a path that app1 has bound to :: @@ -558,7 +569,8 @@ scry=*sley ^= call-args :* duct=~[/http-blah] ~ - %inbound-request + %http-server + %request %.n [%ipv4 .192.168.1.1] [%'GET' '/' ~ ~] @@ -614,7 +626,7 @@ [%cast %mime !>([['text' 'plain' ~] (as-octs:mimes:html 'one two three')])] == ^= expected-move - :~ :* duct=~[/http-blah] %give %http-response + :~ :* duct=~[/http-blah] %give %http-server %response :* %start 200 :~ ['content-type' 'text/plain'] @@ -740,7 +752,7 @@ scry=*sley ^= call-args :* duct=~[/http-blah] ~ - %inbound-request + %http-server %request %.n [%ipv4 .192.168.1.1] [%'PUT' '/~/channel/1234567890abcdef' ~ ~] @@ -749,7 +761,8 @@ ^- (list move:light-gate) :~ :* duct=~[/http-blah] %give - %http-response + %http-server + %response %start 400 :~ ['content-type' 'text/html'] @@ -863,7 +876,8 @@ scry=*sley ^= call-args :* duct=~[/http-get-open] ~ - %inbound-request + %http-server + %request %.n [%ipv4 .192.168.1.1] %'GET' @@ -875,7 +889,8 @@ ^- (list move:light-gate) :~ :* duct=~[/http-get-open] %give - %http-response + %http-server + %response %start 200 :~ ['content-type' 'text/event-stream'] @@ -913,7 +928,7 @@ light-gate now=(add ~1111.1.2 ~m4) scry=*sley - call-args=[duct=~[/http-get-open] ~ %cancel-inbound-request ~] + call-args=[duct=~[/http-get-open] ~ %http-server %cancel-request ~] ^= expected-moves ^- (list move:light-gate) :: closing the channel restarts the timeout timer @@ -951,7 +966,8 @@ scry=*sley ^= call-args :* duct=~[/http-put-request] ~ - %inbound-request + %http-server + %request %.n [%ipv4 .192.168.1.1] %'PUT' @@ -985,7 +1001,7 @@ card.i.moves :: %+ expect-eq - !> [~[/http-put-request] %give %http-response %start 200 ~ ~ %.y] + !> [~[/http-put-request] %give %http-server %response %start 200 ~ ~ %.y] !> i.t.moves :: %+ expect-eq @@ -1063,7 +1079,8 @@ scry=*sley ^= call-args :* duct=~[/http-get-open] ~ - %inbound-request + %http-server + %request %.n [%ipv4 .192.168.1.1] %'GET' @@ -1075,7 +1092,8 @@ ^- (list move:light-gate) :~ :* duct=~[/http-get-open] %give - %http-response + %http-server + %response %start 200 :~ ['content-type' 'text/event-stream'] @@ -1120,7 +1138,8 @@ ^- (list move:light-gate) :~ :* duct=~[/http-get-open] %give - %http-response + %http-server + %response %continue :- ~ %- as-octs:mimes:html @@ -1143,7 +1162,8 @@ scry=*sley ^= call-args :* duct=~[/http-put-request] ~ - %inbound-request + %http-server + %request %.n [%ipv4 .192.168.1.1] %'PUT' @@ -1166,7 +1186,7 @@ [%leaf "wrong number of moves: {<(lent moves)>}"]~ :: %+ expect-eq - !> [~[/http-put-request] %give %http-response %start 200 ~ ~ %.y] + !> [~[/http-put-request] %give %http-server %response %start 200 ~ ~ %.y] !> i.moves == :: the client connection is detected to be broken @@ -1176,7 +1196,7 @@ light-gate now=(add ~1111.1.2 ~m6) scry=*sley - call-args=[duct=~[/http-get-open] ~ %cancel-inbound-request ~] + call-args=[duct=~[/http-get-open] ~ %http-server %cancel-request ~] ^= expected-moves ^- (list move:light-gate) :: closing the channel restarts the timeout timer @@ -1213,7 +1233,8 @@ scry=*sley ^= call-args :* duct=~[/http-get-open] ~ - %inbound-request + %http-server + %request %.n [%ipv4 .192.168.1.1] %'GET' @@ -1225,7 +1246,8 @@ ^- (list move:light-gate) :~ :* duct=~[/http-get-open] %give - %http-response + %http-server + %response %start 200 :~ ['content-type' 'text/event-stream'] @@ -1267,9 +1289,9 @@ results8 results9 == -:: +test-fetch-basic: tests a single request, single reply style http request +:: +test-client-request-basic: tests a single request, single reply style http request :: -++ test-fetch-basic +++ test-client-request-basic :: send a %born event to use /initial-born-duct for requests :: =^ results1 light-gate @@ -1285,7 +1307,8 @@ ^= expected-moves :~ :* duct=~[/initial-born-duct] %give - %form + %http-server + %set-config *http-config:light == == == :: @@ -1304,7 +1327,8 @@ scry=*sley ^= call-args :* duct=~[/http-get-request] ~ - %fetch + %http-client + %request request *outbound-config:light == @@ -1312,7 +1336,8 @@ ^- (list move:light-gate) :~ :* duct=~[/initial-born-duct] %give - %http-request + %http-client + %request id=0 ~ method=%'GET' @@ -1330,7 +1355,8 @@ ^= call-args :+ duct=~[/initial-born-duct] ~ ^- task:able:light - :* %receive + :* %http-client + %receive id=0 ^- raw-http-response:light :* %start @@ -1351,7 +1377,8 @@ ^- (list move:light-gate) :~ :* duct=~[/http-get-request] %give - %http-finished + %http-client + %finished :: :- 200 :~ ['content-type' 'text/html'] @@ -1371,9 +1398,9 @@ results2 results3 == -:: +test-fetch-multiple-cards: tests when complete=%.n +:: +test-client-request-multiple-cards: tests when complete=%.n :: -++ test-fetch-multiple-cards +++ test-client-request-multiple-cards :: send a %born event to use /initial-born-duct for requests :: =^ results1 light-gate @@ -1389,7 +1416,8 @@ ^= expected-moves :~ :* duct=~[/initial-born-duct] %give - %form + %http-server + %set-config *http-config:light == == == :: @@ -1408,7 +1436,8 @@ scry=*sley ^= call-args :* duct=~[/http-get-request] ~ - %fetch + %http-client + %request request *outbound-config:light == @@ -1416,7 +1445,8 @@ ^- (list move:light-gate) :~ :* duct=~[/initial-born-duct] %give - %http-request + %http-client + %request id=0 ~ method=%'GET' @@ -1434,7 +1464,8 @@ ^= call-args :+ duct=~[/initial-born-duct] ~ ^- task:able:light - :* %receive + :* %http-client + %receive id=0 ^- raw-http-response:light :* %start @@ -1449,7 +1480,8 @@ ^- (list move:light-gate) :~ :* duct=~[/http-get-request] %give - %http-progress + %http-client + %progress :: :- 200 :~ ['content-type' 'text/html'] @@ -1470,7 +1502,8 @@ ^= call-args :+ duct=~[/initial-born-duct] ~ ^- task:able:light - :* %receive + :* %http-client + %receive id=0 ^- raw-http-response:light :* %continue @@ -1481,7 +1514,8 @@ ^- (list move:light-gate) :~ :* duct=~[/http-get-request] %give - %http-progress + %http-client + %progress :: :- 200 :~ ['content-type' 'text/html'] @@ -1502,7 +1536,8 @@ ^= call-args :+ duct=~[/initial-born-duct] ~ ^- task:able:light - :* %receive + :* %http-client + %receive id=0 ^- raw-http-response:light :* %continue @@ -1513,7 +1548,8 @@ ^- (list move:light-gate) :~ :* duct=~[/http-get-request] %give - %http-finished + %http-client + %finished :: :- 200 :~ ['content-type' 'text/html'] @@ -1693,7 +1729,8 @@ scry=*sley ^= call-args :* duct=~[/http-blah] ~ - %inbound-request + %http-server + %request %.n [%ipv4 .192.168.1.1] [%'GET' '/~/login?redirect=/~landscape/inner-path' ~ ~] @@ -1702,7 +1739,8 @@ ^- (list move:light-gate) :~ :* duct=~[/http-blah] %give - %http-response + %http-server + %response %start 200 :~ ['content-type' 'text/html'] @@ -1721,7 +1759,8 @@ scry=*sley ^= call-args :* duct=~[/http-blah] ~ - %inbound-request + %http-server + %request %.n [%ipv4 .192.168.1.1] %'POST' @@ -1735,7 +1774,8 @@ ^- (list move:light-gate) :~ :* duct=~[/http-blah] %give - %http-response + %http-server + %response %start 307 :~ ['location' '/~landscape'] @@ -1782,7 +1822,8 @@ scry=*sley ^= call-args :* duct=~[/http-put-request] ~ - %inbound-request + %http-server + %request %.n [%ipv4 .192.168.1.1] %'PUT' @@ -1829,7 +1870,7 @@ card.i.t.moves :: %+ expect-eq - !> [~[/http-put-request] %give %http-response %start 200 ~ ~ %.y] + !> [~[/http-put-request] %give %http-server %response %start 200 ~ ~ %.y] !> i.t.t.moves :: %+ expect-eq