Skip to content

Commit

Permalink
Merge pull request #1084 from art-w/ci-fix
Browse files Browse the repository at this point in the history
chore: fix CI
  • Loading branch information
rgrinberg committed Sep 10, 2024
2 parents 1568940 + 211c825 commit 940ec36
Show file tree
Hide file tree
Showing 12 changed files with 29 additions and 34 deletions.
2 changes: 0 additions & 2 deletions .github/workflows/workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ jobs:
- ubuntu-latest
- macos-latest
ocaml-compiler:
- "4.14"
- "5"
local-packages:
- |
Expand Down Expand Up @@ -66,7 +65,6 @@ jobs:
- ubuntu-latest
- macos-latest
ocaml-compiler:
- "4.14"
- "5"
local-packages:
- |
Expand Down
2 changes: 1 addition & 1 deletion cohttp-async.opam
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ depends: [
"core_unix" {>= "v0.14.0"}
"conduit-async" {>= "1.2.0"}
"magic-mime"
"mirage-crypto" {with-test}
"digestif" {with-test}
"logs"
"fmt" {>= "0.8.2"}
"sexplib0"
Expand Down
2 changes: 1 addition & 1 deletion cohttp-async/examples/dune
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
(executables
(names hello_world receive_post)
(libraries
mirage-crypto
digestif.c
http
cohttp-async
base
Expand Down
17 changes: 5 additions & 12 deletions cohttp-async/examples/s3_cp.ml
Original file line number Diff line number Diff line change
Expand Up @@ -171,8 +171,7 @@ module Auth = struct

let digest s =
(* string -> sha256 as a hex string *)
Mirage_crypto.Hash.(digest `SHA256 (Cstruct.of_string s))
|> Compat.cstruct_to_hex_string
Digestif.SHA256.(digest_string s |> to_hex)

let make_amz_headers ?body time =
(* Return x-amz-date and x-amz-sha256 headers *)
Expand Down Expand Up @@ -239,16 +238,12 @@ module Auth = struct
Printf.sprintf "AWS4-HMAC-SHA256\n%s\n%s\n%s" time_str scope_str hashed_req

let make_signing_key ?date ~region ~service ~secret_access_key () =
let mac k v =
Mirage_crypto.Hash.(mac `SHA256 ~key:k (Cstruct.of_string v))
in
let mac k v = Digestif.SHA256.(hmac_string ~key:k v |> to_raw_string) in
let date' =
match date with None -> Date.today ~zone:Time.Zone.utc | Some d -> d
in
let date_str = Date.to_string_iso8601_basic date' in
let date_key =
mac (Cstruct.of_string ("AWS4" ^ secret_access_key)) date_str
in
let date_key = mac ("AWS4" ^ secret_access_key) date_str in
let date_region_key = mac date_key (string_of_region region) in
let date_region_service_key =
mac date_region_key (string_of_service service)
Expand Down Expand Up @@ -278,14 +273,12 @@ module Auth = struct
(string_of_service service)
in
let signature =
Mirage_crypto.Hash.(
mac `SHA256 ~key:signing_key (Cstruct.of_string string_to_sign))
Digestif.SHA256.(hmac_string ~key:signing_key string_to_sign |> to_hex)
in
let auth_header =
Printf.sprintf
"AWS4-HMAC-SHA256 Credential=%s,SignedHeaders=%s,Signature=%s" creds
signed_headers
(Compat.cstruct_to_hex_string signature)
signed_headers signature
in
[ ("Authorization", auth_header) ]
end
Expand Down
2 changes: 1 addition & 1 deletion cohttp-curl-async.opam
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ doc: "https://mirage.github.io/ocaml-cohttp/"
bug-reports: "https://github.com/mirage/ocaml-cohttp/issues"
depends: [
"dune" {>= "3.0"}
"ocurl"
"ocurl" {>= "0.9.2"}
"http" {= version}
"stringext"
"cohttp-curl" {= version}
Expand Down
2 changes: 1 addition & 1 deletion cohttp-curl-lwt.opam
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ bug-reports: "https://github.com/mirage/ocaml-cohttp/issues"
depends: [
"dune" {>= "3.0"}
"ocaml" {>= "4.08"}
"ocurl"
"ocurl" {>= "0.9.2"}
"http" {= version}
"cohttp-curl" {= version}
"stringext"
Expand Down
2 changes: 1 addition & 1 deletion cohttp-curl.opam
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ bug-reports: "https://github.com/mirage/ocaml-cohttp/issues"
depends: [
"dune" {>= "3.0"}
"ocaml" {>= "4.08"}
"ocurl"
"ocurl" {>= "0.9.2"}
"http" {= version}
"stringext"
"odoc" {with-doc}
Expand Down
2 changes: 1 addition & 1 deletion cohttp-eio.opam
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ depends: [
"mdx" {with-test}
"logs"
"uri"
"tls-eio" {with-test & >= "0.17.2"}
"tls-eio" {with-test & >= "1.0.0"}
"mirage-crypto-rng-eio" {with-test & >= "0.11.2"}
"fmt"
"ptime"
Expand Down
6 changes: 5 additions & 1 deletion cohttp-eio/examples/client_tls.ml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,11 @@ let null_auth ?ip:_ ~host:_ _ =
Ok None (* Warning: use a real authenticator in your code! *)

let https ~authenticator =
let tls_config = Tls.Config.client ~authenticator () in
let tls_config =
match Tls.Config.client ~authenticator () with
| Error (`Msg msg) -> failwith ("tls configuration problem: " ^ msg)
| Ok tls_config -> tls_config
in
fun uri raw ->
let host =
Uri.host uri
Expand Down
2 changes: 1 addition & 1 deletion cohttp-lwt-unix/test/test_parser.ml
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@ let res_content_parse () =
Rep_io.read_body_chunk reader >>= fun body ->
assert_equal
~printer:(fun chunk ->
Transfer.sexp_of_chunk chunk |> Sexplib.Sexp.to_string_hum)
Transfer.sexp_of_chunk chunk |> Sexplib0.Sexp.to_string_hum)
(Transfer.Final_chunk "home=Cosby&favorite+flavor=flies") body;
return ()
| _ -> assert false
Expand Down
10 changes: 5 additions & 5 deletions dune-project
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@
(conduit-async
(>= 1.2.0))
magic-mime
(mirage-crypto :with-test)
(digestif :with-test)
logs
(fmt
(>= 0.8.2))
Expand Down Expand Up @@ -264,7 +264,7 @@
(depends
(ocaml
(>= 4.08))
ocurl
(ocurl (>= 0.9.2))
(http
(= :version))
stringext))
Expand All @@ -277,7 +277,7 @@
(depends
(ocaml
(>= 4.08))
ocurl
(ocurl (>= 0.9.2))
(http
(= :version))
(cohttp-curl
Expand Down Expand Up @@ -312,7 +312,7 @@
(description
"An HTTP client that relies on Curl + Async for the backend. Does not require\nconduit for SSL.")
(depends
ocurl
(ocurl (>= 0.9.2))
(http
(= :version))
stringext
Expand Down Expand Up @@ -379,7 +379,7 @@
(mdx :with-test)
logs
uri
(tls-eio (and :with-test (>= 0.17.2)))
(tls-eio (and :with-test (>= 1.0.0)))
(mirage-crypto-rng-eio (and :with-test (>= 0.11.2)))
fmt
ptime
Expand Down
14 changes: 7 additions & 7 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 940ec36

Please sign in to comment.