renames +http-client interface core to +iris

This commit is contained in:
Joe Bryan 2019-07-03 23:45:54 -07:00
parent e0f17b0ff1
commit 27da0d61d8
14 changed files with 167 additions and 166 deletions

View File

@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:6571b65d5615573b794a2d00799b45f5dc713b2f7f6f5eee59f35214deda8af8
size 8399855
oid sha256:4357a84e0bc2c1259b77258669b418624bfd59d9e1761666fc6fb0da416f0305
size 8399448

View File

@ -150,7 +150,7 @@
$% [%connect wire =binding:eyre app=term]
[%http-response =http-event:http]
[%poke wire dock poke]
[%request wire request:http outbound-config:http-client]
[%request wire request:http outbound-config:iris]
[%rule wire %cert (unit [wain wain])]
[%wait wire @da]
==
@ -394,7 +394,7 @@
++ request
|= [wir=wire req=hiss]
^- card
[%request wir (hiss-to-request:html req) *outbound-config:http-client]
[%request wir (hiss-to-request:html req) *outbound-config:iris]
:: +signed-request: JWS JSON POST
::
++ signed-request
@ -1131,7 +1131,7 @@
==
--
++ http-response
|= [=wire response=client-response:http-client]
|= [=wire response=client-response:iris]
^- (quip move _this)
:: ignore progress reports
::
@ -1144,7 +1144,7 @@
?: ?=(%cancel -.response)
(retry:event t.wire)
::
=/ rep=httr (to-httr:http-client +.response)
=/ rep=httr (to-httr:iris +.response)
:: add nonce to pool, if present
::
=/ nonhed (skim q.rep |=((pair @t @t) ?=(%replay-nonce p)))

View File

@ -821,7 +821,7 @@
::
;< ~ bind:m
(send-request:stdio (retrieve-access-token:(oauth2-core bowl scry.pro.aut.nam) code))
;< rep=(unit client-response:http-client) bind:m
;< rep=(unit client-response:iris) bind:m
take-maybe-response:stdio
:: XX retry
::

View File

@ -106,7 +106,7 @@
++ card :: general card
$% {$diff $sole-effect sole-effect} ::
{$send wire {ship term} clap} ::
[%request wire request:http outbound-config:http-client] :: %l
[%request wire request:http outbound-config:iris] :: %l
[%build wire ? schematic:ford]
[%kill wire ~]
{$deal wire sock term club} ::
@ -363,7 +363,7 @@
|= [way=wire =request:http]
^+ +>+>
?> ?=(~ pux)
(he-card(poy `+>+<(pux `way)) %request way request *outbound-config:http-client)
(he-card(poy `+>+<(pux `way)) %request way request *outbound-config:iris)
::
++ dy-stop :: stop work
^+ +>
@ -951,7 +951,7 @@
:: +he-http-response: result from http-client
::
++ he-http-response
|= [way=wire response=client-response:http-client]
|= [way=wire response=client-response:iris]
^+ +>
?> ?=(^ poy)
=< he-pine
@ -960,7 +960,7 @@
+>
::
~! response
%. [%httr !>((to-httr:http-client response-header.response full-file.response))]
%. [%httr !>((to-httr:iris response-header.response full-file.response))]
=+ dye=~(. dy u.poy(pux ~))
?+ way !!
{$hand ~} dy-hand:dye

View File

