forked from premiere/premiere-libtorrent
prevent dependency on openssl from leaking outside of libtorrent (libssl and libcrypto should not be a usage requirement). This cleans up most tests to build without having to also link against openssl
This commit is contained in:
parent
75f6b95050
commit
830ef0bedd
2
Jamfile
2
Jamfile
|
@ -567,6 +567,7 @@ lib advapi32 : : <name>advapi32 ;
|
|||
lib user32 : : <name>user32 ;
|
||||
lib shell32 : : <name>shell32 ;
|
||||
lib gdi32 : : <name>gdi32 ;
|
||||
lib z : : <link>shared <name>z ;
|
||||
|
||||
lib crypto
|
||||
: # sources
|
||||
|
@ -616,7 +617,6 @@ lib libiconv : : <name>iconv <link>shared <search>/usr/local/lib ;
|
|||
|
||||
# openssl on linux/bsd etc.
|
||||
lib gcrypt : : <name>gcrypt <link>shared <search>/opt/local/lib ;
|
||||
lib z : : <link>shared <name>z ;
|
||||
lib dl : : <link>shared <name>dl ;
|
||||
|
||||
# time functions used on linux require librt
|
||||
|
|
|
@ -151,8 +151,9 @@ my-python-extension libtorrent
|
|||
<toolset>darwin:<cxxflags>-Wno-deprecated-declarations
|
||||
<toolset>darwin:<cxxflags>-Wno-unused-command-line-argument
|
||||
<conditional>@libtorrent_linking
|
||||
<crypto>openssl:<library>/torrent//ssl
|
||||
<crypto>openssl:<library>/torrent//crypto
|
||||
: # usage-requirements
|
||||
<conditional>@libtorrent_linking
|
||||
<suppress-import-lib>false
|
||||
;
|
||||
|
||||
|
|
|
@ -36,7 +36,10 @@ POSSIBILITY OF SUCH DAMAGE.
|
|||
#include <libtorrent/socks5_stream.hpp>
|
||||
#include <boost/asio/error.hpp>
|
||||
#if defined TORRENT_USE_OPENSSL
|
||||
#include <boost/asio/ssl/error.hpp>
|
||||
#include <boost/asio/ssl.hpp>
|
||||
#endif
|
||||
#if TORRENT_USE_I2P
|
||||
#include <libtorrent/i2p_stream.hpp>
|
||||
#endif
|
||||
#include "boost_python.hpp"
|
||||
|
||||
|
|
|
@ -55,7 +55,14 @@ POSSIBILITY OF SUCH DAMAGE.
|
|||
#endif
|
||||
|
||||
#ifdef TORRENT_USE_OPENSSL
|
||||
#include <boost/asio/ssl/context.hpp>
|
||||
// there is no forward declaration header for asio
|
||||
namespace boost {
|
||||
namespace asio {
|
||||
namespace ssl {
|
||||
struct context;
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
#include "libtorrent/aux_/disable_warnings_pop.hpp"
|
||||
|
|
|
@ -46,7 +46,14 @@ POSSIBILITY OF SUCH DAMAGE.
|
|||
#include <string>
|
||||
|
||||
#ifdef TORRENT_USE_OPENSSL
|
||||
#include <boost/asio/ssl/context.hpp>
|
||||
// there is no forward declaration header for asio
|
||||
namespace boost {
|
||||
namespace asio {
|
||||
namespace ssl {
|
||||
struct context;
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
#include "libtorrent/aux_/disable_warnings_pop.hpp"
|
||||
|
|
|
@ -76,6 +76,18 @@ POSSIBILITY OF SUCH DAMAGE.
|
|||
#include "libtorrent/debug.hpp"
|
||||
#include "libtorrent/aux_/file_progress.hpp"
|
||||
|
||||
#ifdef TORRENT_USE_OPENSSL
|
||||
// there is no forward declaration header for asio
|
||||
namespace boost {
|
||||
namespace asio {
|
||||
namespace ssl {
|
||||
struct context;
|
||||
class verify_context;
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
#if TORRENT_COMPLETE_TYPES_REQUIRED
|
||||
#include "libtorrent/peer_connection.hpp"
|
||||
#endif
|
||||
|
|
|
@ -51,7 +51,14 @@ POSSIBILITY OF SUCH DAMAGE.
|
|||
#include <boost/unordered_map.hpp>
|
||||
|
||||
#ifdef TORRENT_USE_OPENSSL
|
||||
#include <boost/asio/ssl/context.hpp>
|
||||
// there is no forward declaration header for asio
|
||||
namespace boost {
|
||||
namespace asio {
|
||||
namespace ssl {
|
||||
struct context;
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
#include "libtorrent/aux_/disable_warnings_pop.hpp"
|
||||
|
|
|
@ -36,7 +36,6 @@ POSSIBILITY OF SUCH DAMAGE.
|
|||
#include "libtorrent/socket.hpp"
|
||||
#include "libtorrent/error_code.hpp"
|
||||
#include "libtorrent/broadcast_socket.hpp"
|
||||
#include "libtorrent/http_connection.hpp"
|
||||
#include "libtorrent/thread.hpp"
|
||||
#include "libtorrent/deadline_timer.hpp"
|
||||
#include "libtorrent/enum_net.hpp"
|
||||
|
@ -51,6 +50,8 @@ POSSIBILITY OF SUCH DAMAGE.
|
|||
|
||||
namespace libtorrent
|
||||
{
|
||||
struct http_connection;
|
||||
class http_parser;
|
||||
|
||||
namespace upnp_errors
|
||||
{
|
||||
|
@ -300,26 +301,13 @@ private:
|
|||
|
||||
struct rootdevice
|
||||
{
|
||||
rootdevice(): port(0)
|
||||
, lease_duration(default_lease_time)
|
||||
, supports_specific_external(true)
|
||||
, disabled(false)
|
||||
, non_router(false)
|
||||
{
|
||||
#if TORRENT_USE_ASSERTS
|
||||
magic = 1337;
|
||||
#endif
|
||||
}
|
||||
rootdevice();
|
||||
|
||||
#if TORRENT_USE_ASSERTS
|
||||
~rootdevice()
|
||||
{
|
||||
TORRENT_ASSERT(magic == 1337);
|
||||
magic = 0;
|
||||
}
|
||||
~rootdevice();
|
||||
#if __cplusplus >= 201103L
|
||||
rootdevice(rootdevice const&) = default;
|
||||
rootdevice& operator=(rootdevice const&) = default;
|
||||
rootdevice(rootdevice const&);
|
||||
rootdevice& operator=(rootdevice const&);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
@ -361,13 +349,7 @@ private:
|
|||
#if TORRENT_USE_ASSERTS
|
||||
int magic;
|
||||
#endif
|
||||
void close() const
|
||||
{
|
||||
TORRENT_ASSERT(magic == 1337);
|
||||
if (!upnp_connection) return;
|
||||
upnp_connection->close();
|
||||
upnp_connection.reset();
|
||||
}
|
||||
void close() const;
|
||||
|
||||
bool operator<(rootdevice const& rhs) const
|
||||
{ return url < rhs.url; }
|
||||
|
|
|
@ -53,6 +53,10 @@ POSSIBILITY OF SUCH DAMAGE.
|
|||
#include <algorithm>
|
||||
#include <sstream>
|
||||
|
||||
#ifdef TORRENT_USE_OPENSSL
|
||||
#include <boost/asio/ssl/context.hpp>
|
||||
#endif
|
||||
|
||||
#include "libtorrent/aux_/disable_warnings_pop.hpp"
|
||||
|
||||
namespace libtorrent {
|
||||
|
|
|
@ -45,6 +45,10 @@ POSSIBILITY OF SUCH DAMAGE.
|
|||
#include "libtorrent/udp_tracker_connection.hpp"
|
||||
#include "libtorrent/aux_/session_impl.hpp"
|
||||
|
||||
#ifdef TORRENT_USE_OPENSSL
|
||||
#include <boost/asio/ssl/context.hpp>
|
||||
#endif
|
||||
|
||||
using boost::tuples::make_tuple;
|
||||
using boost::tuples::tuple;
|
||||
|
||||
|
@ -55,7 +59,6 @@ namespace
|
|||
minimum_tracker_response_length = 3,
|
||||
http_buffer_size = 2048
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
namespace libtorrent
|
||||
|
|
33
src/upnp.cpp
33
src/upnp.cpp
|
@ -40,6 +40,7 @@ POSSIBILITY OF SUCH DAMAGE.
|
|||
#include "libtorrent/random.hpp"
|
||||
#include "libtorrent/aux_/time.hpp" // for aux::time_now()
|
||||
#include "libtorrent/aux_/escape_string.hpp" // for convert_from_native
|
||||
#include "libtorrent/http_connection.hpp"
|
||||
|
||||
#if defined TORRENT_ASIO_DEBUGGING
|
||||
#include "libtorrent/debug.hpp"
|
||||
|
@ -69,6 +70,38 @@ namespace upnp_errors
|
|||
|
||||
static error_code ignore_error;
|
||||
|
||||
upnp::rootdevice::rootdevice()
|
||||
: port(0)
|
||||
, lease_duration(default_lease_time)
|
||||
, supports_specific_external(true)
|
||||
, disabled(false)
|
||||
, non_router(false)
|
||||
{
|
||||
#if TORRENT_USE_ASSERTS
|
||||
magic = 1337;
|
||||
#endif
|
||||
}
|
||||
|
||||
void upnp::rootdevice::close() const
|
||||
{
|
||||
TORRENT_ASSERT(magic == 1337);
|
||||
if (!upnp_connection) return;
|
||||
upnp_connection->close();
|
||||
upnp_connection.reset();
|
||||
}
|
||||
|
||||
#if TORRENT_USE_ASSERTS
|
||||
upnp::rootdevice::~rootdevice()
|
||||
{
|
||||
TORRENT_ASSERT(magic == 1337);
|
||||
magic = 0;
|
||||
}
|
||||
#if __cplusplus >= 201103L
|
||||
upnp::rootdevice::rootdevice(rootdevice const&) = default;
|
||||
upnp::rootdevice& upnp::rootdevice::operator=(rootdevice const&) = default;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
upnp::upnp(io_service& ios
|
||||
, address const& listen_interface, std::string const& user_agent
|
||||
, portmap_callback_t const& cb, log_callback_t const& lcb
|
||||
|
|
10
test/Jamfile
10
test/Jamfile
|
@ -138,7 +138,10 @@ test-suite libtorrent :
|
|||
[ run test_privacy.cpp ]
|
||||
[ run test_recheck.cpp ]
|
||||
[ run test_resume.cpp ]
|
||||
[ run test_ssl.cpp ]
|
||||
[ run test_ssl.cpp : :
|
||||
: <crypto>openssl:<library>/torrent//ssl
|
||||
<crypto>openssl:<library>/torrent//crypto
|
||||
]
|
||||
[ run test_tracker.cpp ]
|
||||
[ run test_checking.cpp ]
|
||||
[ run test_url_seed.cpp ]
|
||||
|
@ -158,7 +161,10 @@ test-suite libtorrent :
|
|||
[ run test_remap_files.cpp ]
|
||||
[ run test_utp.cpp ]
|
||||
[ run test_auto_unchoke.cpp ]
|
||||
[ run test_http_connection.cpp ]
|
||||
[ run test_http_connection.cpp : :
|
||||
: <crypto>openssl:<library>/torrent//ssl
|
||||
<crypto>openssl:<library>/torrent//crypto
|
||||
]
|
||||
[ run test_torrent.cpp ]
|
||||
[ run test_transfer.cpp ]
|
||||
[ run test_time_critical.cpp ]
|
||||
|
|
|
@ -42,8 +42,6 @@ POSSIBILITY OF SUCH DAMAGE.
|
|||
#include "libtorrent/alert_types.hpp"
|
||||
#include "libtorrent/create_torrent.hpp"
|
||||
#include "libtorrent/socket_io.hpp" // print_endpoint
|
||||
#include "libtorrent/socket_type.hpp"
|
||||
#include "libtorrent/instantiate_connection.hpp"
|
||||
#include "libtorrent/ip_filter.hpp"
|
||||
#include "libtorrent/session_stats.hpp"
|
||||
#include "libtorrent/thread.hpp"
|
||||
|
@ -59,11 +57,6 @@ POSSIBILITY OF SUCH DAMAGE.
|
|||
#include "test_utils.hpp"
|
||||
#include "setup_transfer.hpp"
|
||||
|
||||
#ifdef TORRENT_USE_OPENSSL
|
||||
#include <boost/asio/ssl/stream.hpp>
|
||||
#include <boost/asio/ssl/context.hpp>
|
||||
#endif
|
||||
|
||||
#ifndef _WIN32
|
||||
#include <spawn.h>
|
||||
#include <signal.h>
|
||||
|
|
|
@ -36,7 +36,7 @@ POSSIBILITY OF SUCH DAMAGE.
|
|||
#include "libtorrent/socket.hpp"
|
||||
#include "libtorrent/random.hpp"
|
||||
#include "libtorrent/socket_io.hpp"
|
||||
#include "libtorrent/aux_/session_impl.hpp"
|
||||
#include "libtorrent/aux_/session_interface.hpp"
|
||||
#include "libtorrent/broadcast_socket.hpp" // for supports_ipv6()
|
||||
#include "setup_transfer.hpp" // for rand_v4
|
||||
|
||||
|
@ -165,8 +165,8 @@ TORRENT_TEST(externa_ip_1)
|
|||
TEST_CHECK(!ec);
|
||||
for (int i = 0; i < 50; ++i)
|
||||
{
|
||||
ipv1.cast_vote(real_external, aux::session_impl::source_dht, rand_v4());
|
||||
ipv1.cast_vote(rand_v4(), aux::session_impl::source_dht, malicious);
|
||||
ipv1.cast_vote(real_external, aux::session_interface::source_dht, rand_v4());
|
||||
ipv1.cast_vote(rand_v4(), aux::session_interface::source_dht, malicious);
|
||||
}
|
||||
TEST_CHECK(ipv1.external_address(rand_v4()) == real_external);
|
||||
}
|
||||
|
@ -199,12 +199,12 @@ TORRENT_TEST(externa_ip_2)
|
|||
TEST_CHECK(!ec);
|
||||
for (int i = 0; i < 50; ++i)
|
||||
{
|
||||
ipv2.cast_vote(real_external1, aux::session_impl::source_dht, rand_v4());
|
||||
ipv2.cast_vote(real_external1, aux::session_interface::source_dht, rand_v4());
|
||||
#if TORRENT_USE_IPV6
|
||||
if (supports_ipv6())
|
||||
ipv2.cast_vote(real_external2, aux::session_impl::source_dht, rand_v6());
|
||||
ipv2.cast_vote(real_external2, aux::session_interface::source_dht, rand_v6());
|
||||
#endif
|
||||
ipv2.cast_vote(malicious_external, aux::session_impl::source_dht, malicious);
|
||||
ipv2.cast_vote(malicious_external, aux::session_interface::source_dht, malicious);
|
||||
}
|
||||
TEST_CHECK(ipv2.external_address(rand_v4()) == real_external1);
|
||||
#if TORRENT_USE_IPV6
|
||||
|
|
|
@ -40,13 +40,13 @@ POSSIBILITY OF SUCH DAMAGE.
|
|||
#include "libtorrent/hasher.hpp"
|
||||
#include "libtorrent/session.hpp"
|
||||
#include "libtorrent/alert_types.hpp"
|
||||
#include "libtorrent/aux_/session_impl.hpp"
|
||||
#include "libtorrent/create_torrent.hpp"
|
||||
#include "libtorrent/thread.hpp"
|
||||
#include "libtorrent/torrent_info.hpp"
|
||||
|
||||
#include <boost/make_shared.hpp>
|
||||
#include <boost/utility.hpp>
|
||||
#include <boost/bind.hpp>
|
||||
|
||||
#include <iostream>
|
||||
#include <fstream>
|
||||
|
|
|
@ -33,6 +33,7 @@ POSSIBILITY OF SUCH DAMAGE.
|
|||
#include "libtorrent/upnp.hpp"
|
||||
#include "libtorrent/socket.hpp"
|
||||
#include "libtorrent/socket_io.hpp" // print_endpoint
|
||||
#include "libtorrent/http_parser.hpp"
|
||||
#include "test.hpp"
|
||||
#include "setup_transfer.hpp"
|
||||
#include <fstream>
|
||||
|
|
|
@ -34,6 +34,7 @@ POSSIBILITY OF SUCH DAMAGE.
|
|||
#include "libtorrent/upnp.hpp"
|
||||
#include "test.hpp"
|
||||
#include <iostream>
|
||||
#include <boost/bind.hpp>
|
||||
|
||||
char upnp_xml[] =
|
||||
"<root>"
|
||||
|
|
Loading…
Reference in New Issue