mirror of
https://github.com/urbit/shrub.git
synced 2024-12-15 04:22:48 +03:00
Change :dns and :acme over to the new %lient interfaces.
This commit is contained in:
parent
67cc76a486
commit
cd8c637b90
@ -139,7 +139,7 @@
|
||||
:: +card: output effect payload
|
||||
::
|
||||
+$ card
|
||||
$% [%hiss wire ~ %httr %hiss hiss:eyre]
|
||||
$% [%request wire request:http outbound-config:http-client]
|
||||
[%poke wire dock poke]
|
||||
[%rule wire %cert (unit [wain wain])]
|
||||
[%wait wire @da]
|
||||
@ -385,7 +385,7 @@
|
||||
++ request
|
||||
|= [wir=wire req=hiss]
|
||||
^- card
|
||||
[%hiss wir ~ %httr %hiss req]
|
||||
[%request wir (hiss-to-request:html req) *outbound-config:http-client]
|
||||
:: +signed-request: JWS JSON POST
|
||||
::
|
||||
++ signed-request
|
||||
@ -1147,29 +1147,15 @@
|
||||
%finalize-trial finalize-trial:fec
|
||||
==
|
||||
--
|
||||
:: +sigh-tang: handle http request failure
|
||||
::
|
||||
++ sigh-tang
|
||||
|= [=wire =tang]
|
||||
++ http-response
|
||||
|= [=wire response=client-response:http-client]
|
||||
^- (quip move _this)
|
||||
?> ?=([%acme ^] wire)
|
||||
:: XX may God forgive me for this
|
||||
::
|
||||
=< abet
|
||||
=- ?:(?=(%& -.-) p.- this)
|
||||
%- mule |.
|
||||
(retry:event t.wire)
|
||||
:: +sigh-recoverable-error: handle http rate-limit response
|
||||
::
|
||||
:: XX we won't receive this unless we request a
|
||||
:: mark conversion and it fails
|
||||
::
|
||||
++ sigh-recoverable-error
|
||||
|= [=wire %429 %rate-limit lim=(unit @da)]
|
||||
^- (quip move _this)
|
||||
~& [%sigh-recoverable wire lim]
|
||||
?> ?=([%acme ^] wire)
|
||||
abet:(retry:event t.wire)
|
||||
?. ?=(%finished -.response)
|
||||
:: ignore progress reports
|
||||
[~ this]
|
||||
::
|
||||
(sigh-httr wire (to-httr:http-client +.response))
|
||||
:: +sigh-httr: accept http response
|
||||
::
|
||||
++ sigh-httr
|
||||
|
42
app/dns.hoon
42
app/dns.hoon
@ -10,7 +10,7 @@
|
||||
[%hall-action %phrase audience:hall (list speech:hall)]
|
||||
==
|
||||
+$ card
|
||||
$% [%hiss wire (unit ~) %httr %hiss hiss:eyre]
|
||||
$% [%request wire request:http outbound-config:http-client]
|
||||
[%poke wire dock poke]
|
||||
[%rule wire %turf %put turf]
|
||||
[%wait wire @da]
|
||||
@ -450,43 +450,27 @@
|
||||
^- (quip move _this)
|
||||
~& +<+:this
|
||||
[~ this]
|
||||
:: +sigh-httr: accept http response
|
||||
::
|
||||
++ sigh-httr
|
||||
|= [=wire rep=httr:eyre]
|
||||
++ http-response
|
||||
|= [=wire response=client-response:http-client]
|
||||
^- (quip move _this)
|
||||
?. ?=(%finished -.response)
|
||||
:: progress report
|
||||
[~ this]
|
||||
::
|
||||
?+ wire
|
||||
~& [%strange-http-response wire rep]
|
||||
~& [%strange-http-response wire response]
|
||||
[~ this]
|
||||
::
|
||||
[%authority *]
|
||||
?~ nem
|
||||
~& [%not-an-authority %http-response wire rep]
|
||||
~& [%not-an-authority %http-response wire response]
|
||||
[~ this]
|
||||
abet:(~(http-response bind u.nem) t.wire rep)
|
||||
abet:(~(http-response bind u.nem) t.wire (to-httr:http-client +.response))
|
||||
::
|
||||
[%relay %him @ *]
|
||||
=/ him=ship (slav %p i.t.t.wire)
|
||||
abet:(http-response:(tell him) t.t.t.wire rep)
|
||||
==
|
||||
:: +sigh-tang: failed to make http request
|
||||
::
|
||||
++ sigh-tang
|
||||
|= [=wire =tang]
|
||||
^- (quip move _this)
|
||||
?+ wire
|
||||
~& [%strange-sigh-tang wire]
|
||||
[((slog tang) ~) this]
|
||||
::
|
||||
[%authority *]
|
||||
?~ nem
|
||||
~& [%not-an-authority %http-crash wire]
|
||||
[((slog tang) ~) this]
|
||||
abet:(~(http-crash bind u.nem) t.wire tang)
|
||||
::
|
||||
[%relay %him @ *]
|
||||
=/ him=ship (slav %p i.t.t.wire)
|
||||
abet:(http-crash:(tell him) t.t.t.wire tang)
|
||||
abet:(http-response:(tell him) t.t.t.wire (to-httr:http-client +.response))
|
||||
==
|
||||
:: +wake: timer callback
|
||||
::
|
||||
@ -625,7 +609,7 @@
|
||||
++ request
|
||||
|= [=wire =hiss:eyre]
|
||||
^- card
|
||||
[%hiss wire [~ ~] %httr %hiss hiss]
|
||||
[%request wire (hiss-to-request:html hiss) *outbound-config:http-client]
|
||||
:: +http-wire: build a wire for a |tell request
|
||||
::
|
||||
++ http-wire
|
||||
@ -867,7 +851,7 @@
|
||||
++ request
|
||||
|= [=wire =hiss:eyre]
|
||||
^- card
|
||||
[%hiss wire ~ %httr %hiss hiss]
|
||||
[%request wire (hiss-to-request:html hiss) *outbound-config:http-client]
|
||||
:: +http-wire: build a wire for a |tell request
|
||||
::
|
||||
++ http-wire
|
||||
|
@ -43,6 +43,11 @@
|
||||
++ test-first-order-wake
|
||||
=^ moves app (~(wake app *bowl:gall *acme:app) /acme/try/1/directory ~)
|
||||
%+ expect-eq
|
||||
!> ~[[ost.bow.app [%hiss /acme/try/2/directory ~ %httr %hiss directory-base:app %get ~ ~]]]
|
||||
!> :~ :* ost.bow.app
|
||||
%request
|
||||
/acme/try/2/directory
|
||||
[%'GET' (crip (en-purl:html directory-base:app)) ~ ~]
|
||||
*outbound-config:http-client
|
||||
== ==
|
||||
!> moves
|
||||
--
|
||||
|
Loading…
Reference in New Issue
Block a user