* Added 'network.http.dns_cache_timeout{,.set}' commands to allow for disabling the libcurl dns caching.

git-svn-id: svn://rakshasa.no/libtorrent/trunk/rtorrent@1261 e378c898-3ddf-0310-93e7-cc216c733640
This commit is contained in:
rakshasa
2011-08-03 09:29:03 +00:00
parent adef434bc3
commit 3f41f9384d
3 changed files with 26 additions and 21 deletions
+4 -3
View File
@@ -52,7 +52,8 @@ CurlStack::CurlStack() :
m_handle((void*)curl_multi_init()),
m_active(0),
m_maxActive(32),
m_ssl_verify_peer(true) {
m_ssl_verify_peer(true),
m_dns_timeout(60) {
m_taskTimeout.set_slot(rak::mem_fn(this, &CurlStack::receive_timeout));
@@ -165,8 +166,8 @@ CurlStack::add_get(CurlGet* get) {
if (!m_httpCaCert.empty())
curl_easy_setopt(get->handle(), CURLOPT_CAINFO, m_httpCaCert.c_str());
if (!m_ssl_verify_peer)
curl_easy_setopt(get->handle(), CURLOPT_SSL_VERIFYPEER, 0);
curl_easy_setopt(get->handle(), CURLOPT_SSL_VERIFYPEER, (long)m_ssl_verify_peer);
curl_easy_setopt(get->handle(), CURLOPT_DNS_CACHE_TIMEOUT, m_dns_timeout);
base_type::push_back(get);
+10 -8
View File
@@ -90,23 +90,23 @@ class CurlStack : std::deque<CurlGet*> {
void set_max_active(unsigned int a) { m_maxActive = a; }
const std::string& user_agent() const { return m_userAgent; }
void set_user_agent(const std::string& s) { m_userAgent = s; }
const std::string& http_proxy() const { return m_httpProxy; }
void set_http_proxy(const std::string& s) { m_httpProxy = s; }
const std::string& bind_address() const { return m_bindAddress; }
void set_bind_address(const std::string& s) { m_bindAddress = s; }
const std::string& http_capath() const { return m_httpCaPath; }
void set_http_capath(const std::string& s) { m_httpCaPath = s; }
const std::string& http_cacert() const { return m_httpCaCert; }
void set_user_agent(const std::string& s) { m_userAgent = s; }
void set_http_proxy(const std::string& s) { m_httpProxy = s; }
void set_bind_address(const std::string& s) { m_bindAddress = s; }
void set_http_capath(const std::string& s) { m_httpCaPath = s; }
void set_http_cacert(const std::string& s) { m_httpCaCert = s; }
bool ssl_verify_peer() const { return m_ssl_verify_peer; }
void set_ssl_verify_peer(bool s) { m_ssl_verify_peer = s; }
long dns_timeout() const { return m_dns_timeout; }
void set_dns_timeout(long timeout) { m_dns_timeout = timeout; }
static void global_init();
static void global_cleanup();
@@ -138,7 +138,9 @@ class CurlStack : std::deque<CurlGet*> {
std::string m_bindAddress;
std::string m_httpCaPath;
std::string m_httpCaCert;
bool m_ssl_verify_peer;
long m_dns_timeout;
};
}