using certificates from buffers instead of files is only available in boost 1.54 and later

This commit is contained in:
Arvid Norberg 2014-05-12 04:30:19 +00:00
parent 2028a16d87
commit b16dc66df2
2 changed files with 8 additions and 1 deletions

View File

@ -767,7 +767,9 @@ namespace libtorrent
// certificate in the .torrent file to be valid. // certificate in the .torrent file to be valid.
// //
// The set_ssl_certificate_buffer() overload takes the actual certificate, // The set_ssl_certificate_buffer() overload takes the actual certificate,
// private key and DH params as strings, rather than paths to files. // private key and DH params as strings, rather than paths to files. This
// overload is only available when libtorrent is built against boost
// 1.54 or later.
// //
// ``cert`` is a path to the (signed) certificate in .pem format // ``cert`` is a path to the (signed) certificate in .pem format
// corresponding to this torrent. // corresponding to this torrent.

View File

@ -4401,6 +4401,10 @@ namespace libtorrent
{ {
if (!m_ssl_ctx) return; if (!m_ssl_ctx) return;
#if BOOST_VERSION < 105400
if (alerts().should_post<torrent_error_alert>())
alerts().post_alert(torrent_error_alert(get_handle(), boost::system::errc::not_supported));
#else
boost::asio::const_buffer certificate_buf(certificate.c_str(), certificate.size()); boost::asio::const_buffer certificate_buf(certificate.c_str(), certificate.size());
using boost::asio::ssl::context; using boost::asio::ssl::context;
@ -4427,6 +4431,7 @@ namespace libtorrent
if (alerts().should_post<torrent_error_alert>()) if (alerts().should_post<torrent_error_alert>())
alerts().post_alert(torrent_error_alert(get_handle(), ec)); alerts().post_alert(torrent_error_alert(get_handle(), ec));
} }
#endif // BOOST_VERSION
} }
#endif #endif