summaryrefslogtreecommitdiff
path: root/indra/llmessage
diff options
context:
space:
mode:
Diffstat (limited to 'indra/llmessage')
-rw-r--r--indra/llmessage/llcurl.cpp25
-rw-r--r--indra/llmessage/llcurl.h10
2 files changed, 32 insertions, 3 deletions
diff --git a/indra/llmessage/llcurl.cpp b/indra/llmessage/llcurl.cpp
index 6da153279c..5b9965680d 100644
--- a/indra/llmessage/llcurl.cpp
+++ b/indra/llmessage/llcurl.cpp
@@ -1813,10 +1813,10 @@ CURL* LLCurl::newEasyHandle()
}
sTotalHandles++;
- CURL* ret = curl_easy_init() ;
+ CURL* ret = LLCurlHandleHandler::getInstance()->CreateCurlHandle();
if(!ret)
{
- llwarns << "curl_easy_init failed." << llendl ;
+ llwarns << "failed to create curl handle." << llendl ;
}
return ret ;
@@ -1846,3 +1846,24 @@ void LLCurlFF::check_multi_code(CURLMcode code)
{
check_curl_multi_code(code);
}
+
+CURL* LLCurlHandleHandler::the_one_true_curl_handle;
+
+LLCurlHandleHandler::LLCurlHandleHandler()
+{
+ the_one_true_curl_handle = curl_easy_init();
+ curl_easy_setopt(the_one_true_curl_handle, CURLOPT_IPRESOLVE, CURL_IPRESOLVE_V4);
+ curl_easy_setopt(the_one_true_curl_handle, CURLOPT_NOSIGNAL, 1);
+ curl_easy_setopt(the_one_true_curl_handle, CURLOPT_NOPROGRESS, 1);
+ curl_easy_setopt(the_one_true_curl_handle, CURLOPT_ENCODING, "");
+ curl_easy_setopt(the_one_true_curl_handle, CURLOPT_AUTOREFERER, 1);
+ curl_easy_setopt(the_one_true_curl_handle, CURLOPT_FOLLOWLOCATION, 1);
+ curl_easy_setopt(the_one_true_curl_handle, CURLOPT_SSL_VERIFYPEER, 1);
+ curl_easy_setopt(the_one_true_curl_handle, CURLOPT_SSL_VERIFYHOST, 0);
+ curl_easy_setopt(the_one_true_curl_handle, CURLOPT_DNS_CACHE_TIMEOUT, 0);
+}
+
+CURL* LLCurlHandleHandler::CreateCurlHandle()
+{
+ return curl_easy_duphandle(the_one_true_curl_handle);
+}
diff --git a/indra/llmessage/llcurl.h b/indra/llmessage/llcurl.h
index 7bcf61e233..a03333157c 100644
--- a/indra/llmessage/llcurl.h
+++ b/indra/llmessage/llcurl.h
@@ -45,7 +45,7 @@
#include "llqueuedthread.h"
#include "llframetimer.h"
#include "llpointer.h"
-
+#include "llsingleton.h"
class LLMutex;
class LLCurlThread;
@@ -53,6 +53,14 @@ class LLCurlThread;
// For whatever reason, this is not typedef'd in curl.h
typedef size_t (*curl_header_callback)(void *ptr, size_t size, size_t nmemb, void *stream);
+class LLCurlHandleHandler : public LLSingleton<LLCurlHandleHandler>
+{
+public:
+ static CURL* the_one_true_curl_handle;
+ LLCurlHandleHandler();
+ static CURL* CreateCurlHandle();
+};
+
class LLCurl
{
LOG_CLASS(LLCurl);