Merge branch 'master' into old_features

This commit is contained in:
rakshasa
2014-06-12 23:03:54 +09:00
7 changed files with 1215 additions and 27 deletions
File diff suppressed because it is too large Load Diff
+1 -1
View File
@@ -438,7 +438,7 @@ cmd_catch(rpc::target_type target, const torrent::Object& args) {
void void
initialize_command_dynamic() { initialize_command_dynamic() {
CMD2_VAR_BOOL ("method.use_deprecated", true); CMD2_VAR_BOOL ("method.use_deprecated", false);
CMD2_VAR_VALUE ("method.use_intermediate", 1); CMD2_VAR_VALUE ("method.use_intermediate", 1);
CMD2_ANY_LIST ("method.insert", tr1::bind(&system_method_insert, tr1::placeholders::_2)); CMD2_ANY_LIST ("method.insert", tr1::bind(&system_method_insert, tr1::placeholders::_2));
+10 -8
View File
@@ -264,18 +264,20 @@ initialize_command_network() {
CMD2_VAR_STRING ("protocol.choke_heuristics.down.leech", "download_leech"); CMD2_VAR_STRING ("protocol.choke_heuristics.down.leech", "download_leech");
CMD2_VAR_STRING ("protocol.choke_heuristics.down.seed", "download_leech"); CMD2_VAR_STRING ("protocol.choke_heuristics.down.seed", "download_leech");
CMD2_ANY ("network.http.capath", tr1::bind(&core::CurlStack::http_capath, httpStack));
CMD2_ANY_STRING_V("network.http.capath.set", tr1::bind(&core::CurlStack::set_http_capath, httpStack, tr1::placeholders::_2));
CMD2_ANY ("network.http.cacert", tr1::bind(&core::CurlStack::http_cacert, httpStack)); CMD2_ANY ("network.http.cacert", tr1::bind(&core::CurlStack::http_cacert, httpStack));
CMD2_ANY_STRING_V("network.http.cacert.set", tr1::bind(&core::CurlStack::set_http_cacert, httpStack, tr1::placeholders::_2)); CMD2_ANY_STRING_V("network.http.cacert.set", tr1::bind(&core::CurlStack::set_http_cacert, httpStack, tr1::placeholders::_2));
CMD2_ANY ("network.http.proxy_address", tr1::bind(&core::CurlStack::http_proxy, httpStack)); CMD2_ANY ("network.http.capath", tr1::bind(&core::CurlStack::http_capath, httpStack));
CMD2_ANY_STRING_V("network.http.proxy_address.set", tr1::bind(&core::CurlStack::set_http_proxy, httpStack, tr1::placeholders::_2)); CMD2_ANY_STRING_V("network.http.capath.set", tr1::bind(&core::CurlStack::set_http_capath, httpStack, tr1::placeholders::_2));
CMD2_ANY ("network.http.max_open", tr1::bind(&core::CurlStack::max_active, httpStack));
CMD2_ANY_VALUE_V ("network.http.max_open.set", tr1::bind(&core::CurlStack::set_max_active, httpStack, tr1::placeholders::_2));
CMD2_ANY ("network.http.ssl_verify_peer", tr1::bind(&core::CurlStack::ssl_verify_peer, httpStack));
CMD2_ANY_VALUE_V ("network.http.ssl_verify_peer.set", tr1::bind(&core::CurlStack::set_ssl_verify_peer, httpStack, tr1::placeholders::_2));
CMD2_ANY ("network.http.dns_cache_timeout", tr1::bind(&core::CurlStack::dns_timeout, httpStack)); CMD2_ANY ("network.http.dns_cache_timeout", tr1::bind(&core::CurlStack::dns_timeout, httpStack));
CMD2_ANY_VALUE_V ("network.http.dns_cache_timeout.set", tr1::bind(&core::CurlStack::set_dns_timeout, httpStack, tr1::placeholders::_2)); CMD2_ANY_VALUE_V ("network.http.dns_cache_timeout.set", tr1::bind(&core::CurlStack::set_dns_timeout, httpStack, tr1::placeholders::_2));
CMD2_ANY ("network.http.max_open", tr1::bind(&core::CurlStack::max_active, httpStack));
CMD2_ANY_VALUE_V ("network.http.max_open.set", tr1::bind(&core::CurlStack::set_max_active, httpStack, tr1::placeholders::_2));
CMD2_ANY ("network.http.proxy_address", tr1::bind(&core::CurlStack::http_proxy, httpStack));
CMD2_ANY_STRING_V("network.http.proxy_address.set", tr1::bind(&core::CurlStack::set_http_proxy, httpStack, tr1::placeholders::_2));
CMD2_ANY ("network.http.ssl_verify_host", tr1::bind(&core::CurlStack::ssl_verify_host, httpStack));
CMD2_ANY_VALUE_V ("network.http.ssl_verify_host.set", tr1::bind(&core::CurlStack::set_ssl_verify_host, httpStack, tr1::placeholders::_2));
CMD2_ANY ("network.http.ssl_verify_peer", tr1::bind(&core::CurlStack::ssl_verify_peer, httpStack));
CMD2_ANY_VALUE_V ("network.http.ssl_verify_peer.set", tr1::bind(&core::CurlStack::set_ssl_verify_peer, httpStack, tr1::placeholders::_2));
CMD2_ANY ("network.send_buffer.size", tr1::bind(&torrent::ConnectionManager::send_buffer_size, cm)); CMD2_ANY ("network.send_buffer.size", tr1::bind(&torrent::ConnectionManager::send_buffer_size, cm));
CMD2_ANY_VALUE_V ("network.send_buffer.size.set", tr1::bind(&torrent::ConnectionManager::set_send_buffer_size, cm, tr1::placeholders::_2)); CMD2_ANY_VALUE_V ("network.send_buffer.size.set", tr1::bind(&torrent::ConnectionManager::set_send_buffer_size, cm, tr1::placeholders::_2));
+3 -1
View File
@@ -51,6 +51,7 @@ CurlStack::CurlStack() :
m_handle((void*)curl_multi_init()), m_handle((void*)curl_multi_init()),
m_active(0), m_active(0),
m_maxActive(32), m_maxActive(32),
m_ssl_verify_host(true),
m_ssl_verify_peer(true), m_ssl_verify_peer(true),
m_dns_timeout(60) { m_dns_timeout(60) {
@@ -180,7 +181,8 @@ CurlStack::add_get(CurlGet* get) {
if (!m_httpCaCert.empty()) if (!m_httpCaCert.empty())
curl_easy_setopt(get->handle(), CURLOPT_CAINFO, m_httpCaCert.c_str()); curl_easy_setopt(get->handle(), CURLOPT_CAINFO, m_httpCaCert.c_str());
curl_easy_setopt(get->handle(), CURLOPT_SSL_VERIFYPEER, (long)m_ssl_verify_peer); curl_easy_setopt(get->handle(), CURLOPT_SSL_VERIFYHOST, (long)(m_ssl_verify_host ? 2 : 0));
curl_easy_setopt(get->handle(), CURLOPT_SSL_VERIFYPEER, (long)(m_ssl_verify_peer ? 1 : 0));
curl_easy_setopt(get->handle(), CURLOPT_DNS_CACHE_TIMEOUT, m_dns_timeout); curl_easy_setopt(get->handle(), CURLOPT_DNS_CACHE_TIMEOUT, m_dns_timeout);
base_type::push_back(get); base_type::push_back(get);
+3
View File
@@ -100,7 +100,9 @@ class CurlStack : std::deque<CurlGet*> {
void set_http_capath(const std::string& s) { m_httpCaPath = s; } void set_http_capath(const std::string& s) { m_httpCaPath = s; }
void set_http_cacert(const std::string& s) { m_httpCaCert = s; } void set_http_cacert(const std::string& s) { m_httpCaCert = s; }
bool ssl_verify_host() const { return m_ssl_verify_host; }
bool ssl_verify_peer() const { return m_ssl_verify_peer; } bool ssl_verify_peer() const { return m_ssl_verify_peer; }
void set_ssl_verify_host(bool s) { m_ssl_verify_host = s; }
void set_ssl_verify_peer(bool s) { m_ssl_verify_peer = s; } void set_ssl_verify_peer(bool s) { m_ssl_verify_peer = s; }
long dns_timeout() const { return m_dns_timeout; } long dns_timeout() const { return m_dns_timeout; }
@@ -140,6 +142,7 @@ class CurlStack : std::deque<CurlGet*> {
std::string m_httpCaPath; std::string m_httpCaPath;
std::string m_httpCaCert; std::string m_httpCaCert;
long m_ssl_verify_host;
bool m_ssl_verify_peer; bool m_ssl_verify_peer;
long m_dns_timeout; long m_dns_timeout;
}; };
+17 -16
View File
@@ -230,7 +230,7 @@ main(int argc, char** argv) {
initialize_commands(); initialize_commands();
if (OptionParser::has_flag('D', argc, argv)) { if (OptionParser::has_flag('D', argc, argv)) {
rpc::call_command_set_value("method.use_deprecated.set", false); rpc::call_command_set_value("method.use_deprecated.set", true);
lt_log_print(torrent::LOG_WARN, "Disabled deprecated commands."); lt_log_print(torrent::LOG_WARN, "Disabled deprecated commands.");
} }
@@ -394,11 +394,26 @@ main(int argc, char** argv) {
CMD2_REDIRECT ("port_random", "network.port_random.set"); CMD2_REDIRECT ("port_random", "network.port_random.set");
CMD2_REDIRECT ("proxy_address", "network.proxy_address.set"); CMD2_REDIRECT ("proxy_address", "network.proxy_address.set");
CMD2_REDIRECT ("scgi_port", "network.scgi.open_port");
CMD2_REDIRECT ("scgi_local", "network.scgi.open_local");
CMD2_REDIRECT_GENERIC("directory", "directory.default.set"); CMD2_REDIRECT_GENERIC("directory", "directory.default.set");
CMD2_REDIRECT_GENERIC("session", "session.path.set"); CMD2_REDIRECT_GENERIC("session", "session.path.set");
CMD2_REDIRECT ("check_hash", "pieces.hash.on_completion.set");
CMD2_REDIRECT ("key_layout", "keys.layout.set"); CMD2_REDIRECT ("key_layout", "keys.layout.set");
CMD2_REDIRECT_GENERIC("to_gm_time", "convert.gm_time");
CMD2_REDIRECT_GENERIC("to_gm_date", "convert.gm_date");
CMD2_REDIRECT_GENERIC("to_time", "convert.time");
CMD2_REDIRECT_GENERIC("to_date", "convert.date");
CMD2_REDIRECT_GENERIC("to_elapsed_time", "convert.elapsed_time");
CMD2_REDIRECT_GENERIC("to_kb", "convert.kb");
CMD2_REDIRECT_GENERIC("to_mb", "convert.mb");
CMD2_REDIRECT_GENERIC("to_xb", "convert.xb");
CMD2_REDIRECT_GENERIC("to_throttle", "convert.throttle");
// Deprecated commands. Don't use these anymore. // Deprecated commands. Don't use these anymore.
if (rpc::call_command_value("method.use_intermediate") == 1) { if (rpc::call_command_value("method.use_intermediate") == 1) {
@@ -556,10 +571,6 @@ main(int argc, char** argv) {
CMD2_REDIRECT_GENERIC("set_proxy_address", "network.proxy_address.set"); CMD2_REDIRECT_GENERIC("set_proxy_address", "network.proxy_address.set");
CMD2_REDIRECT ("get_proxy_address", "network.proxy_address"); CMD2_REDIRECT ("get_proxy_address", "network.proxy_address");
CMD2_REDIRECT ("scgi_port", "network.scgi.open_port");
CMD2_REDIRECT ("scgi_local", "network.scgi.open_local");
CMD2_REDIRECT ("scgi_dont_route", "network.scgi.dont_route.set");
CMD2_REDIRECT_GENERIC("set_scgi_dont_route", "network.scgi.dont_route.set"); CMD2_REDIRECT_GENERIC("set_scgi_dont_route", "network.scgi.dont_route.set");
CMD2_REDIRECT ("get_scgi_dont_route", "network.scgi.dont_route"); CMD2_REDIRECT ("get_scgi_dont_route", "network.scgi.dont_route");
@@ -634,7 +645,6 @@ main(int argc, char** argv) {
CMD2_REDIRECT ("get_session_on_completion", "session.on_completion"); CMD2_REDIRECT ("get_session_on_completion", "session.on_completion");
CMD2_REDIRECT_GENERIC("set_session_on_completion", "session.on_completion.set"); CMD2_REDIRECT_GENERIC("set_session_on_completion", "session.on_completion.set");
CMD2_REDIRECT ("check_hash", "pieces.hash.on_completion.set");
CMD2_REDIRECT ("get_check_hash", "pieces.hash.on_completion"); CMD2_REDIRECT ("get_check_hash", "pieces.hash.on_completion");
CMD2_REDIRECT_GENERIC("set_check_hash", "pieces.hash.on_completion.set"); CMD2_REDIRECT_GENERIC("set_check_hash", "pieces.hash.on_completion.set");
@@ -809,16 +819,6 @@ main(int argc, char** argv) {
// Rename these to avoid conflicts with old style. // Rename these to avoid conflicts with old style.
CMD2_REDIRECT_GENERIC("d.multicall", "d.multicall2"); CMD2_REDIRECT_GENERIC("d.multicall", "d.multicall2");
CMD2_REDIRECT_GENERIC("to_gm_time", "convert.gm_time");
CMD2_REDIRECT_GENERIC("to_gm_date", "convert.gm_date");
CMD2_REDIRECT_GENERIC("to_time", "convert.time");
CMD2_REDIRECT_GENERIC("to_date", "convert.date");
CMD2_REDIRECT_GENERIC("to_elapsed_time", "convert.elapsed_time");
CMD2_REDIRECT_GENERIC("to_kb", "convert.kb");
CMD2_REDIRECT_GENERIC("to_mb", "convert.mb");
CMD2_REDIRECT_GENERIC("to_xb", "convert.xb");
CMD2_REDIRECT_GENERIC("to_throttle", "convert.throttle");
CMD2_REDIRECT_GENERIC("execute_throw", "execute.throw"); CMD2_REDIRECT_GENERIC("execute_throw", "execute.throw");
CMD2_REDIRECT_GENERIC("execute_nothrow", "execute.nothrow"); CMD2_REDIRECT_GENERIC("execute_nothrow", "execute.nothrow");
CMD2_REDIRECT_GENERIC("execute_raw", "execute.raw"); CMD2_REDIRECT_GENERIC("execute_raw", "execute.raw");
@@ -1002,6 +1002,7 @@ print_help() {
std::cout << "order. Use the up/down/left/right arrow keys to move between screens." << std::endl; std::cout << "order. Use the up/down/left/right arrow keys to move between screens." << std::endl;
std::cout << std::endl; std::cout << std::endl;
std::cout << "Usage: rtorrent [OPTIONS]... [FILE]... [URL]..." << std::endl; std::cout << "Usage: rtorrent [OPTIONS]... [FILE]... [URL]..." << std::endl;
std::cout << " -D Enable deprecated commands" << std::endl;
std::cout << " -h Display this very helpful text" << std::endl; std::cout << " -h Display this very helpful text" << std::endl;
std::cout << " -n Don't try to load ~/.rtorrent.rc on startup" << std::endl; std::cout << " -n Don't try to load ~/.rtorrent.rc on startup" << std::endl;
std::cout << " -b <a.b.c.d> Bind the listening socket to this IP" << std::endl; std::cout << " -b <a.b.c.d> Bind the listening socket to this IP" << std::endl;
+1 -1
View File
@@ -53,7 +53,7 @@ public:
ThreadWorker(); ThreadWorker();
~ThreadWorker(); ~ThreadWorker();
const char* name() const { return "worker_rtorrent"; } const char* name() const { return "rtorrent scgi"; }
virtual void init_thread(); virtual void init_thread();