@ -22,7 +22,7 @@
[%http-response =http-event:http]
[%diff %json json]
[%connect wire binding:eyre term]
[%request wire request:http outbound-config:http-client]
[%request wire request:http outbound-config:iris]
[%wait wire @da]
==
+$ poke
@ -69,7 +69,7 @@
[~ this]
=/ str/@t +.jon
=/ req/request:http (request-darksky str)
=/ out *outbound-config:http-client
=/ out *outbound-config:iris
?~ timer
:- %+ weld
`(list move)`[ost.bol %wait /timer (add now.bol ~d1)]~
@ -101,12 +101,12 @@
[bone %diff %json jon]
::
++ http-response
|= [=wire response=client-response:http-client]
|= [=wire response=client-response:iris]
^- (quip move _this)
:: ignore all but %finished
?. ?=(%finished -.response)
[~ this]
=/ data/(unit mime-data:http-client) full-file.response
=/ data/(unit mime-data:iris) full-file.response
?~ data
:: data is null
[~ this]
@ -152,7 +152,7 @@
^- (quip move _this)
=/ req/request:http (request-darksky location)
=/ lismov/(list move)
`(list move)`[ost.bol %request /[(scot %da now.bol)] req *outbound-config:http-client]~
`(list move)`[ost.bol %request /[(scot %da now.bol)] req *outbound-config:iris]~
?~ timer
:- (weld lismov `(list move)`[ost.bol %wait /timer (add now.bol ~h3)]~)
this(timer `(add now.bol ~h3))

View File

@ -69,7 +69,7 @@
=/ m (async ,~)
^- form:m
=/ =card
[%request / request *outbound-config:http-client]
[%request / request *outbound-config:iris]
;< ~ bind:m (send-raw-card card)
(set-raw-contract & %request ~)
::
@ -82,7 +82,7 @@
:: Wait until we get an HTTP response or cancelation
::
++ take-response-raw
=/ m (async (unit client-response:http-client))
=/ m (async (unit client-response:iris))
^- form:m
|= =async-input
:^ ~ ~ ~
@ -108,9 +108,9 @@
:: Wait until we get an HTTP response or cancelation and unset contract
::
++ take-maybe-response
=/ m (async (unit client-response:http-client))
=/ m (async (unit client-response:iris))
^- form:m
;< rep=(unit client-response:http-client) bind:m
;< rep=(unit client-response:iris) bind:m
take-response-raw
;< ~ bind:m (set-raw-contract | %request ~)
(pure:m rep)
@ -118,9 +118,9 @@
:: Wait until we get an HTTP response and unset contract
::
++ take-response
=/ m (async (unit client-response:http-client))
=/ m (async (unit client-response:iris))
^- form:m
;< rep=(unit client-response:http-client) bind:m
;< rep=(unit client-response:iris) bind:m
take-maybe-response
?^ rep
(pure:m rep)
@ -132,7 +132,7 @@
++ take-maybe-sigh
=/ m (async (unit httr:eyre))
^- form:m
;< rep=(unit client-response:http-client) bind:m
;< rep=(unit client-response:iris) bind:m
take-maybe-response
?~ rep
(pure:m ~)
@ -140,7 +140,7 @@
::
?. ?=(%finished -.u.rep)
(pure:m ~)
(pure:m (some (to-httr:http-client +.u.rep)))
(pure:m (some (to-httr:iris +.u.rep)))
::
:: Wait until we get an HTTP response and unset contract
::

View File

@ -380,7 +380,7 @@
:: Pass response to async
::
++ http-response
|= [=wire response=client-response:http-client]
|= [=wire response=client-response:iris]
^- (quip move _this-tapp)
(take-async bowl `[wire %http-response response])
::

View File

@ -10,7 +10,7 @@
[%peer wire dock path]
[%pull wire dock ~]
[%diff out-peer-data]
[%request wire request:http outbound-config:http-client]
[%request wire request:http outbound-config:iris]
[%cancel-request wire ~]
[%connect wire binding:eyre term]
[%http-response =http-event:http]
@ -25,7 +25,7 @@
[%quit =dock =path]
[%reap =dock =path error=(unit tang)]
[%bound success=? =binding:eyre]
[%http-response response=client-response:http-client]
[%http-response response=client-response:iris]
==
::
:: Outstanding contracts

View File

