adapt to tls 1.0.0

This commit is contained in:
Hannes Mehnert 2024-08-27 19:10:33 +02:00
parent 8497990c8a
commit c7a3ec9374
2 changed files with 11 additions and 7 deletions

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
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))
let* authenticator =
match authenticator, user's_authenticator with
| 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