diff --git a/app/dojo.hoon b/app/dojo.hoon index e0af40784..4e946f76e 100644 --- a/app/dojo.hoon +++ b/app/dojo.hoon @@ -948,16 +948,19 @@ ?~ p.cit (he-diff %txt ">=") (he-diff %tan u.p.cit) - :: +he-finished: result from http-client + :: +he-http-response: result from http-client :: - ++ he-finished - |= [way=wire header=response-header:http full-file=(unit mime-data:http-client)] + ++ he-http-response + |= [way=wire response=client-response:http-client] ^+ +> - ~& [%response header full-file] ?> ?=(^ poy) =< he-pine + ?. ?=(%finished -.response) + ~& %dojo-received-http-progress + +> :: - %. [%httr !>((to-httr:http-client header full-file))] + ~! response + %. [%httr !>((to-httr:http-client response-header.response full-file.response))] =+ dye=~(. dy u.poy(pux ~)) ?+ way !! {$hand ~} dy-hand:dye @@ -1182,7 +1185,7 @@ [~ +>.$] :: ++ made (wrap he-made):arm -++ finished (wrap he-finished):arm +++ http-response (wrap he-http-response):arm ++ lame (wrap he-lame):arm ++ unto (wrap he-unto):arm ++ pull diff --git a/sur/sole.hoon b/sur/sole.hoon index 9495c8568..e19b08639 100644 --- a/sur/sole.hoon +++ b/sur/sole.hoon @@ -71,19 +71,9 @@ %+ each (unit out) :: ~ is abort (pair sole-prompt (sole-dialog out)) :: ask and continue :: :: -++ sole-request :: scraper result - |* out/$-(* *) :: output structure - %+ pair (list tank) :: - %+ each (unit out) :: ~ is abort - %^ trel :: fetch and continue - (unit knot) - hiss:eyre - $-(httr:eyre (sole-request out)) -:: :: ++ sole-gen :: XX virtual type $% {$say $-((sole-args) (cask))} :: direct noun {$ask $-((sole-args) (sole-product (cask)))} :: dialog - {$get $-((sole-args) (sole-request (cask)))} :: scraper == :: ++ sole-args :: generator arguments |* _[* *] :: diff --git a/sys/vane/lient.hoon b/sys/vane/lient.hoon index 9b4a70d06..73cab7046 100644 --- a/sys/vane/lient.hoon +++ b/sys/vane/lient.hoon @@ -198,6 +198,7 @@ :_ ~ :* duct.connection %give + %http-response %progress (need response-header.in-progress-http-request.connection) bytes-read.in-progress-http-request.connection @@ -230,6 +231,7 @@ u.mime-type :- :~ :* duct.connection %give + %http-response %finished response-header ?:(=(0 p.data) ~ `[mime data]) diff --git a/sys/zuse.hoon b/sys/zuse.hoon index f13d0d7ac..3319daca5 100644 --- a/sys/zuse.hoon +++ b/sys/zuse.hoon @@ -2057,28 +2057,9 @@ :: %cancel-request: tell earth to cancel a previous %request :: [%cancel-request id=@ud] - :: periodically sent as an update on the duct that sent %fetch + :: %response: response to the caller :: - $: %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)] + [%http-response =client-response] == :: ++ task @@ -2099,6 +2080,32 @@ [%receive id=@ud =http-event:http] == -- + :: +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)] + == :: mime-data: externally received but unvalidated mimed data :: +$ mime-data diff --git a/tests/sys/vane/lient.hoon b/tests/sys/vane/lient.hoon index 62e094f23..1ab8cbe40 100644 --- a/tests/sys/vane/lient.hoon +++ b/tests/sys/vane/lient.hoon @@ -83,6 +83,7 @@ ^- (list move:http-client-gate) :~ :* duct=~[/http-get-request] %give + %http-response %finished :: :- 200 @@ -172,6 +173,7 @@ ^- (list move:http-client-gate) :~ :* duct=~[/http-get-request] %give + %http-response %progress :: :- 200 @@ -204,6 +206,7 @@ ^- (list move:http-client-gate) :~ :* duct=~[/http-get-request] %give + %http-response %progress :: :- 200 @@ -236,6 +239,7 @@ ^- (list move:http-client-gate) :~ :* duct=~[/http-get-request] %give + %http-response %finished :: :- 200