@ -77,7 +77,7 @@
task:able:gall ::
== ::
$: %i ::
$>(%wegh task:able:http-client) ::
$>(%wegh task:able:iris) ::
== ::
$: %j ::
$> $? %dawn ::
@ -125,7 +125,7 @@
gift:able:gall ::
== ::
$: %i ::
$>(%mass gift:able:http-client) ::
$>(%mass gift:able:iris) ::
== ::
$: %j ::
$> $? %init ::

View File

@ -2,7 +2,7 @@
:: http-client
::
|= pit=vase
=, http-client
=, iris
::
::
:: internal data structures

View File

@ -111,7 +111,7 @@
$>(%want task:able:ames) :: send message
== ::
$: %i :: to %iris
$>(%request task:able:http-client) :: http request
$>(%request task:able:iris) :: http request
== ::
$: %j :: to self
$>(%look task) :: set ethereum source
@ -126,7 +126,7 @@
$% [%b $>(%wake gift:able:behn)] :: wakeup
[%j $>(%vent gift)] :: ethereum changes
[%a $>(%woot gift:able:ames)] :: message result
[%i $>(%http-response gift:able:http-client)] :: http response
[%i $>(%http-response gift:able:iris)] :: http response
== ::
-- ::
:: ::::
@ -1759,7 +1759,7 @@
:^ %i %request
?> ?=(%| -.source)
(light-json-request node.p.source jon)
*outbound-config:http-client
*outbound-config:iris
::
:: +| source-operations
::
@ -1983,11 +1983,11 @@
(complete-with-rpc-response cuz rep)
::
++ finished
|= [cuz=wire =response-header:http full-file=(unit mime-data:http-client)]
|= [cuz=wire =response-header:http full-file=(unit mime-data:iris)]
^+ +>
?: ?=(%& -.source) +>
::
=+ rep=(httr-to-rpc-response (to-httr:http-client response-header full-file))
=+ rep=(httr-to-rpc-response (to-httr:iris response-header full-file))
(complete-with-rpc-response cuz rep)
::
++ complete-with-rpc-response

View File

