summaryrefslogtreecommitdiff
path: root/indra/llcorehttp
diff options
context:
space:
mode:
authorGraham Madarasz (Graham) <graham@lindenlab.com>2013-02-28 09:45:43 -0800
committerGraham Madarasz (Graham) <graham@lindenlab.com>2013-02-28 09:45:43 -0800
commit2dcbbf04c9375e2de877956476e0a58219a169cf (patch)
treef689fc4bfe9f89cf2bea4c61522af85f3e156577 /indra/llcorehttp
parentdf08808640031bd27a11177ea49a08f797d2d570 (diff)
Improve curl/ares init behavior by duping handles instead of calling easy_init
Diffstat (limited to 'indra/llcorehttp')
-rw-r--r--indra/llcorehttp/_httpoprequest.cpp30
-rw-r--r--indra/llcorehttp/_httpoprequest.h4
2 files changed, 10 insertions, 24 deletions
diff --git a/indra/llcorehttp/_httpoprequest.cpp b/indra/llcorehttp/_httpoprequest.cpp
index 51a8eaf998..469ce75434 100644
--- a/indra/llcorehttp/_httpoprequest.cpp
+++ b/indra/llcorehttp/_httpoprequest.cpp
@@ -339,7 +339,6 @@ void HttpOpRequest::setupCommon(HttpRequest::policy_t policy_id,
}
}
-
// Sets all libcurl options and data for a request.
//
// Used both for initial requests and to 'reload' for
@@ -381,13 +380,7 @@ HttpStatus HttpOpRequest::prepareRequest(HttpService * service)
// Get policy options
HttpPolicyGlobal & policy(service->getPolicy().getGlobalOptions());
- mCurlHandle = curl_easy_init();
- curl_easy_setopt(mCurlHandle, CURLOPT_IPRESOLVE, CURL_IPRESOLVE_V4);
- curl_easy_setopt(mCurlHandle, CURLOPT_NOSIGNAL, 1);
- curl_easy_setopt(mCurlHandle, CURLOPT_NOPROGRESS, 1);
- curl_easy_setopt(mCurlHandle, CURLOPT_URL, mReqURL.c_str());
- curl_easy_setopt(mCurlHandle, CURLOPT_PRIVATE, this);
- curl_easy_setopt(mCurlHandle, CURLOPT_ENCODING, "");
+ mCurlHandle = LLCurlHandleHandler::getInstance()->CreateCurlHandle();
if (HTTP_ENABLE_LINKSYS_WRT54G_V5_DNS_FIX)
{
@@ -399,23 +392,14 @@ HttpStatus HttpOpRequest::prepareRequest(HttpService * service)
// seconds and no RSTs.
curl_easy_setopt(mCurlHandle, CURLOPT_DNS_CACHE_TIMEOUT, 15);
}
- else
- {
- // *TODO: Revisit this old DNS timeout setting - may no longer be valid
- // I don't think this is valid anymore, the Multi shared DNS
- // cache is working well. For the case of naked easy handles,
- // consider using a shared DNS object.
- curl_easy_setopt(mCurlHandle, CURLOPT_DNS_CACHE_TIMEOUT, 0);
- }
- curl_easy_setopt(mCurlHandle, CURLOPT_AUTOREFERER, 1);
- curl_easy_setopt(mCurlHandle, CURLOPT_FOLLOWLOCATION, 1);
- curl_easy_setopt(mCurlHandle, CURLOPT_MAXREDIRS, HTTP_REDIRECTS_DEFAULT);
+
curl_easy_setopt(mCurlHandle, CURLOPT_WRITEFUNCTION, writeCallback);
- curl_easy_setopt(mCurlHandle, CURLOPT_WRITEDATA, this);
- curl_easy_setopt(mCurlHandle, CURLOPT_READFUNCTION, readCallback);
+ curl_easy_setopt(mCurlHandle, CURLOPT_READFUNCTION, readCallback);
curl_easy_setopt(mCurlHandle, CURLOPT_READDATA, this);
- curl_easy_setopt(mCurlHandle, CURLOPT_SSL_VERIFYPEER, 1);
- curl_easy_setopt(mCurlHandle, CURLOPT_SSL_VERIFYHOST, 0);
+ curl_easy_setopt(mCurlHandle, CURLOPT_WRITEDATA, this);
+ curl_easy_setopt(mCurlHandle, CURLOPT_URL, mReqURL.c_str());
+ curl_easy_setopt(mCurlHandle, CURLOPT_PRIVATE, this);
+ curl_easy_setopt(mCurlHandle, CURLOPT_MAXREDIRS, HTTP_REDIRECTS_DEFAULT);
const std::string * opt_value(NULL);
long opt_long(0L);
diff --git a/indra/llcorehttp/_httpoprequest.h b/indra/llcorehttp/_httpoprequest.h
index 7b65d17783..e819f74079 100644
--- a/indra/llcorehttp/_httpoprequest.h
+++ b/indra/llcorehttp/_httpoprequest.h
@@ -29,6 +29,7 @@
#include "linden_common.h" // Modifies curl/curl.h interfaces
+#include "llsingleton.h"
#include <string>
#include <curl/curl.h>
@@ -60,12 +61,13 @@ class HttpOptions;
/// the information needed to make a working request which can
/// then be enqueued to a request queue.
///
-
class HttpOpRequest : public HttpOperation
{
public:
HttpOpRequest();
+ friend class CurlHandleHandler;
+
protected:
virtual ~HttpOpRequest(); // Use release()