summaryrefslogtreecommitdiff
path: root/indra/llcorehttp
diff options
context:
space:
mode:
authorRider Linden <rider@lindenlab.com>2015-07-08 12:09:36 -0700
committerRider Linden <rider@lindenlab.com>2015-07-08 12:09:36 -0700
commitfe5567639d7d4b6f13f66da0a1fb4bf2af295283 (patch)
treeba03f2211b8206ed7b1ade5dc6ffb84d11104be3 /indra/llcorehttp
parent1138c57f9a8553903199e727912d7f1b092697e4 (diff)
Change HttpOptions::ptr_t to be shared_ptr<> rather than intrusive.
Diffstat (limited to 'indra/llcorehttp')
-rwxr-xr-xindra/llcorehttp/_httpoprequest.cpp42
-rwxr-xr-xindra/llcorehttp/_httpoprequest.h23
-rwxr-xr-xindra/llcorehttp/examples/http_texture_load.cpp6
-rwxr-xr-xindra/llcorehttp/httpheaders.h2
-rwxr-xr-xindra/llcorehttp/httpoptions.cpp2
-rwxr-xr-xindra/llcorehttp/httpoptions.h7
-rwxr-xr-xindra/llcorehttp/httprequest.cpp28
-rwxr-xr-xindra/llcorehttp/httprequest.h31
8 files changed, 66 insertions, 75 deletions
diff --git a/indra/llcorehttp/_httpoprequest.cpp b/indra/llcorehttp/_httpoprequest.cpp
index 5d118a9afb..7baef25aca 100755
--- a/indra/llcorehttp/_httpoprequest.cpp
+++ b/indra/llcorehttp/_httpoprequest.cpp
@@ -123,7 +123,7 @@ HttpOpRequest::HttpOpRequest()
mReqOffset(0),
mReqLength(0),
mReqHeaders(),
- mReqOptions(NULL),
+ mReqOptions(),
mCurlActive(false),
mCurlHandle(NULL),
mCurlService(NULL),
@@ -156,12 +156,6 @@ HttpOpRequest::~HttpOpRequest()
mReqBody = NULL;
}
- if (mReqOptions)
- {
- mReqOptions->release();
- mReqOptions = NULL;
- }
-
if (mCurlHandle)
{
// Uncertain of thread context so free using
@@ -287,8 +281,8 @@ HttpStatus HttpOpRequest::cancel()
HttpStatus HttpOpRequest::setupGet(HttpRequest::policy_t policy_id,
HttpRequest::priority_t priority,
const std::string & url,
- HttpOptions * options,
- HttpHeaders::ptr_t &headers)
+ HttpOptions::ptr_t & options,
+ HttpHeaders::ptr_t & headers)
{
setupCommon(policy_id, priority, url, NULL, options, headers);
mReqMethod = HOR_GET;
@@ -302,8 +296,8 @@ HttpStatus HttpOpRequest::setupGetByteRange(HttpRequest::policy_t policy_id,
const std::string & url,
size_t offset,
size_t len,
- HttpOptions * options,
- HttpHeaders::ptr_t &headers)
+ HttpOptions::ptr_t & options,
+ HttpHeaders::ptr_t & headers)
{
setupCommon(policy_id, priority, url, NULL, options, headers);
mReqMethod = HOR_GET;
@@ -322,8 +316,8 @@ HttpStatus HttpOpRequest::setupPost(HttpRequest::policy_t policy_id,
HttpRequest::priority_t priority,
const std::string & url,
BufferArray * body,
- HttpOptions * options,
- HttpHeaders::ptr_t &headers)
+ HttpOptions::ptr_t & options,
+ HttpHeaders::ptr_t & headers)
{
setupCommon(policy_id, priority, url, body, options, headers);
mReqMethod = HOR_POST;
@@ -336,8 +330,8 @@ HttpStatus HttpOpRequest::setupPut(HttpRequest::policy_t policy_id,
HttpRequest::priority_t priority,
const std::string & url,
BufferArray * body,
- HttpOptions * options,
- HttpHeaders::ptr_t &headers)
+ HttpOptions::ptr_t & options,
+ HttpHeaders::ptr_t & headers)
{
setupCommon(policy_id, priority, url, body, options, headers);
mReqMethod = HOR_PUT;
@@ -349,8 +343,8 @@ HttpStatus HttpOpRequest::setupPut(HttpRequest::policy_t policy_id,
HttpStatus HttpOpRequest::setupDelete(HttpRequest::policy_t policy_id,
HttpRequest::priority_t priority,
const std::string & url,
- HttpOptions * options,
- HttpHeaders::ptr_t &headers)
+ HttpOptions::ptr_t & options,
+ HttpHeaders::ptr_t & headers)
{
setupCommon(policy_id, priority, url, NULL, options, headers);
mReqMethod = HOR_DELETE;
@@ -363,8 +357,8 @@ HttpStatus HttpOpRequest::setupPatch(HttpRequest::policy_t policy_id,
HttpRequest::priority_t priority,
const std::string & url,
BufferArray * body,
- HttpOptions * options,
- HttpHeaders::ptr_t &headers)
+ HttpOptions::ptr_t & options,
+ HttpHeaders::ptr_t & headers)
{
setupCommon(policy_id, priority, url, body, options, headers);
mReqMethod = HOR_PATCH;
@@ -376,7 +370,7 @@ HttpStatus HttpOpRequest::setupPatch(HttpRequest::policy_t policy_id,
HttpStatus HttpOpRequest::setupCopy(HttpRequest::policy_t policy_id,
HttpRequest::priority_t priority,
const std::string & url,
- HttpOptions * options,
+ HttpOptions::ptr_t & options,
HttpHeaders::ptr_t &headers)
{
setupCommon(policy_id, priority, url, NULL, options, headers);
@@ -390,8 +384,8 @@ void HttpOpRequest::setupCommon(HttpRequest::policy_t policy_id,
HttpRequest::priority_t priority,
const std::string & url,
BufferArray * body,
- HttpOptions * options,
- HttpHeaders::ptr_t &headers)
+ HttpOptions::ptr_t & options,
+ HttpHeaders::ptr_t & headers)
{
mProcFlags = 0U;
mReqPolicy = policy_id;
@@ -404,12 +398,10 @@ void HttpOpRequest::setupCommon(HttpRequest::policy_t policy_id,
}
if (headers && ! mReqHeaders)
{
- //headers->addRef();
mReqHeaders = headers;
}
- if (options && ! mReqOptions)
+ if (options && !mReqOptions)
{
- options->addRef();
mReqOptions = options;
if (options->getWantHeaders())
{
diff --git a/indra/llcorehttp/_httpoprequest.h b/indra/llcorehttp/_httpoprequest.h
index 0465c2b83f..42db71e7a0 100755
--- a/indra/llcorehttp/_httpoprequest.h
+++ b/indra/llcorehttp/_httpoprequest.h
@@ -42,14 +42,13 @@
#include "_refcounted.h"
#include "httpheaders.h"
+#include "httpoptions.h"
namespace LLCore
{
class BufferArray;
-class HttpHeaders;
-class HttpOptions;
/// HttpOpRequest requests a supported HTTP method invocation with
@@ -105,7 +104,7 @@ public:
HttpStatus setupGet(HttpRequest::policy_t policy_id,
HttpRequest::priority_t priority,
const std::string & url,
- HttpOptions * options,
+ HttpOptions::ptr_t & options,
HttpHeaders::ptr_t & headers);
HttpStatus setupGetByteRange(HttpRequest::policy_t policy_id,
@@ -113,40 +112,40 @@ public:
const std::string & url,
size_t offset,
size_t len,
- HttpOptions * options,
+ HttpOptions::ptr_t & options,
HttpHeaders::ptr_t & headers);
HttpStatus setupPost(HttpRequest::policy_t policy_id,
HttpRequest::priority_t priority,
const std::string & url,
BufferArray * body,
- HttpOptions * options,
+ HttpOptions::ptr_t & options,
HttpHeaders::ptr_t & headers);
HttpStatus setupPut(HttpRequest::policy_t policy_id,
HttpRequest::priority_t priority,
const std::string & url,
BufferArray * body,
- HttpOptions * options,
+ HttpOptions::ptr_t & options,
HttpHeaders::ptr_t & headers);
HttpStatus setupDelete(HttpRequest::policy_t policy_id,
HttpRequest::priority_t priority,
const std::string & url,
- HttpOptions * options,
+ HttpOptions::ptr_t & options,
HttpHeaders::ptr_t & headers);
HttpStatus setupPatch(HttpRequest::policy_t policy_id,
HttpRequest::priority_t priority,
const std::string & url,
BufferArray * body,
- HttpOptions * options,
+ HttpOptions::ptr_t & options,
HttpHeaders::ptr_t & headers);
HttpStatus setupCopy(HttpRequest::policy_t policy_id,
HttpRequest::priority_t priority,
const std::string & url,
- HttpOptions * options,
+ HttpOptions::ptr_t & options,
HttpHeaders::ptr_t & headers);
// Internal method used to setup the libcurl options for a request.
@@ -167,8 +166,8 @@ protected:
HttpRequest::priority_t priority,
const std::string & url,
BufferArray * body,
- HttpOptions * options,
- HttpHeaders::ptr_t &headers);
+ HttpOptions::ptr_t & options,
+ HttpHeaders::ptr_t & headers);
// libcurl operational callbacks
//
@@ -199,7 +198,7 @@ public:
off_t mReqOffset;
size_t mReqLength;
HttpHeaders::ptr_t mReqHeaders;
- HttpOptions * mReqOptions;
+ HttpOptions::ptr_t mReqOptions;
// Transport data
bool mCurlActive;
diff --git a/indra/llcorehttp/examples/http_texture_load.cpp b/indra/llcorehttp/examples/http_texture_load.cpp
index 9d9631b980..13c9f90b2e 100755
--- a/indra/llcorehttp/examples/http_texture_load.cpp
+++ b/indra/llcorehttp/examples/http_texture_load.cpp
@@ -83,7 +83,7 @@ public:
WorkingSet();
~WorkingSet();
- bool reload(LLCore::HttpRequest *, LLCore::HttpOptions *);
+ bool reload(LLCore::HttpRequest *, LLCore::HttpOptions::ptr_t &);
virtual void onCompleted(LLCore::HttpHandle handle, LLCore::HttpResponse * response);
@@ -304,7 +304,7 @@ int main(int argc, char** argv)
LLCore::HttpRequest * hr = new LLCore::HttpRequest();
// Get request options
- LLCore::HttpOptions * opt = new LLCore::HttpOptions();
+ LLCore::HttpOptions::ptr_t opt = LLCore::HttpOptions::ptr_t(new LLCore::HttpOptions());
opt->setRetries(12);
opt->setUseRetryAfter(true);
@@ -442,7 +442,7 @@ WorkingSet::~WorkingSet()
}
-bool WorkingSet::reload(LLCore::HttpRequest * hr, LLCore::HttpOptions * opt)
+bool WorkingSet::reload(LLCore::HttpRequest * hr, LLCore::HttpOptions::ptr_t & opt)
{
if (mRequestLowWater <= mHandles.size())
{
diff --git a/indra/llcorehttp/httpheaders.h b/indra/llcorehttp/httpheaders.h
index a97bae5537..b9168cb6ec 100755
--- a/indra/llcorehttp/httpheaders.h
+++ b/indra/llcorehttp/httpheaders.h
@@ -85,6 +85,7 @@ public:
typedef container_t::const_reverse_iterator const_reverse_iterator;
typedef container_t::value_type value_type;
typedef container_t::size_type size_type;
+ typedef boost::shared_ptr<HttpHeaders> ptr_t;
public:
/// @post In addition to the instance, caller has a refcount
@@ -94,7 +95,6 @@ public:
virtual ~HttpHeaders(); // Use release()
//typedef LLCoreInt::IntrusivePtr<HttpHeaders> ptr_t;
- typedef boost::shared_ptr<HttpHeaders> ptr_t;
protected:
HttpHeaders(const HttpHeaders &); // Not defined
diff --git a/indra/llcorehttp/httpoptions.cpp b/indra/llcorehttp/httpoptions.cpp
index 3459a37aff..aab447f2dd 100755
--- a/indra/llcorehttp/httpoptions.cpp
+++ b/indra/llcorehttp/httpoptions.cpp
@@ -33,7 +33,7 @@ namespace LLCore
{
-HttpOptions::HttpOptions() : RefCounted(true),
+HttpOptions::HttpOptions() :
mWantHeaders(false),
mTracing(HTTP_TRACE_OFF),
mTimeout(HTTP_REQUEST_TIMEOUT_DEFAULT),
diff --git a/indra/llcorehttp/httpoptions.h b/indra/llcorehttp/httpoptions.h
index 2fe05a65ff..510eaa45bb 100755
--- a/indra/llcorehttp/httpoptions.h
+++ b/indra/llcorehttp/httpoptions.h
@@ -55,15 +55,16 @@ namespace LLCore
/// Allocation: Refcounted, heap only. Caller of the constructor
/// is given a refcount.
///
-class HttpOptions : public LLCoreInt::RefCounted
+class HttpOptions : private boost::noncopyable
{
public:
HttpOptions();
- typedef LLCoreInt::IntrusivePtr<HttpOptions> ptr_t;
+ typedef boost::shared_ptr<HttpOptions> ptr_t;
+
+ virtual ~HttpOptions(); // Use release()
protected:
- virtual ~HttpOptions(); // Use release()
HttpOptions(const HttpOptions &); // Not defined
void operator=(const HttpOptions &); // Not defined
diff --git a/indra/llcorehttp/httprequest.cpp b/indra/llcorehttp/httprequest.cpp
index b5ea0b44b0..4a7352c962 100755
--- a/indra/llcorehttp/httprequest.cpp
+++ b/indra/llcorehttp/httprequest.cpp
@@ -197,8 +197,8 @@ HttpStatus HttpRequest::getStatus() const
HttpHandle HttpRequest::requestGet(policy_t policy_id,
priority_t priority,
const std::string & url,
- HttpOptions * options,
- HttpHeaders::ptr_t &headers,
+ HttpOptions::ptr_t & options,
+ HttpHeaders::ptr_t & headers,
HttpHandler * user_handler)
{
HttpStatus status;
@@ -231,8 +231,8 @@ HttpHandle HttpRequest::requestGetByteRange(policy_t policy_id,
const std::string & url,
size_t offset,
size_t len,
- HttpOptions * options,
- HttpHeaders::ptr_t &headers,
+ HttpOptions::ptr_t & options,
+ HttpHeaders::ptr_t & headers,
HttpHandler * user_handler)
{
HttpStatus status;
@@ -264,8 +264,8 @@ HttpHandle HttpRequest::requestPost(policy_t policy_id,
priority_t priority,
const std::string & url,
BufferArray * body,
- HttpOptions * options,
- HttpHeaders::ptr_t &headers,
+ HttpOptions::ptr_t & options,
+ HttpHeaders::ptr_t & headers,
HttpHandler * user_handler)
{
HttpStatus status;
@@ -297,8 +297,8 @@ HttpHandle HttpRequest::requestPut(policy_t policy_id,
priority_t priority,
const std::string & url,
BufferArray * body,
- HttpOptions * options,
- HttpHeaders::ptr_t &headers,
+ HttpOptions::ptr_t & options,
+ HttpHeaders::ptr_t & headers,
HttpHandler * user_handler)
{
HttpStatus status;
@@ -328,8 +328,8 @@ HttpHandle HttpRequest::requestPut(policy_t policy_id,
HttpHandle HttpRequest::requestDelete(policy_t policy_id,
priority_t priority,
const std::string & url,
- HttpOptions * options,
- HttpHeaders::ptr_t &headers,
+ HttpOptions::ptr_t & options,
+ HttpHeaders::ptr_t & headers,
HttpHandler * user_handler)
{
HttpStatus status;
@@ -360,8 +360,8 @@ HttpHandle HttpRequest::requestPatch(policy_t policy_id,
priority_t priority,
const std::string & url,
BufferArray * body,
- HttpOptions * options,
- HttpHeaders::ptr_t &headers,
+ HttpOptions::ptr_t & options,
+ HttpHeaders::ptr_t & headers,
HttpHandler * user_handler)
{
HttpStatus status;
@@ -391,8 +391,8 @@ HttpHandle HttpRequest::requestPatch(policy_t policy_id,
HttpHandle HttpRequest::requestCopy(policy_t policy_id,
priority_t priority,
const std::string & url,
- HttpOptions * options,
- HttpHeaders::ptr_t &headers,
+ HttpOptions::ptr_t & options,
+ HttpHeaders::ptr_t & headers,
HttpHandler * user_handler)
{
HttpStatus status;
diff --git a/indra/llcorehttp/httprequest.h b/indra/llcorehttp/httprequest.h
index c0622372e1..58aea1444c 100755
--- a/indra/llcorehttp/httprequest.h
+++ b/indra/llcorehttp/httprequest.h
@@ -32,6 +32,7 @@
#include "httphandler.h"
#include "httpheaders.h"
+#include "httpoptions.h"
namespace LLCore
{
@@ -39,8 +40,6 @@ namespace LLCore
class HttpRequestQueue;
class HttpReplyQueue;
class HttpService;
-class HttpOptions;
-class HttpHeaders;
class HttpOperation;
class BufferArray;
@@ -349,8 +348,8 @@ public:
HttpHandle requestGet(policy_t policy_id,
priority_t priority,
const std::string & url,
- HttpOptions * options,
- HttpHeaders::ptr_t &headers,
+ HttpOptions::ptr_t & options,
+ HttpHeaders::ptr_t & headers,
HttpHandler * handler);
@@ -392,8 +391,8 @@ public:
const std::string & url,
size_t offset,
size_t len,
- HttpOptions * options,
- HttpHeaders::ptr_t &headers,
+ HttpOptions::ptr_t & options,
+ HttpHeaders::ptr_t & headers,
HttpHandler * handler);
@@ -433,8 +432,8 @@ public:
priority_t priority,
const std::string & url,
BufferArray * body,
- HttpOptions * options,
- HttpHeaders::ptr_t &headers,
+ HttpOptions::ptr_t & options,
+ HttpHeaders::ptr_t & headers,
HttpHandler * handler);
@@ -474,8 +473,8 @@ public:
priority_t priority,
const std::string & url,
BufferArray * body,
- HttpOptions * options,
- HttpHeaders::ptr_t &headers,
+ HttpOptions::ptr_t & options,
+ HttpHeaders::ptr_t & headers,
HttpHandler * handler);
@@ -494,8 +493,8 @@ public:
HttpHandle requestDelete(policy_t policy_id,
priority_t priority,
const std::string & url,
- HttpOptions * options,
- HttpHeaders::ptr_t &headers,
+ HttpOptions::ptr_t & options,
+ HttpHeaders::ptr_t & headers,
HttpHandler * user_handler);
/// Queue a full HTTP PUT. Query arguments and body may
@@ -517,8 +516,8 @@ public:
priority_t priority,
const std::string & url,
BufferArray * body,
- HttpOptions * options,
- HttpHeaders::ptr_t &headers,
+ HttpOptions::ptr_t & options,
+ HttpHeaders::ptr_t & headers,
HttpHandler * user_handler);
/// Queue a full HTTP PUT. Query arguments and body may
@@ -536,8 +535,8 @@ public:
HttpHandle requestCopy(policy_t policy_id,
priority_t priority,
const std::string & url,
- HttpOptions * options,
- HttpHeaders::ptr_t &headers,
+ HttpOptions::ptr_t & options,
+ HttpHeaders::ptr_t & headers,
HttpHandler * user_handler);
/// Queue a NoOp request.