@ -1940,6 +1940,119 @@
++ suss (trel dude @tas @da) :: config report
++ well (pair desk term) ::
-- ::gall
:: %iris http-client interface
::
++ iris ^?
|%
++ able
|%
:: +gift: effects the client can emit
::
++ gift
$% :: %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=request:http]
:: %cancel-request: tell earth to cancel a previous %request
::
[%cancel-request id=@ud]
:: %response: response to the caller
::
[%http-response =client-response]
:: memory usage report
::
[%mass p=mass]
==
::
++ task
$~ [%vega ~]
$% :: event failure notification
::
$>(%crud vane-task)
:: system started up; reset open connections
::
$>(%born vane-task)
:: report upgrade
::
$>(%vega vane-task)
:: fetches a remote resource
::
[%request =request:http =outbound-config]
:: cancels a previous fetch
::
[%cancel-request ~]
:: receives http data from outside
::
[%receive id=@ud =http-event:http]
:: memory usage request
::
$>(%wegh vane-task)
==
--
:: +client-response: one or more client responses given to the caller
::
+$ client-response
$% :: periodically sent as an update on the duct that sent %fetch
::
$: %progress
:: http-response-header: full transaction header
::
:: In case of a redirect chain, this is the target of the
:: final redirect.
::
=response-header:http
:: bytes-read: bytes fetched so far
::
bytes-read=@ud
:: expected-size: the total size if response had a content-length
::
expected-size=(unit @ud)
:: incremental: data received since the last %http-progress
::
incremental=(unit octs)
==
:: final response of a download, parsed as mime-data if successful
::
[%finished =response-header:http full-file=(unit mime-data)]
:: canceled by the runtime system
::
[%cancel ~]
==
:: mime-data: externally received but unvalidated mimed data
::
+$ mime-data
[type=@t data=octs]
:: +outbound-config: configuration for outbound http requests
::
+$ outbound-config
$: :: number of times to follow a 300 redirect before erroring
::
:: Common values for this will be 3 (the limit most browsers use), 5
:: (the limit recommended by the http standard), or 0 (let the
:: requester deal with 300 redirects).
::
redirects=_5
:: number of times to retry before failing
::
:: When we retry, we'll automatically try to use the 'Range' header
:: to resume the download where we left off if we have the
:: 'Accept-Range: bytes' in the original response.
::
retries=_3
==
:: +to-httr: adapts to old eyre interface
::
++ to-httr
|= [header=response-header:http full-file=(unit mime-data)]
^- httr:eyre
::
=/ data=(unit octs)
?~(full-file ~ `data.u.full-file)
::
[status-code.header headers.header data]
--
:: ::::
:::: ++jael :: (1h) security
:: ::::
@ -2308,118 +2421,6 @@
++ oath @ :: signature
-- :: pki
-- :: kale
::
++ http-client ^?
|%
++ able
|%
:: +gift: effects the client can emit
::
++ gift
$% :: %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=request:http]
:: %cancel-request: tell earth to cancel a previous %request
::
[%cancel-request id=@ud]
:: %response: response to the caller
::
[%http-response =client-response]
:: memory usage report
::
[%mass p=mass]
==
::
++ task
$~ [%vega ~]
$% :: event failure notification
::
$>(%crud vane-task)
:: system started up; reset open connections
::
$>(%born vane-task)
:: report upgrade
::
$>(%vega vane-task)
:: fetches a remote resource
::
[%request =request:http =outbound-config]
:: cancels a previous fetch
::
[%cancel-request ~]
:: receives http data from outside
::
[%receive id=@ud =http-event:http]
:: memory usage request
::
$>(%wegh vane-task)
==
--
:: +client-response: one or more client responses given to the caller
::
+$ client-response
$% :: periodically sent as an update on the duct that sent %fetch
::
$: %progress
:: http-response-header: full transaction header
::
:: In case of a redirect chain, this is the target of the
:: final redirect.
::
=response-header:http
:: bytes-read: bytes fetched so far
::
bytes-read=@ud
:: expected-size: the total size if response had a content-length
::
expected-size=(unit @ud)
:: incremental: data received since the last %http-progress
::
incremental=(unit octs)
==
:: final response of a download, parsed as mime-data if successful
::
[%finished =response-header:http full-file=(unit mime-data)]
:: canceled by the runtime system
::
[%cancel ~]
==
:: mime-data: externally received but unvalidated mimed data
::
+$ mime-data
[type=@t data=octs]
:: +outbound-config: configuration for outbound http requests
::
+$ outbound-config
$: :: number of times to follow a 300 redirect before erroring
::
:: Common values for this will be 3 (the limit most browsers use), 5
:: (the limit recommended by the http standard), or 0 (let the
:: requester deal with 300 redirects).
::
redirects=_5
:: number of times to retry before failing
::
:: When we retry, we'll automatically try to use the 'Range' header
:: to resume the download where we left off if we have the
:: 'Accept-Range: bytes' in the original response.
::
retries=_3
==
:: +to-httr: adapts to old eyre interface
::
++ to-httr
|= [header=response-header:http full-file=(unit mime-data)]
^- httr:eyre
::
=/ data=(unit octs)
?~(full-file ~ `data.u.full-file)
::
[status-code.header headers.header data]
--
:: ::::
:::: ++xmas :: (1i) new network
:: ::::
@ -7581,7 +7582,7 @@
gift:able:eyre
gift:able:ford
gift:able:gall
gift:able:http-client
gift:able:iris
gift:able:jael
==
++ task-arvo :: in request ->$
@ -7589,7 +7590,7 @@
task:able:clay
task:able:behn
task:able:dill
task:able:http-client
task:able:iris
task:able:ford
task:able:gall
task:able:eyre
@ -7604,7 +7605,7 @@
[%e task:able:eyre]
{$f task:able:ford}
{$g task:able:gall}
[%i task:able:http-client]
[%i task:able:iris]
{$j task:able:jael}
{@tas $meta vase}
==
@ -7620,7 +7621,7 @@
{$f gift:able:ford}
[%e gift:able:eyre]
{$g gift:able:gall}
[%i gift:able:http-client]
[%i gift:able:iris]
{$j gift:able:jael}
==
::
@ -7666,7 +7667,7 @@
$>(%live task:able:eyre)
:: %iris: hear (partial) http response
::
$>(%receive task:able:http-client)
$>(%receive task:able:iris)
:: %eyre: starts handling an inbound http request
::
$>(%request task:able:eyre)

