diff --git a/lib/stdio.hoon b/lib/stdio.hoon index f8d58e5ce4..f01e3f65fc 100644 --- a/lib/stdio.hoon +++ b/lib/stdio.hoon @@ -195,6 +195,35 @@ :: :: ---- :: +:: Incoming HTTP requests +:: +++ bind-route-raw + |= [=binding:http-server =term] + =/ m (async ,~) + ^- form:m + (send-raw-card [%connect / binding term]) +:: +++ take-bound + =/ m (async ?) + ^- form:m + |= =async-input + :^ ~ ~ ~ + ?~ in.async-input + [%wait ~] + =* sign sign.u.in.async-input + ?. ?=(%bound -.sign) + [%fail %expected-bound >got=-.sign< ~] + [%done success.sign] +:: +++ bind-route + |= [=binding:http-server =term] + =/ m (async ?) + ^- form:m + ;< ~ bind:m (bind-route-raw binding term) + take-bound +:: +:: ---- +:: :: Identity is immutable :: :: XX should be statefully cycled diff --git a/lib/tapp.hoon b/lib/tapp.hoon index e02acb71e1..6647e3fb5a 100644 --- a/lib/tapp.hoon +++ b/lib/tapp.hoon @@ -403,6 +403,13 @@ `this-tapp start-async :: + :: Receive route binding notification + :: + ++ bound + |= [=wire success=? =binding:http-server] + ^- (quip move _this-tapp) + (take-async bowl `[wire %bound success binding]) + :: :: Continue computing async :: ++ take-async diff --git a/sur/tapp.hoon b/sur/tapp.hoon index caff0b5bc6..7837f93053 100644 --- a/sur/tapp.hoon +++ b/sur/tapp.hoon @@ -12,6 +12,7 @@ [%diff out-peer-data] [%request wire request:http outbound-config:http-client] [%cancel-request wire ~] + [%connect wire binding:http-server term] [%http-response =http-event:http] [%rule wire %turf %put turf] == @@ -23,6 +24,7 @@ [%coup =dock error=(unit tang)] [%quit =dock =path] [%reap =dock =path error=(unit tang)] + [%bound success=? =binding:http-server] [%http-response response=client-response:http-client] == ::