add sni support (requires latest OpenSSL)

This commit is contained in:
nixo 2020-11-01 19:20:38 +01:00
parent e0c52b3c86
commit 7a2e06129d
1 changed files with 4 additions and 1 deletions

View File

@ -1,5 +1,6 @@
import Base.get
function get(request::Request; certs::Union{CAChain,Nothing} = nothing)
function get(request::Request; certs::Union{CAChain,Nothing} = nothing,
sni = true)
req = string(request)
let len = sizeof(req)
if len > 1024
@ -15,6 +16,8 @@ function get(request::Request; certs::Union{CAChain,Nothing} = nothing)
io = Sockets.connect(request.host, request.port)
client = SSLClient(ctx, io)
sni && @show OpenSSL.set_host_name(client, request.host)
OpenSSL.do_ssl_handshake(client)
while true