Skip to content

Instantly share code, notes, and snippets.

@kkazuo
Created March 15, 2017 15:25
Show Gist options
  • Save kkazuo/e809bd63c887052550c1dc7fd7794d28 to your computer and use it in GitHub Desktop.
Save kkazuo/e809bd63c887052550c1dc7fd7794d28 to your computer and use it in GitHub Desktop.
cohttp with async_ssl : If you get SSL handshake error, specify version of ssl_config
open Core.Std
open Async.Std
module Http = Cohttp_async
let ssl_config =
Conduit_async.Ssl.configure ~version:Tlsv1_2 ()
let main key () =
Http.Client.get Uri.(of_string key) ~ssl_config >>= fun (res, body) ->
Http.Body.drain body >>= fun () ->
print_endline "ok!";
return ()
let () =
Command.async
~summary:"https clint test"
Command.Spec.(
empty
+> anon ("host" %: string)
)
main
|> Command.run
(executables
((names (cohttp_ssl_version))
(libraries (async_ssl cohttp.async))))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment