adapt to tls 1.0.0 #1

Merged
hannes merged 4 commits from tls-1 into main 2024-08-29 10:42:24 +00:00
2 changed files with 11 additions and 7 deletions
Showing only changes of commit c7a3ec9374 - Show all commits

View file

@ -22,6 +22,7 @@ depends: [
"mirage-crypto-rng" {with-test}
"mirage-time-unix" {with-test & >= "3.0.0"}
"h2" {>= "0.10.0"}
"tls" {>= "1.0.0"}
]
build: [
["dune" "subst"] {dev}

View file

@ -383,7 +383,8 @@ let single_request
let tls_config ?tls_config ?config authenticator user's_authenticator =
lazy
(match tls_config with
(let ( let* ) = Result.bind in
match tls_config with
| Some cfg -> Ok (`Custom cfg)
| None -> (
let alpn_protocols =
@ -391,12 +392,14 @@ let tls_config ?tls_config ?config authenticator user's_authenticator =
| None -> ["h2"; "http/1.1"]
| Some (`H2 _) -> ["h2"]
| Some (`HTTP_1_1 _) -> ["http/1.1"] in
let* authenticator =
match authenticator, user's_authenticator with
| Ok authenticator, None ->
Ok (`Default (Tls.Config.client ~alpn_protocols ~authenticator ()))
| _, Some authenticator ->
Ok (`Default (Tls.Config.client ~alpn_protocols ~authenticator ()))
| (Error _ as err), None -> err))
| Ok authenticator, None -> Ok authenticator
| _, Some authenticator -> Ok authenticator
| (Error _ as err), None -> err
in
let* cfg = Tls.Config.client ~alpn_protocols ~authenticator () in
Ok (`Default cfg)))
let resolve_location ~uri ~location =
match String.split_on_char '/' location with