merged fix from RC_0_16 to support older openssl

This commit is contained in:
Arvid Norberg 2012-04-06 04:11:04 +00:00
parent 9024209d51
commit f714732eee
3 changed files with 11 additions and 2 deletions

View File

@ -63,7 +63,11 @@ public:
typedef typename Stream::protocol_type protocol_type;
void set_host_name(std::string name)
{ SSL_set_tlsext_host_name(m_sock.native_handle(), name.c_str()); }
{
#if OPENSSL_VERSION_NUMBER >= 0x90812f
SSL_set_tlsext_host_name(m_sock.native_handle(), name.c_str());
#endif
}
template <class T>
void set_verify_callback(T const& fun, error_code& ec)

View File

@ -541,7 +541,7 @@ namespace aux {
int session_impl::logging_allocator::allocated_bytes = 0;
#endif
#if defined TORRENT_USE_OPENSSL && BOOST_VERSION >= 104700
#if defined TORRENT_USE_OPENSSL && BOOST_VERSION >= 104700 && OPENSSL_VERSION_NUMBER >= 0x90812f
// when running bittorrent over SSL, the SNI (server name indication)
// extension is used to know which torrent the incoming connection is
// trying to connect to. The 40 first bytes in the name is expected to
@ -689,8 +689,10 @@ namespace aux {
#ifdef TORRENT_USE_OPENSSL
m_ssl_ctx.set_verify_mode(asio::ssl::context::verify_none, ec);
#if BOOST_VERSION >= 104700
#if OPENSSL_VERSION_NUMBER >= 0x90812f
SSL_CTX_set_tlsext_servername_callback(m_ssl_ctx.native_handle(), servername_callback);
SSL_CTX_set_tlsext_servername_arg(m_ssl_ctx.native_handle(), this);
#endif // OPENSSL_VERSION_NUMBER
#endif // BOOST_VERSION
#endif

View File

@ -84,11 +84,14 @@ namespace libtorrent
}
#undef CASE
#if OPENSSL_VERSION_NUMBER >= 0x90812f
if (ctx)
{
SSL_CTX_set_tlsext_servername_callback(ctx, 0);
SSL_CTX_set_tlsext_servername_arg(ctx, 0);
}
#endif // OPENSSL_VERSION_NUMBER
#endif
}