initial support for disabling proxy for tracker connections
This commit is contained in:
parent
d5f9f613ef
commit
0d9d632465
|
@ -69,10 +69,11 @@ set(sources
|
||||||
session_handle
|
session_handle
|
||||||
session_impl
|
session_impl
|
||||||
session_settings
|
session_settings
|
||||||
|
proxy_settings
|
||||||
session_stats
|
session_stats
|
||||||
settings_pack
|
settings_pack
|
||||||
socket_io
|
socket_io
|
||||||
socket_type
|
socket_type
|
||||||
socks5_stream
|
socks5_stream
|
||||||
stat
|
stat
|
||||||
stat_cache
|
stat_cache
|
||||||
|
|
1
Jamfile
1
Jamfile
|
@ -694,6 +694,7 @@ SOURCES =
|
||||||
performance_counters
|
performance_counters
|
||||||
resolver
|
resolver
|
||||||
session_settings
|
session_settings
|
||||||
|
proxy_settings
|
||||||
file_progress
|
file_progress
|
||||||
|
|
||||||
# -- extensions --
|
# -- extensions --
|
||||||
|
|
|
@ -166,6 +166,7 @@ nobase_include_HEADERS = \
|
||||||
aux_/session_call.hpp \
|
aux_/session_call.hpp \
|
||||||
aux_/session_impl.hpp \
|
aux_/session_impl.hpp \
|
||||||
aux_/session_settings.hpp \
|
aux_/session_settings.hpp \
|
||||||
|
aux_/proxy_settings.hpp \
|
||||||
aux_/session_interface.hpp \
|
aux_/session_interface.hpp \
|
||||||
aux_/time.hpp \
|
aux_/time.hpp \
|
||||||
aux_/file_progress.hpp \
|
aux_/file_progress.hpp \
|
||||||
|
|
|
@ -0,0 +1,145 @@
|
||||||
|
/*
|
||||||
|
|
||||||
|
Copyright (c) 2003-2015, Arvid Norberg
|
||||||
|
All rights reserved.
|
||||||
|
|
||||||
|
Redistribution and use in source and binary forms, with or without
|
||||||
|
modification, are permitted provided that the following conditions
|
||||||
|
are met:
|
||||||
|
|
||||||
|
* Redistributions of source code must retain the above copyright
|
||||||
|
notice, this list of conditions and the following disclaimer.
|
||||||
|
* Redistributions in binary form must reproduce the above copyright
|
||||||
|
notice, this list of conditions and the following disclaimer in
|
||||||
|
the documentation and/or other materials provided with the distribution.
|
||||||
|
* Neither the name of the author nor the names of its
|
||||||
|
contributors may be used to endorse or promote products derived
|
||||||
|
from this software without specific prior written permission.
|
||||||
|
|
||||||
|
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||||
|
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||||
|
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||||
|
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||||
|
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||||
|
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||||
|
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||||
|
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||||
|
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||||
|
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||||
|
POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef TORRENT_PROXY_SETTINGS_HPP_INCLUDED
|
||||||
|
#define TORRENT_PROXY_SETTINGS_HPP_INCLUDED
|
||||||
|
|
||||||
|
#include "libtorrent/version.hpp"
|
||||||
|
#include "libtorrent/config.hpp"
|
||||||
|
|
||||||
|
#include <string>
|
||||||
|
#include <boost/cstdint.hpp>
|
||||||
|
|
||||||
|
namespace libtorrent {
|
||||||
|
struct settings_pack;
|
||||||
|
namespace aux {
|
||||||
|
|
||||||
|
struct session_settings;
|
||||||
|
|
||||||
|
// The ``proxy_settings`` structs contains the information needed to
|
||||||
|
// direct certain traffic to a proxy.
|
||||||
|
struct TORRENT_DEPRECATED_EXPORT proxy_settings
|
||||||
|
{
|
||||||
|
// defaults constructs proxy settings, initializing it to the default
|
||||||
|
// settings.
|
||||||
|
proxy_settings();
|
||||||
|
|
||||||
|
// construct the proxy_settings object from the settings
|
||||||
|
// this constructor is implemented in session_impl.cpp
|
||||||
|
proxy_settings(settings_pack const& sett);
|
||||||
|
proxy_settings(aux::session_settings const& sett);
|
||||||
|
|
||||||
|
// the name or IP of the proxy server. ``port`` is the port number the
|
||||||
|
// proxy listens to. If required, ``username`` and ``password`` can be
|
||||||
|
// set to authenticate with the proxy.
|
||||||
|
std::string hostname;
|
||||||
|
|
||||||
|
// when using a proy type that requires authentication, the username
|
||||||
|
// and password fields must be set to the credentials for the proxy.
|
||||||
|
std::string username;
|
||||||
|
std::string password;
|
||||||
|
|
||||||
|
#ifndef TORRENT_NO_DEPRECATE
|
||||||
|
// the type of proxy to use. Assign one of these to the
|
||||||
|
// proxy_settings::type field.
|
||||||
|
enum proxy_type
|
||||||
|
{
|
||||||
|
// This is the default, no proxy server is used, all other fields are
|
||||||
|
// ignored.
|
||||||
|
none,
|
||||||
|
|
||||||
|
// The server is assumed to be a `SOCKS4 server`_ that requires a
|
||||||
|
// username.
|
||||||
|
//
|
||||||
|
// .. _`SOCKS4 server`: http://www.ufasoft.com/doc/socks4_protocol.htm
|
||||||
|
socks4,
|
||||||
|
|
||||||
|
// The server is assumed to be a SOCKS5 server (`RFC 1928`_) that does
|
||||||
|
// not require any authentication. The username and password are
|
||||||
|
// ignored.
|
||||||
|
//
|
||||||
|
// .. _`RFC 1928`: http://www.faqs.org/rfcs/rfc1928.html
|
||||||
|
socks5,
|
||||||
|
|
||||||
|
// The server is assumed to be a SOCKS5 server that supports plain
|
||||||
|
// text username and password authentication (`RFC 1929`_). The
|
||||||
|
// username and password specified may be sent to the proxy if it
|
||||||
|
// requires.
|
||||||
|
//
|
||||||
|
// .. _`RFC 1929`: http://www.faqs.org/rfcs/rfc1929.html
|
||||||
|
socks5_pw,
|
||||||
|
|
||||||
|
// The server is assumed to be an HTTP proxy. If the transport used
|
||||||
|
// for the connection is non-HTTP, the server is assumed to support
|
||||||
|
// the CONNECT_ method. i.e. for web seeds and HTTP trackers, a plain
|
||||||
|
// proxy will suffice. The proxy is assumed to not require
|
||||||
|
// authorization. The username and password will not be used.
|
||||||
|
//
|
||||||
|
// .. _CONNECT: http://tools.ietf.org/html/draft-luotonen-web-proxy-tunneling-01
|
||||||
|
http,
|
||||||
|
|
||||||
|
// The server is assumed to be an HTTP proxy that requires user
|
||||||
|
// authorization. The username and password will be sent to the proxy.
|
||||||
|
http_pw,
|
||||||
|
|
||||||
|
// route through an i2p SAM proxy
|
||||||
|
i2p_proxy
|
||||||
|
};
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// tells libtorrent what kind of proxy server it is. See proxy_type
|
||||||
|
// enum for options
|
||||||
|
boost::uint8_t type;
|
||||||
|
|
||||||
|
// the port the proxy server is running on
|
||||||
|
boost::uint16_t port;
|
||||||
|
|
||||||
|
// defaults to true. It means that hostnames should be attempted to be
|
||||||
|
// resolved through the proxy instead of using the local DNS service.
|
||||||
|
// This is only supported by SOCKS5 and HTTP.
|
||||||
|
bool proxy_hostnames;
|
||||||
|
|
||||||
|
// determines whether or not to excempt peer and web seed connections
|
||||||
|
// from using the proxy. This defaults to true, i.e. peer connections are
|
||||||
|
// proxied by default.
|
||||||
|
bool proxy_peer_connections;
|
||||||
|
|
||||||
|
// if true, tracker connections are subject to the proxy settings
|
||||||
|
bool proxy_tracker_connections;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
|
@ -64,7 +64,6 @@ namespace libtorrent
|
||||||
{
|
{
|
||||||
class peer_connection;
|
class peer_connection;
|
||||||
class torrent;
|
class torrent;
|
||||||
struct proxy_settings;
|
|
||||||
struct socket_job;
|
struct socket_job;
|
||||||
#ifndef TORRENT_NO_DEPRECATE
|
#ifndef TORRENT_NO_DEPRECATE
|
||||||
struct pe_settings;
|
struct pe_settings;
|
||||||
|
@ -101,6 +100,7 @@ namespace libtorrent
|
||||||
|
|
||||||
namespace libtorrent { namespace aux
|
namespace libtorrent { namespace aux
|
||||||
{
|
{
|
||||||
|
struct proxy_settings;
|
||||||
struct session_settings;
|
struct session_settings;
|
||||||
|
|
||||||
#if !defined TORRENT_DISABLE_LOGGING || TORRENT_USE_ASSERTS
|
#if !defined TORRENT_DISABLE_LOGGING || TORRENT_USE_ASSERTS
|
||||||
|
|
|
@ -87,7 +87,7 @@ POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
|
||||||
// only export this type if deprecated functions are enabled
|
// only export this type if deprecated functions are enabled
|
||||||
#ifdef TORRENT_NO_DEPRECATE
|
#ifdef TORRENT_NO_DEPRECATE
|
||||||
#define TORRENT_DEPRECATED_EXPORT
|
#define TORRENT_DEPRECATED_EXPORT TORRENT_EXTRA_EXPORT
|
||||||
#else
|
#else
|
||||||
#define TORRENT_DEPRECATED_EXPORT TORRENT_EXPORT
|
#define TORRENT_DEPRECATED_EXPORT TORRENT_EXPORT
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -104,7 +104,7 @@ struct TORRENT_EXTRA_EXPORT http_connection
|
||||||
std::string m_sendbuffer;
|
std::string m_sendbuffer;
|
||||||
|
|
||||||
void get(std::string const& url, time_duration timeout = seconds(30)
|
void get(std::string const& url, time_duration timeout = seconds(30)
|
||||||
, int prio = 0, proxy_settings const* ps = 0, int handle_redirects = 5
|
, int prio = 0, aux::proxy_settings const* ps = 0, int handle_redirects = 5
|
||||||
, std::string const& user_agent = std::string()
|
, std::string const& user_agent = std::string()
|
||||||
, address const& bind_addr = address_v4::any()
|
, address const& bind_addr = address_v4::any()
|
||||||
, int resolve_flags = 0, std::string const& auth_ = std::string()
|
, int resolve_flags = 0, std::string const& auth_ = std::string()
|
||||||
|
@ -114,7 +114,7 @@ struct TORRENT_EXTRA_EXPORT http_connection
|
||||||
);
|
);
|
||||||
|
|
||||||
void start(std::string const& hostname, int port
|
void start(std::string const& hostname, int port
|
||||||
, time_duration timeout, int prio = 0, proxy_settings const* ps = 0
|
, time_duration timeout, int prio = 0, aux::proxy_settings const* ps = 0
|
||||||
, bool ssl = false, int handle_redirect = 5
|
, bool ssl = false, int handle_redirect = 5
|
||||||
, address const& bind_addr = address_v4::any()
|
, address const& bind_addr = address_v4::any()
|
||||||
, int resolve_flags = 0
|
, int resolve_flags = 0
|
||||||
|
@ -186,7 +186,7 @@ private:
|
||||||
|
|
||||||
// specifies whether or not the connection is
|
// specifies whether or not the connection is
|
||||||
// configured to use a proxy
|
// configured to use a proxy
|
||||||
proxy_settings m_proxy;
|
aux::proxy_settings m_proxy;
|
||||||
|
|
||||||
// the address to bind to. address_v4::any()
|
// the address to bind to. address_v4::any()
|
||||||
// means do not bind
|
// means do not bind
|
||||||
|
|
|
@ -169,7 +169,7 @@ public:
|
||||||
i2p_connection(io_service& ios);
|
i2p_connection(io_service& ios);
|
||||||
~i2p_connection();
|
~i2p_connection();
|
||||||
|
|
||||||
proxy_settings proxy() const;
|
aux::proxy_settings proxy() const;
|
||||||
|
|
||||||
bool is_open() const
|
bool is_open() const
|
||||||
{
|
{
|
||||||
|
|
|
@ -34,20 +34,23 @@ POSSIBILITY OF SUCH DAMAGE.
|
||||||
#define TORRENT_INSTANTIATE_CONNECTION
|
#define TORRENT_INSTANTIATE_CONNECTION
|
||||||
|
|
||||||
#include "libtorrent/socket_type.hpp"
|
#include "libtorrent/socket_type.hpp"
|
||||||
#include <boost/shared_ptr.hpp>
|
|
||||||
|
|
||||||
namespace libtorrent
|
namespace libtorrent
|
||||||
{
|
{
|
||||||
struct proxy_settings;
|
namespace aux {
|
||||||
|
struct proxy_settings;
|
||||||
|
}
|
||||||
|
|
||||||
struct utp_socket_manager;
|
struct utp_socket_manager;
|
||||||
struct socket_type;
|
struct socket_type;
|
||||||
|
|
||||||
// instantiate a socket_type (s) according to the specified criteria
|
// instantiate a socket_type (s) according to the specified criteria
|
||||||
TORRENT_EXTRA_EXPORT bool instantiate_connection(io_service& ios
|
TORRENT_EXTRA_EXPORT bool instantiate_connection(io_service& ios
|
||||||
, proxy_settings const& ps, socket_type& s
|
, aux::proxy_settings const& ps, socket_type& s
|
||||||
, void* ssl_context = 0
|
, void* ssl_context
|
||||||
, utp_socket_manager* sm = 0
|
, utp_socket_manager* sm
|
||||||
, bool peer_connection = false);
|
, bool peer_connection
|
||||||
|
, bool tracker_connection);
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -36,6 +36,7 @@ POSSIBILITY OF SUCH DAMAGE.
|
||||||
#include "libtorrent/version.hpp"
|
#include "libtorrent/version.hpp"
|
||||||
#include "libtorrent/config.hpp"
|
#include "libtorrent/config.hpp"
|
||||||
#include "libtorrent/settings_pack.hpp"
|
#include "libtorrent/settings_pack.hpp"
|
||||||
|
#include "libtorrent/aux_/proxy_settings.hpp"
|
||||||
|
|
||||||
#include <boost/cstdint.hpp>
|
#include <boost/cstdint.hpp>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
@ -46,109 +47,8 @@ namespace libtorrent
|
||||||
{
|
{
|
||||||
|
|
||||||
#ifndef TORRENT_NO_DEPRECATE
|
#ifndef TORRENT_NO_DEPRECATE
|
||||||
#define TORRENT_EXPORT_DEPRECATED TORRENT_EXPORT
|
|
||||||
#else
|
|
||||||
#define TORRENT_EXPORT_DEPRECATED
|
|
||||||
#endif
|
|
||||||
|
|
||||||
namespace aux { struct session_settings; }
|
typedef aux::proxy_settings proxy_settings;
|
||||||
|
|
||||||
// TODO: 2 this type is only used internally now. move it to an internal
|
|
||||||
// header and make this type properly deprecated.
|
|
||||||
|
|
||||||
// The ``proxy_settings`` structs contains the information needed to
|
|
||||||
// direct certain traffic to a proxy.
|
|
||||||
struct TORRENT_EXPORT_DEPRECATED proxy_settings
|
|
||||||
{
|
|
||||||
// defaults constructs proxy settings, initializing it to the default
|
|
||||||
// settings.
|
|
||||||
proxy_settings() : type(0)
|
|
||||||
, port(0), proxy_hostnames(true)
|
|
||||||
, proxy_peer_connections(true)
|
|
||||||
{}
|
|
||||||
|
|
||||||
// construct the proxy_settings object from the settings
|
|
||||||
// this constructor is implemented in session_impl.cpp
|
|
||||||
proxy_settings(settings_pack const& sett);
|
|
||||||
proxy_settings(aux::session_settings const& sett);
|
|
||||||
|
|
||||||
// the name or IP of the proxy server. ``port`` is the port number the
|
|
||||||
// proxy listens to. If required, ``username`` and ``password`` can be
|
|
||||||
// set to authenticate with the proxy.
|
|
||||||
std::string hostname;
|
|
||||||
|
|
||||||
// when using a proy type that requires authentication, the username
|
|
||||||
// and password fields must be set to the credentials for the proxy.
|
|
||||||
std::string username;
|
|
||||||
std::string password;
|
|
||||||
|
|
||||||
#ifndef TORRENT_NO_DEPRECATE
|
|
||||||
// the type of proxy to use. Assign one of these to the
|
|
||||||
// proxy_settings::type field.
|
|
||||||
enum proxy_type
|
|
||||||
{
|
|
||||||
// This is the default, no proxy server is used, all other fields are
|
|
||||||
// ignored.
|
|
||||||
none,
|
|
||||||
|
|
||||||
// The server is assumed to be a `SOCKS4 server`_ that requires a
|
|
||||||
// username.
|
|
||||||
//
|
|
||||||
// .. _`SOCKS4 server`: http://www.ufasoft.com/doc/socks4_protocol.htm
|
|
||||||
socks4,
|
|
||||||
|
|
||||||
// The server is assumed to be a SOCKS5 server (`RFC 1928`_) that does
|
|
||||||
// not require any authentication. The username and password are
|
|
||||||
// ignored.
|
|
||||||
//
|
|
||||||
// .. _`RFC 1928`: http://www.faqs.org/rfcs/rfc1928.html
|
|
||||||
socks5,
|
|
||||||
|
|
||||||
// The server is assumed to be a SOCKS5 server that supports plain
|
|
||||||
// text username and password authentication (`RFC 1929`_). The
|
|
||||||
// username and password specified may be sent to the proxy if it
|
|
||||||
// requires.
|
|
||||||
//
|
|
||||||
// .. _`RFC 1929`: http://www.faqs.org/rfcs/rfc1929.html
|
|
||||||
socks5_pw,
|
|
||||||
|
|
||||||
// The server is assumed to be an HTTP proxy. If the transport used
|
|
||||||
// for the connection is non-HTTP, the server is assumed to support
|
|
||||||
// the CONNECT_ method. i.e. for web seeds and HTTP trackers, a plain
|
|
||||||
// proxy will suffice. The proxy is assumed to not require
|
|
||||||
// authorization. The username and password will not be used.
|
|
||||||
//
|
|
||||||
// .. _CONNECT: http://tools.ietf.org/html/draft-luotonen-web-proxy-tunneling-01
|
|
||||||
http,
|
|
||||||
|
|
||||||
// The server is assumed to be an HTTP proxy that requires user
|
|
||||||
// authorization. The username and password will be sent to the proxy.
|
|
||||||
http_pw,
|
|
||||||
|
|
||||||
// route through an i2p SAM proxy
|
|
||||||
i2p_proxy
|
|
||||||
};
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// tells libtorrent what kind of proxy server it is. See proxy_type
|
|
||||||
// enum for options
|
|
||||||
boost::uint8_t type;
|
|
||||||
|
|
||||||
// the port the proxy server is running on
|
|
||||||
boost::uint16_t port;
|
|
||||||
|
|
||||||
// defaults to true. It means that hostnames should be attempted to be
|
|
||||||
// resolved through the proxy instead of using the local DNS service.
|
|
||||||
// This is only supported by SOCKS5 and HTTP.
|
|
||||||
bool proxy_hostnames;
|
|
||||||
|
|
||||||
// determines whether or not to excempt peer and web seed connections
|
|
||||||
// from using the proxy. This defaults to true, i.e. peer connections are
|
|
||||||
// proxied by default.
|
|
||||||
bool proxy_peer_connections;
|
|
||||||
};
|
|
||||||
|
|
||||||
#ifndef TORRENT_NO_DEPRECATE
|
|
||||||
|
|
||||||
// This holds most of the session-wide settings in libtorrent. Pass this
|
// This holds most of the session-wide settings in libtorrent. Pass this
|
||||||
// to session::set_settings() to change the settings, initialize it from
|
// to session::set_settings() to change the settings, initialize it from
|
||||||
|
|
|
@ -644,6 +644,10 @@ namespace libtorrent
|
||||||
// unlikely to matter anyway
|
// unlikely to matter anyway
|
||||||
auto_sequential,
|
auto_sequential,
|
||||||
|
|
||||||
|
// if true, trackerconnections are made over the configured proxy, if
|
||||||
|
// any.
|
||||||
|
proxy_tracker_connections,
|
||||||
|
|
||||||
max_bool_setting_internal
|
max_bool_setting_internal
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -71,7 +71,12 @@ namespace libtorrent
|
||||||
udp_socket(io_service& ios);
|
udp_socket(io_service& ios);
|
||||||
~udp_socket();
|
~udp_socket();
|
||||||
|
|
||||||
enum flags_t { dont_drop = 1, peer_connection = 2, dont_queue = 4 };
|
enum flags_t {
|
||||||
|
dont_drop = 1
|
||||||
|
, peer_connection = 2
|
||||||
|
, tracker_connection = 4
|
||||||
|
, dont_queue = 8
|
||||||
|
};
|
||||||
|
|
||||||
bool is_open() const
|
bool is_open() const
|
||||||
{
|
{
|
||||||
|
@ -96,8 +101,8 @@ namespace libtorrent
|
||||||
void close();
|
void close();
|
||||||
int local_port() const { return m_bind_port; }
|
int local_port() const { return m_bind_port; }
|
||||||
|
|
||||||
void set_proxy_settings(proxy_settings const& ps);
|
void set_proxy_settings(aux::proxy_settings const& ps);
|
||||||
proxy_settings const& get_proxy_settings() { return m_proxy_settings; }
|
aux::proxy_settings const& get_proxy_settings() { return m_proxy_settings; }
|
||||||
void set_force_proxy(bool f) { m_force_proxy = f; }
|
void set_force_proxy(bool f) { m_force_proxy = f; }
|
||||||
|
|
||||||
bool is_closed() const { return m_abort; }
|
bool is_closed() const { return m_abort; }
|
||||||
|
@ -236,7 +241,7 @@ namespace libtorrent
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
tcp::socket m_socks5_sock;
|
tcp::socket m_socks5_sock;
|
||||||
proxy_settings m_proxy_settings;
|
aux::proxy_settings m_proxy_settings;
|
||||||
tcp::resolver m_resolver;
|
tcp::resolver m_resolver;
|
||||||
char m_tmp_buf[270];
|
char m_tmp_buf[270];
|
||||||
bool m_queue_packets;
|
bool m_queue_packets;
|
||||||
|
|
|
@ -108,6 +108,7 @@ libtorrent_rasterbar_la_SOURCES = \
|
||||||
session_handle.cpp \
|
session_handle.cpp \
|
||||||
session_impl.cpp \
|
session_impl.cpp \
|
||||||
session_settings.cpp \
|
session_settings.cpp \
|
||||||
|
proxy_settings.cpp \
|
||||||
settings_pack.cpp \
|
settings_pack.cpp \
|
||||||
sha1.cpp \
|
sha1.cpp \
|
||||||
smart_ban.cpp \
|
smart_ban.cpp \
|
||||||
|
|
|
@ -108,7 +108,7 @@ http_connection::~http_connection()
|
||||||
}
|
}
|
||||||
|
|
||||||
void http_connection::get(std::string const& url, time_duration timeout, int prio
|
void http_connection::get(std::string const& url, time_duration timeout, int prio
|
||||||
, proxy_settings const* ps, int handle_redirects, std::string const& user_agent
|
, aux::proxy_settings const* ps, int handle_redirects, std::string const& user_agent
|
||||||
, address const& bind_addr, int resolve_flags, std::string const& auth_
|
, address const& bind_addr, int resolve_flags, std::string const& auth_
|
||||||
#if TORRENT_USE_I2P
|
#if TORRENT_USE_I2P
|
||||||
, i2p_connection* i2p_conn
|
, i2p_connection* i2p_conn
|
||||||
|
@ -223,7 +223,7 @@ void http_connection::get(std::string const& url, time_duration timeout, int pri
|
||||||
}
|
}
|
||||||
|
|
||||||
void http_connection::start(std::string const& hostname, int port
|
void http_connection::start(std::string const& hostname, int port
|
||||||
, time_duration timeout, int prio, proxy_settings const* ps, bool ssl
|
, time_duration timeout, int prio, aux::proxy_settings const* ps, bool ssl
|
||||||
, int handle_redirects
|
, int handle_redirects
|
||||||
, address const& bind_addr
|
, address const& bind_addr
|
||||||
, int resolve_flags
|
, int resolve_flags
|
||||||
|
@ -307,9 +307,9 @@ void http_connection::start(std::string const& hostname, int port
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
proxy_settings const* proxy = ps;
|
aux::proxy_settings const* proxy = ps;
|
||||||
#if TORRENT_USE_I2P
|
#if TORRENT_USE_I2P
|
||||||
proxy_settings i2p_proxy;
|
aux::proxy_settings i2p_proxy;
|
||||||
if (is_i2p)
|
if (is_i2p)
|
||||||
{
|
{
|
||||||
i2p_proxy = i2p_conn->proxy();
|
i2p_proxy = i2p_conn->proxy();
|
||||||
|
@ -326,7 +326,7 @@ void http_connection::start(std::string const& hostname, int port
|
||||||
{
|
{
|
||||||
proxy = 0;
|
proxy = 0;
|
||||||
}
|
}
|
||||||
proxy_settings null_proxy;
|
aux::proxy_settings null_proxy;
|
||||||
|
|
||||||
void* userdata = 0;
|
void* userdata = 0;
|
||||||
#ifdef TORRENT_USE_OPENSSL
|
#ifdef TORRENT_USE_OPENSSL
|
||||||
|
@ -347,8 +347,11 @@ void http_connection::start(std::string const& hostname, int port
|
||||||
userdata = m_ssl_ctx;
|
userdata = m_ssl_ctx;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
// assume this is not a tracker connection. Tracker connections that
|
||||||
|
// shouldn't be subject to the proxy should pass in NULL as the proxy
|
||||||
|
// pointer.
|
||||||
instantiate_connection(m_timer.get_io_service()
|
instantiate_connection(m_timer.get_io_service()
|
||||||
, proxy ? *proxy : null_proxy, m_sock, userdata);
|
, proxy ? *proxy : null_proxy, m_sock, userdata, NULL, false, false);
|
||||||
|
|
||||||
if (m_bind_addr != address_v4::any())
|
if (m_bind_addr != address_v4::any())
|
||||||
{
|
{
|
||||||
|
|
|
@ -215,10 +215,11 @@ namespace libtorrent
|
||||||
// to avoid being blocked for slow or failing responses. Chances
|
// to avoid being blocked for slow or failing responses. Chances
|
||||||
// are that we're shutting down, and this should be a best-effort
|
// are that we're shutting down, and this should be a best-effort
|
||||||
// attempt. It's not worth stalling shutdown.
|
// attempt. It's not worth stalling shutdown.
|
||||||
proxy_settings ps(settings);
|
aux::proxy_settings ps(settings);
|
||||||
m_tracker_connection->get(url, seconds(timeout)
|
m_tracker_connection->get(url, seconds(timeout)
|
||||||
, tracker_req().event == tracker_request::stopped ? 2 : 1
|
, tracker_req().event == tracker_request::stopped ? 2 : 1
|
||||||
, &ps, 5, settings.get_bool(settings_pack::anonymous_mode)
|
, ps.proxy_tracker_connections ? &ps : NULL
|
||||||
|
, 5, settings.get_bool(settings_pack::anonymous_mode)
|
||||||
? "" : settings.get_str(settings_pack::user_agent)
|
? "" : settings.get_str(settings_pack::user_agent)
|
||||||
, bind_interface()
|
, bind_interface()
|
||||||
, tracker_req().event == tracker_request::stopped
|
, tracker_req().event == tracker_request::stopped
|
||||||
|
|
|
@ -105,9 +105,9 @@ namespace libtorrent
|
||||||
if (m_sam_socket) m_sam_socket->close(e);
|
if (m_sam_socket) m_sam_socket->close(e);
|
||||||
}
|
}
|
||||||
|
|
||||||
proxy_settings i2p_connection::proxy() const
|
aux::proxy_settings i2p_connection::proxy() const
|
||||||
{
|
{
|
||||||
proxy_settings ret;
|
aux::proxy_settings ret;
|
||||||
ret.hostname = m_hostname;
|
ret.hostname = m_hostname;
|
||||||
ret.port = m_port;
|
ret.port = m_port;
|
||||||
ret.type = settings_pack::i2p_proxy;
|
ret.type = settings_pack::i2p_proxy;
|
||||||
|
|
|
@ -40,11 +40,14 @@ POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
|
||||||
namespace libtorrent
|
namespace libtorrent
|
||||||
{
|
{
|
||||||
|
// TODO: 2 peer_connection and tracker_connection should probably be flags
|
||||||
|
// TODO: 2 move this function into libtorrent::aux namespace
|
||||||
bool instantiate_connection(io_service& ios
|
bool instantiate_connection(io_service& ios
|
||||||
, proxy_settings const& ps, socket_type& s
|
, aux::proxy_settings const& ps, socket_type& s
|
||||||
, void* ssl_context
|
, void* ssl_context
|
||||||
, utp_socket_manager* sm
|
, utp_socket_manager* sm
|
||||||
, bool peer_connection)
|
, bool peer_connection
|
||||||
|
, bool tracker_connection)
|
||||||
{
|
{
|
||||||
#ifndef TORRENT_USE_OPENSSL
|
#ifndef TORRENT_USE_OPENSSL
|
||||||
TORRENT_UNUSED(ssl_context);
|
TORRENT_UNUSED(ssl_context);
|
||||||
|
@ -77,7 +80,8 @@ namespace libtorrent
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
else if (ps.type == settings_pack::none
|
else if (ps.type == settings_pack::none
|
||||||
|| (peer_connection && !ps.proxy_peer_connections))
|
|| (peer_connection && !ps.proxy_peer_connections)
|
||||||
|
|| (tracker_connection && !ps.proxy_tracker_connections))
|
||||||
{
|
{
|
||||||
#ifdef TORRENT_USE_OPENSSL
|
#ifdef TORRENT_USE_OPENSSL
|
||||||
if (ssl_context)
|
if (ssl_context)
|
||||||
|
|
|
@ -0,0 +1,78 @@
|
||||||
|
/*
|
||||||
|
|
||||||
|
Copyright (c) 2003-2015, Arvid Norberg
|
||||||
|
All rights reserved.
|
||||||
|
|
||||||
|
Redistribution and use in source and binary forms, with or without
|
||||||
|
modification, are permitted provided that the following conditions
|
||||||
|
are met:
|
||||||
|
|
||||||
|
* Redistributions of source code must retain the above copyright
|
||||||
|
notice, this list of conditions and the following disclaimer.
|
||||||
|
* Redistributions in binary form must reproduce the above copyright
|
||||||
|
notice, this list of conditions and the following disclaimer in
|
||||||
|
the documentation and/or other materials provided with the distribution.
|
||||||
|
* Neither the name of the author nor the names of its
|
||||||
|
contributors may be used to endorse or promote products derived
|
||||||
|
from this software without specific prior written permission.
|
||||||
|
|
||||||
|
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||||
|
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||||
|
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||||
|
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||||
|
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||||
|
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||||
|
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||||
|
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||||
|
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||||
|
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||||
|
POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "libtorrent/aux_/proxy_settings.hpp"
|
||||||
|
#include "libtorrent/settings_pack.hpp"
|
||||||
|
#include "libtorrent/aux_/session_settings.hpp"
|
||||||
|
|
||||||
|
namespace libtorrent {
|
||||||
|
namespace aux {
|
||||||
|
|
||||||
|
proxy_settings::proxy_settings()
|
||||||
|
: type(0)
|
||||||
|
, port(0)
|
||||||
|
, proxy_hostnames(true)
|
||||||
|
, proxy_peer_connections(true)
|
||||||
|
, proxy_tracker_connections(true)
|
||||||
|
{}
|
||||||
|
|
||||||
|
proxy_settings::proxy_settings(settings_pack const& sett)
|
||||||
|
{
|
||||||
|
hostname = sett.get_str(settings_pack::proxy_hostname);
|
||||||
|
username = sett.get_str(settings_pack::proxy_username);
|
||||||
|
password = sett.get_str(settings_pack::proxy_password);
|
||||||
|
type = sett.get_int(settings_pack::proxy_type);
|
||||||
|
port = sett.get_int(settings_pack::proxy_port);
|
||||||
|
proxy_hostnames = sett.get_bool(settings_pack::proxy_hostnames);
|
||||||
|
proxy_peer_connections = sett.get_bool(
|
||||||
|
settings_pack::proxy_peer_connections);
|
||||||
|
proxy_tracker_connections = sett.get_bool(
|
||||||
|
settings_pack::proxy_tracker_connections);
|
||||||
|
}
|
||||||
|
|
||||||
|
proxy_settings::proxy_settings(aux::session_settings const& sett)
|
||||||
|
{
|
||||||
|
hostname = sett.get_str(settings_pack::proxy_hostname);
|
||||||
|
username = sett.get_str(settings_pack::proxy_username);
|
||||||
|
password = sett.get_str(settings_pack::proxy_password);
|
||||||
|
type = sett.get_int(settings_pack::proxy_type);
|
||||||
|
port = sett.get_int(settings_pack::proxy_port);
|
||||||
|
proxy_hostnames = sett.get_bool(settings_pack::proxy_hostnames);
|
||||||
|
proxy_peer_connections = sett.get_bool(
|
||||||
|
settings_pack::proxy_peer_connections);
|
||||||
|
proxy_tracker_connections = sett.get_bool(
|
||||||
|
settings_pack::proxy_tracker_connections);
|
||||||
|
}
|
||||||
|
|
||||||
|
} // namespace aux
|
||||||
|
} // namespace libtorrent
|
||||||
|
|
|
@ -220,31 +220,6 @@ void network_thread_pool::process_job(socket_job const& j, bool post)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: 2 find a better place for this function
|
|
||||||
proxy_settings::proxy_settings(settings_pack const& sett)
|
|
||||||
{
|
|
||||||
hostname = sett.get_str(settings_pack::proxy_hostname);
|
|
||||||
username = sett.get_str(settings_pack::proxy_username);
|
|
||||||
password = sett.get_str(settings_pack::proxy_password);
|
|
||||||
type = sett.get_int(settings_pack::proxy_type);
|
|
||||||
port = sett.get_int(settings_pack::proxy_port);
|
|
||||||
proxy_hostnames = sett.get_bool(settings_pack::proxy_hostnames);
|
|
||||||
proxy_peer_connections = sett.get_bool(
|
|
||||||
settings_pack::proxy_peer_connections);
|
|
||||||
}
|
|
||||||
|
|
||||||
proxy_settings::proxy_settings(aux::session_settings const& sett)
|
|
||||||
{
|
|
||||||
hostname = sett.get_str(settings_pack::proxy_hostname);
|
|
||||||
username = sett.get_str(settings_pack::proxy_username);
|
|
||||||
password = sett.get_str(settings_pack::proxy_password);
|
|
||||||
type = sett.get_int(settings_pack::proxy_type);
|
|
||||||
port = sett.get_int(settings_pack::proxy_port);
|
|
||||||
proxy_hostnames = sett.get_bool(settings_pack::proxy_hostnames);
|
|
||||||
proxy_peer_connections = sett.get_bool(
|
|
||||||
settings_pack::proxy_peer_connections);
|
|
||||||
}
|
|
||||||
|
|
||||||
namespace aux {
|
namespace aux {
|
||||||
|
|
||||||
void session_impl::init_peer_class_filter(bool unlimited_local)
|
void session_impl::init_peer_class_filter(bool unlimited_local)
|
||||||
|
@ -2125,7 +2100,7 @@ retry:
|
||||||
|
|
||||||
m_socks_listen_socket = boost::shared_ptr<socket_type>(new socket_type(m_io_service));
|
m_socks_listen_socket = boost::shared_ptr<socket_type>(new socket_type(m_io_service));
|
||||||
bool ret = instantiate_connection(m_io_service, proxy()
|
bool ret = instantiate_connection(m_io_service, proxy()
|
||||||
, *m_socks_listen_socket);
|
, *m_socks_listen_socket, NULL, NULL, false, false);
|
||||||
TORRENT_ASSERT_VAL(ret, ret);
|
TORRENT_ASSERT_VAL(ret, ret);
|
||||||
TORRENT_UNUSED(ret);
|
TORRENT_UNUSED(ret);
|
||||||
|
|
||||||
|
@ -2197,7 +2172,7 @@ retry:
|
||||||
|
|
||||||
m_i2p_listen_socket = boost::shared_ptr<socket_type>(new socket_type(m_io_service));
|
m_i2p_listen_socket = boost::shared_ptr<socket_type>(new socket_type(m_io_service));
|
||||||
bool ret = instantiate_connection(m_io_service, m_i2p_conn.proxy()
|
bool ret = instantiate_connection(m_io_service, m_i2p_conn.proxy()
|
||||||
, *m_i2p_listen_socket);
|
, *m_i2p_listen_socket, NULL, NULL, true, false);
|
||||||
TORRENT_ASSERT_VAL(ret, ret);
|
TORRENT_ASSERT_VAL(ret, ret);
|
||||||
TORRENT_UNUSED(ret);
|
TORRENT_UNUSED(ret);
|
||||||
|
|
||||||
|
|
|
@ -211,6 +211,7 @@ namespace libtorrent
|
||||||
SET_NOPREV(proxy_hostnames, true, 0),
|
SET_NOPREV(proxy_hostnames, true, 0),
|
||||||
SET_NOPREV(proxy_peer_connections, true, 0),
|
SET_NOPREV(proxy_peer_connections, true, 0),
|
||||||
SET_NOPREV(auto_sequential, true, &session_impl::update_auto_sequential),
|
SET_NOPREV(auto_sequential, true, &session_impl::update_auto_sequential),
|
||||||
|
SET_NOPREV(proxy_tracker_connections, true, 0),
|
||||||
};
|
};
|
||||||
|
|
||||||
int_setting_entry_t int_settings[settings_pack::num_int_settings] =
|
int_setting_entry_t int_settings[settings_pack::num_int_settings] =
|
||||||
|
|
|
@ -863,7 +863,7 @@ namespace libtorrent
|
||||||
, m_ssl_ctx.get()
|
, m_ssl_ctx.get()
|
||||||
#endif
|
#endif
|
||||||
));
|
));
|
||||||
proxy_settings ps = m_ses.proxy();
|
aux::proxy_settings ps = m_ses.proxy();
|
||||||
conn->get(m_url, seconds(30), 0, &ps
|
conn->get(m_url, seconds(30), 0, &ps
|
||||||
, 5, settings().get_str(settings_pack::user_agent));
|
, 5, settings().get_str(settings_pack::user_agent));
|
||||||
set_state(torrent_status::downloading_metadata);
|
set_state(torrent_status::downloading_metadata);
|
||||||
|
@ -6198,7 +6198,7 @@ namespace libtorrent
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
proxy_settings const& ps = m_ses.proxy();
|
aux::proxy_settings const& ps = m_ses.proxy();
|
||||||
if (ps.type == settings_pack::http
|
if (ps.type == settings_pack::http
|
||||||
|| ps.type == settings_pack::http_pw)
|
|| ps.type == settings_pack::http_pw)
|
||||||
{
|
{
|
||||||
|
@ -6410,7 +6410,8 @@ namespace libtorrent
|
||||||
if (!userdata) userdata = m_ses.ssl_ctx();
|
if (!userdata) userdata = m_ses.ssl_ctx();
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
bool ret = instantiate_connection(m_ses.get_io_service(), m_ses.proxy(), *s, userdata, 0, true);
|
bool ret = instantiate_connection(m_ses.get_io_service(), m_ses.proxy()
|
||||||
|
, *s, userdata, 0, true, false);
|
||||||
(void)ret;
|
(void)ret;
|
||||||
TORRENT_ASSERT(ret);
|
TORRENT_ASSERT(ret);
|
||||||
|
|
||||||
|
@ -7515,7 +7516,12 @@ namespace libtorrent
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ret = instantiate_connection(m_ses.get_io_service(), m_ses.i2p_proxy(), *s);
|
// It's not entirely obvious why this peer connection is not marked as
|
||||||
|
// one. The main feature of a peer connection is that whether or not we
|
||||||
|
// proxy it is configurable. When we use i2p, we want to always prox
|
||||||
|
// everything via i2p.
|
||||||
|
bool ret = instantiate_connection(m_ses.get_io_service()
|
||||||
|
, m_ses.i2p_proxy(), *s, NULL, NULL, false, false);
|
||||||
(void)ret;
|
(void)ret;
|
||||||
TORRENT_ASSERT(ret);
|
TORRENT_ASSERT(ret);
|
||||||
s->get<i2p_stream>()->set_destination(static_cast<i2p_peer*>(peerinfo)->destination);
|
s->get<i2p_stream>()->set_destination(static_cast<i2p_peer*>(peerinfo)->destination);
|
||||||
|
@ -7556,7 +7562,7 @@ namespace libtorrent
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
bool ret = instantiate_connection(m_ses.get_io_service()
|
bool ret = instantiate_connection(m_ses.get_io_service()
|
||||||
, m_ses.proxy(), *s, userdata, sm, true);
|
, m_ses.proxy(), *s, userdata, sm, true, false);
|
||||||
(void)ret;
|
(void)ret;
|
||||||
TORRENT_ASSERT(ret);
|
TORRENT_ASSERT(ret);
|
||||||
|
|
||||||
|
|
|
@ -180,7 +180,13 @@ void udp_socket::send(udp::endpoint const& ep, char const* p, int len
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!(flags & peer_connection) || m_proxy_settings.proxy_peer_connections)
|
const bool allow_proxy
|
||||||
|
= ((flags & peer_connection) && m_proxy_settings.proxy_peer_connections)
|
||||||
|
|| ((flags & tracker_connection) && m_proxy_settings.proxy_tracker_connections)
|
||||||
|
|| (flags & (tracker_connection | peer_connection)) == 0
|
||||||
|
;
|
||||||
|
|
||||||
|
if (allow_proxy)
|
||||||
{
|
{
|
||||||
if (m_tunnel_packets)
|
if (m_tunnel_packets)
|
||||||
{
|
{
|
||||||
|
@ -770,7 +776,7 @@ void udp_socket::bind(udp::endpoint const& ep, error_code& ec)
|
||||||
m_bind_port = ep.port();
|
m_bind_port = ep.port();
|
||||||
}
|
}
|
||||||
|
|
||||||
void udp_socket::set_proxy_settings(proxy_settings const& ps)
|
void udp_socket::set_proxy_settings(aux::proxy_settings const& ps)
|
||||||
{
|
{
|
||||||
CHECK_MAGIC;
|
CHECK_MAGIC;
|
||||||
TORRENT_ASSERT(is_single_thread());
|
TORRENT_ASSERT(is_single_thread());
|
||||||
|
@ -838,7 +844,7 @@ void udp_socket::on_name_lookup(error_code const& e, tcp::resolver::iterator i)
|
||||||
// if we can't connect to the proxy, and
|
// if we can't connect to the proxy, and
|
||||||
// we're not in privacy mode, try to just
|
// we're not in privacy mode, try to just
|
||||||
// not use a proxy
|
// not use a proxy
|
||||||
m_proxy_settings = proxy_settings();
|
m_proxy_settings = aux::proxy_settings();
|
||||||
m_tunnel_packets = false;
|
m_tunnel_packets = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -504,12 +504,13 @@ namespace libtorrent
|
||||||
if (!m_hostname.empty())
|
if (!m_hostname.empty())
|
||||||
{
|
{
|
||||||
m_man.get_udp_socket().send_hostname(m_hostname.c_str()
|
m_man.get_udp_socket().send_hostname(m_hostname.c_str()
|
||||||
, m_target.port(), buf, 16, ec);
|
, m_target.port(), buf, 16, ec
|
||||||
|
, udp_socket::tracker_connection);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
m_man.get_udp_socket().send(m_target, buf, 16, ec);
|
m_man.get_udp_socket().send(m_target, buf, 16, ec
|
||||||
|
, udp_socket::tracker_connection);
|
||||||
}
|
}
|
||||||
|
|
||||||
++m_attempts;
|
++m_attempts;
|
||||||
|
@ -566,11 +567,13 @@ namespace libtorrent
|
||||||
error_code ec;
|
error_code ec;
|
||||||
if (!m_hostname.empty())
|
if (!m_hostname.empty())
|
||||||
{
|
{
|
||||||
m_man.get_udp_socket().send_hostname(m_hostname.c_str(), m_target.port(), buf, sizeof(buf), ec);
|
m_man.get_udp_socket().send_hostname(m_hostname.c_str(), m_target.port()
|
||||||
|
, buf, sizeof(buf), ec, udp_socket::tracker_connection);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
m_man.get_udp_socket().send(m_target, buf, sizeof(buf), ec);
|
m_man.get_udp_socket().send(m_target, buf, sizeof(buf), ec
|
||||||
|
, udp_socket::tracker_connection);
|
||||||
}
|
}
|
||||||
m_state = action_scrape;
|
m_state = action_scrape;
|
||||||
sent_bytes(sizeof(buf) + 28); // assuming UDP/IP header
|
sent_bytes(sizeof(buf) + 28); // assuming UDP/IP header
|
||||||
|
@ -764,11 +767,13 @@ namespace libtorrent
|
||||||
if (!m_hostname.empty())
|
if (!m_hostname.empty())
|
||||||
{
|
{
|
||||||
m_man.get_udp_socket().send_hostname(m_hostname.c_str()
|
m_man.get_udp_socket().send_hostname(m_hostname.c_str()
|
||||||
, m_target.port(), buf, out - buf, ec);
|
, m_target.port(), buf, out - buf, ec
|
||||||
|
, udp_socket::tracker_connection);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
m_man.get_udp_socket().send(m_target, buf, out - buf, ec);
|
m_man.get_udp_socket().send(m_target, buf, out - buf, ec
|
||||||
|
, udp_socket::tracker_connection);
|
||||||
}
|
}
|
||||||
m_state = action_announce;
|
m_state = action_announce;
|
||||||
sent_bytes(out - buf + 28); // assuming UDP/IP header
|
sent_bytes(out - buf + 28); // assuming UDP/IP header
|
||||||
|
|
|
@ -292,8 +292,8 @@ namespace libtorrent
|
||||||
// create the new socket with this ID
|
// create the new socket with this ID
|
||||||
m_new_connection = id;
|
m_new_connection = id;
|
||||||
|
|
||||||
instantiate_connection(m_sock.get_io_service(), proxy_settings(), *c
|
instantiate_connection(m_sock.get_io_service(), aux::proxy_settings(), *c
|
||||||
, m_ssl_context, this, true);
|
, m_ssl_context, this, true, false);
|
||||||
|
|
||||||
|
|
||||||
utp_stream* str = NULL;
|
utp_stream* str = NULL;
|
||||||
|
|
|
@ -106,7 +106,7 @@ void reset_globals()
|
||||||
}
|
}
|
||||||
|
|
||||||
void run_test(std::string const& url, int size, int status, int connected
|
void run_test(std::string const& url, int size, int status, int connected
|
||||||
, boost::optional<error_code> ec, proxy_settings const& ps
|
, boost::optional<error_code> ec, aux::proxy_settings const& ps
|
||||||
, std::string const& auth = std::string())
|
, std::string const& auth = std::string())
|
||||||
{
|
{
|
||||||
reset_globals();
|
reset_globals();
|
||||||
|
@ -174,7 +174,7 @@ void run_suite(std::string const& protocol
|
||||||
, flags & flag_chunked_encoding
|
, flags & flag_chunked_encoding
|
||||||
, flags & flag_keepalive);
|
, flags & flag_keepalive);
|
||||||
|
|
||||||
proxy_settings ps;
|
aux::proxy_settings ps;
|
||||||
ps.hostname = "127.0.0.1";
|
ps.hostname = "127.0.0.1";
|
||||||
ps.username = "testuser";
|
ps.username = "testuser";
|
||||||
ps.password = "testpass";
|
ps.password = "testpass";
|
||||||
|
|
Loading…
Reference in New Issue