adapt to tls 1.0.0
This commit is contained in:
parent
8497990c8a
commit
c7a3ec9374
2 changed files with 11 additions and 7 deletions
|
@ -22,6 +22,7 @@ depends: [
|
||||||
"mirage-crypto-rng" {with-test}
|
"mirage-crypto-rng" {with-test}
|
||||||
"mirage-time-unix" {with-test & >= "3.0.0"}
|
"mirage-time-unix" {with-test & >= "3.0.0"}
|
||||||
"h2" {>= "0.10.0"}
|
"h2" {>= "0.10.0"}
|
||||||
|
"tls" {>= "1.0.0"}
|
||||||
]
|
]
|
||||||
build: [
|
build: [
|
||||||
["dune" "subst"] {dev}
|
["dune" "subst"] {dev}
|
||||||
|
|
|
@ -383,7 +383,8 @@ let single_request
|
||||||
|
|
||||||
let tls_config ?tls_config ?config authenticator user's_authenticator =
|
let tls_config ?tls_config ?config authenticator user's_authenticator =
|
||||||
lazy
|
lazy
|
||||||
(match tls_config with
|
(let ( let* ) = Result.bind in
|
||||||
|
match tls_config with
|
||||||
| Some cfg -> Ok (`Custom cfg)
|
| Some cfg -> Ok (`Custom cfg)
|
||||||
| None -> (
|
| None -> (
|
||||||
let alpn_protocols =
|
let alpn_protocols =
|
||||||
|
@ -391,12 +392,14 @@ let tls_config ?tls_config ?config authenticator user's_authenticator =
|
||||||
| None -> ["h2"; "http/1.1"]
|
| None -> ["h2"; "http/1.1"]
|
||||||
| Some (`H2 _) -> ["h2"]
|
| Some (`H2 _) -> ["h2"]
|
||||||
| Some (`HTTP_1_1 _) -> ["http/1.1"] in
|
| Some (`HTTP_1_1 _) -> ["http/1.1"] in
|
||||||
|
let* authenticator =
|
||||||
match authenticator, user's_authenticator with
|
match authenticator, user's_authenticator with
|
||||||
| Ok authenticator, None ->
|
| Ok authenticator, None -> Ok authenticator
|
||||||
Ok (`Default (Tls.Config.client ~alpn_protocols ~authenticator ()))
|
| _, Some authenticator -> Ok authenticator
|
||||||
| _, Some authenticator ->
|
| (Error _ as err), None -> err
|
||||||
Ok (`Default (Tls.Config.client ~alpn_protocols ~authenticator ()))
|
in
|
||||||
| (Error _ as err), None -> err))
|
let* cfg = Tls.Config.client ~alpn_protocols ~authenticator () in
|
||||||
|
Ok (`Default cfg)))
|
||||||
|
|
||||||
let resolve_location ~uri ~location =
|
let resolve_location ~uri ~location =
|
||||||
match String.split_on_char '/' location with
|
match String.split_on_char '/' location with
|
||||||
|
|
Loading…
Reference in a new issue