View File

@ -47,7 +47,7 @@
%request
/acme/try/2/directory
[%'GET' (crip (en-purl:html directory-base:app)) ~ ~]
*outbound-config:http-client
*outbound-config:iris
== ==
!> moves
--

View File

@ -39,7 +39,7 @@
:* duct=~[/http-get-request] ~
%request
request
*outbound-config:http-client
*outbound-config:iris
==
^= expected-moves
^- (list move:http-client-gate)
@ -61,7 +61,7 @@
scry=*sley
^= call-args
:+ duct=~[/initial-born-duct] ~
^- task:able:http-client
^- task:able:iris
:* %receive
id=0
^- http-event:http
@ -135,7 +135,7 @@
:* duct=~[/http-get-request] ~
%request
request
*outbound-config:http-client
*outbound-config:iris
==
^= expected-moves
^- (list move:http-client-gate)
@ -157,7 +157,7 @@
scry=*sley
^= call-args
:+ duct=~[/initial-born-duct] ~
^- task:able:http-client
^- task:able:iris
:* %receive
id=0
^- http-event:http
@ -194,7 +194,7 @@
scry=*sley
^= call-args
:+ duct=~[/initial-born-duct] ~
^- task:able:http-client
^- task:able:iris
:* %receive
id=0
^- http-event:http
@ -227,7 +227,7 @@
scry=*sley
^= call-args
:+ duct=~[/initial-born-duct] ~
^- task:able:http-client
^- task:able:iris
:* %receive
id=0
^- http-event:http
@ -292,7 +292,7 @@
:* duct=~[/http-get-request] ~
%request
request
*outbound-config:http-client
*outbound-config:iris
==
^= expected-moves
^- (list move:http-client-gate)
@ -314,7 +314,7 @@
scry=*sley
^= call-args
:+ duct=~[/initial-born-duct] ~
^- task:able:http-client
^- task:able:iris
:* %receive
id=0
^- http-event:http
@ -398,7 +398,7 @@
:* duct=~[/http-get-request] ~
%request
request
*outbound-config:http-client
*outbound-config:iris
==
^= expected-moves
^- (list move:http-client-gate)
@ -420,7 +420,7 @@
scry=*sley
^= call-args
:+ duct=~[/initial-born-duct] ~
^- task:able:http-client
^- task:able:iris
:* %receive
id=0
^- http-event:http
@ -471,7 +471,7 @@
:* duct=~[/http-get-request] ~
%request
request
*outbound-config:http-client
*outbound-config:iris
==
^= expected-moves
^- (list move:http-client-gate)
@ -492,7 +492,7 @@
scry=*sley
^= call-args
:+ duct=~[/secondary-born-duct] ~
^- task:able:http-client
^- task:able:iris
:* %born
~
==
@ -515,7 +515,7 @@
|= $: http-client-gate=_http-client-gate
now=@da
scry=sley
call-args=[=duct type=* wrapped-task=(hobo task:able:http-client)]
call-args=[=duct type=* wrapped-task=(hobo task:able:iris)]
expected-moves=(list move:http-client-gate)
==
^- [tang _http-client-gate]