예제 #1
0
LLCurl::Easy* LLCurl::Easy::getEasy()
{
	Easy* easy = new Easy();
	easy->mCurlEasyHandle = allocEasyHandle(); 
	
	if (!easy->mCurlEasyHandle)
	{
		// this can happen if we have too many open files (fails in c-ares/ares_init.c)
		llwarns << "allocEasyHandle() returned NULL! Easy handles: " << gCurlEasyCount << " Multi handles: " << gCurlMultiCount << llendl;
		delete easy;
		return NULL;
	}
	
	// set no DNS caching as default for all easy handles. This prevents them adopting a
	// multi handles cache if they are added to one.
	CURLcode result = curl_easy_setopt(easy->mCurlEasyHandle, CURLOPT_DNS_CACHE_TIMEOUT, 0);
	check_curl_code(result);
	
	// <FS:ND> Disable SSL/TLS session caching. Some servers refuse to talk to us when session ids are enabled.
	// id.secondlife.com is such a server, when greeted with a SSL HELLO and a session id, it immediatly returns a RST packet and closes
	// the connections.
	// Fixes: FIRE-5368, FIRE-5756, VWR-28039, VWR-28629
	result = curl_easy_setopt(easy->mCurlEasyHandle, CURLOPT_SSL_SESSIONID_CACHE, 0);
	check_curl_code(result);
	// </FS:ND>


	++gCurlEasyCount;
	return easy;
}
예제 #2
0
파일: llcurl.cpp 프로젝트: HizWylder/GIS
LLCurl::Easy* LLCurl::Easy::getEasy()
{
	Easy* easy = new Easy();
	easy->mCurlEasyHandle = allocEasyHandle(); 
	
	if (!easy->mCurlEasyHandle)
	{
		// this can happen if we have too many open files (fails in c-ares/ares_init.c)
		llwarns << "allocEasyHandle() returned NULL! Easy handles: " << gCurlEasyCount << " Multi handles: " << gCurlMultiCount << llendl;
		delete easy;
		return NULL;
	}
	
	// set no DNS caching as default for all easy handles. This prevents them adopting a
	// multi handles cache if they are added to one.
	CURLcode result = curl_easy_setopt(easy->mCurlEasyHandle, CURLOPT_DNS_CACHE_TIMEOUT, 0);
	check_curl_code(result);
	
	++gCurlEasyCount;
	return easy;
}
예제 #3
0
LLCurl::Easy* LLCurl::Easy::getEasy()
{
	Easy* easy = new Easy();
	easy->mCurlEasyHandle = allocEasyHandle(); 
	
	if (!easy->mCurlEasyHandle)
	{
		// this can happen if we have too many open files (fails in c-ares/ares_init.c)
		llwarns << "allocEasyHandle() returned NULL! Easy handles: " << gCurlEasyCount << " Multi handles: " << gCurlMultiCount << llendl;
		delete easy;
		return NULL;
	}
	
	// set no DNS caching as default for all easy handles. This prevents them adopting a
	// multi handles cache if they are added to one.
	CURLcode result = curl_easy_setopt(easy->mCurlEasyHandle, CURLOPT_DNS_CACHE_TIMEOUT, 0);
	check_curl_code(result);
	
	if (LLSocks::getInstance()->isHttpProxyEnabled())
	{
		std::string address = LLSocks::getInstance()->getHTTPProxy().getIPString();
		U16 port = LLSocks::getInstance()->getHTTPProxy().getPort();
		curl_easy_setopt(easy->mCurlEasyHandle, CURLOPT_PROXY,address.c_str());
		curl_easy_setopt(easy->mCurlEasyHandle, CURLOPT_PROXYPORT,port);
		if (LLSocks::getInstance()->getHttpProxyType() == LLPROXY_SOCKS)
		{
			curl_easy_setopt(easy->mCurlEasyHandle, CURLOPT_PROXYTYPE, CURLPROXY_SOCKS5);
			if(LLSocks::getInstance()->getSelectedAuthMethod()==METHOD_PASSWORD)
				curl_easy_setopt(easy->mCurlEasyHandle, CURLOPT_PROXYUSERPWD,LLSocks::getInstance()->getProxyUserPwd().c_str());
		}
		else
		{
			curl_easy_setopt(easy->mCurlEasyHandle, CURLOPT_PROXYTYPE, CURLPROXY_HTTP);
		}
	}

	++gCurlEasyCount;
	return easy;
}