Open Thomas12 opened 8 years ago
Here are some rudimentary parts for SNI, I know it is very far from being a "patch" at all! The reason is that I don't see how to access the hostname from within ssl_do_handshake. For me, this is a "hack", it works for my case but this feature could be interesting for others, too and the details below might save you some time when implementing it the generic way:
in cdef.lua: Add: long SSL_ctrl(SSL s, int cmd, long larg, void *parg);
in ssl_create_client_context: Replace with: meth = sslv or lssl.TLSv1_2_client_method()
in ssl_do_handshake: Add: host="https://www.github.com/foo":match('^%w+://([^/]+)')..string.char(0) local c_str = ffi.new("char[?]", #host) ffi.copy(c_str, host) lssl.SSL_ctrl(ssl, 55, 0, c_str) --SSL_CTRL_SET_TLSEXT_HOSTNAME = 55
I think it is not that complicated, you have to run SSL_set_tlsext_host_name(.., ...).
Would help me a lot as newer ssl-servers often have many domains on the same ip and the async HTTP client exits with handshake error.
Thank you very much!
Thomas