if there's a http error, return the error
This commit is contained in:
parent
982a35a5b1
commit
e51550aedc
1 changed files with 9 additions and 6 deletions
|
@ -309,12 +309,15 @@ module Make
|
||||||
(* XXX: we may be in trouble if different hash functions are used for the same archive *)
|
(* XXX: we may be in trouble if different hash functions are used for the same archive *)
|
||||||
let ( >>>= ) = Lwt_result.bind in
|
let ( >>>= ) = Lwt_result.bind in
|
||||||
fun response r data ->
|
fun response r data ->
|
||||||
Lwt.return r >>>= fun (digests, swap) ->
|
if Http_mirage_client.Status.is_successful response.Http_mirage_client.status then
|
||||||
let digests = Archive_checksum.update_digests digests data in
|
Lwt.return r >>>= fun (digests, swap) ->
|
||||||
active_add_bytes url (String.length data);
|
let digests = Archive_checksum.update_digests digests data in
|
||||||
Swap.append swap data >|= function
|
active_add_bytes url (String.length data);
|
||||||
| Ok () -> Ok (digests, swap)
|
Swap.append swap data >|= function
|
||||||
| Error swap_err -> Error (`Swap swap_err)
|
| Ok () -> Ok (digests, swap)
|
||||||
|
| Error swap_err -> Error (`Swap swap_err)
|
||||||
|
else
|
||||||
|
Lwt.return (Error `Bad_response)
|
||||||
|
|
||||||
let check_csums_digests csums digests =
|
let check_csums_digests csums digests =
|
||||||
let csums' = Archive_checksum.digests_to_hm digests in
|
let csums' = Archive_checksum.digests_to_hm digests in
|
||||||
|
|
Loading…
Reference in a new issue