update for the released http-mirage-client
This commit is contained in:
parent
878ecab0b2
commit
c6e8c6cf77
2 changed files with 5 additions and 4 deletions
|
@ -97,7 +97,7 @@ let tcp = tcpv4v6_of_stackv4v6 stack
|
||||||
|
|
||||||
let http_client =
|
let http_client =
|
||||||
let packages =
|
let packages =
|
||||||
[ package ~pin:"git+https://git.robur.io/robur/http-mirage-client.git#main" "http-mirage-client" ] in
|
[ package "http-mirage-client" ] in
|
||||||
let connect _ modname = function
|
let connect _ modname = function
|
||||||
| [ _pclock; _tcpv4v6; ctx ] ->
|
| [ _pclock; _tcpv4v6; ctx ] ->
|
||||||
Fmt.str {ocaml|%s.connect %s|ocaml} modname ctx
|
Fmt.str {ocaml|%s.connect %s|ocaml} modname ctx
|
||||||
|
|
|
@ -717,11 +717,12 @@ stamp: %S
|
||||||
incr idx;
|
incr idx;
|
||||||
if !idx mod 10 = 0 then Gc.full_major () ;
|
if !idx mod 10 = 0 then Gc.full_major () ;
|
||||||
Logs.info (fun m -> m "downloading %s" url);
|
Logs.info (fun m -> m "downloading %s" url);
|
||||||
Http_mirage_client.one_request http_client url >>= function
|
let body _response acc data = Lwt.return (acc ^ data) in
|
||||||
| Ok (resp, Some str) ->
|
Http_mirage_client.request http_client url body "" >>= function
|
||||||
|
| Ok (resp, body) ->
|
||||||
if resp.status = `OK then begin
|
if resp.status = `OK then begin
|
||||||
Logs.info (fun m -> m "downloaded %s" url);
|
Logs.info (fun m -> m "downloaded %s" url);
|
||||||
Disk.write disk ~url str csums
|
Disk.write disk ~url body csums
|
||||||
end else begin
|
end else begin
|
||||||
Logs.warn (fun m -> m "%s: %a (reason %s)"
|
Logs.warn (fun m -> m "%s: %a (reason %s)"
|
||||||
url H2.Status.pp_hum resp.status resp.reason);
|
url H2.Status.pp_hum resp.status resp.reason);
|
||||||
|
|
Loading…
Reference in a new issue