summaryrefslogtreecommitdiff
path: root/indra/llcorehttp/httprequest.cpp
diff options
context:
space:
mode:
authorJames Johnson <jj@lindenlab.com>2014-02-26 10:16:07 -0800
committerJames Johnson <jj@lindenlab.com>2014-02-26 10:16:07 -0800
commit556506278ab870f5ac190d25a991511b74074325 (patch)
tree110e83685b598e30502e7abd9c6f31cfa6b3a507 /indra/llcorehttp/httprequest.cpp
parent0abdab7848b6fb02c2600e74774426acc6bf5ef6 (diff)
parentde8fea13627cc5978b8a6135802a52864a11c39a (diff)
Merged lindenlab/viewer-release into default
Diffstat (limited to 'indra/llcorehttp/httprequest.cpp')
-rwxr-xr-xindra/llcorehttp/httprequest.cpp107
1 files changed, 62 insertions, 45 deletions
diff --git a/indra/llcorehttp/httprequest.cpp b/indra/llcorehttp/httprequest.cpp
index 9b739a8825..7b1888e3eb 100755
--- a/indra/llcorehttp/httprequest.cpp
+++ b/indra/llcorehttp/httprequest.cpp
@@ -4,7 +4,7 @@
*
* $LicenseInfo:firstyear=2012&license=viewerlgpl$
* Second Life Viewer Source Code
- * Copyright (C) 2012, Linden Research, Inc.
+ * Copyright (C) 2012-2013, Linden Research, Inc.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
@@ -54,12 +54,8 @@ namespace LLCore
// ====================================
-HttpRequest::policy_t HttpRequest::sNextPolicyID(1);
-
-
HttpRequest::HttpRequest()
- : //HttpHandler(),
- mReplyQueue(NULL),
+ : mReplyQueue(NULL),
mRequestQueue(NULL)
{
mRequestQueue = HttpRequestQueue::instanceOf();
@@ -90,45 +86,91 @@ HttpRequest::~HttpRequest()
// ====================================
-HttpStatus HttpRequest::setPolicyGlobalOption(EGlobalPolicy opt, long value)
+HttpRequest::policy_t HttpRequest::createPolicyClass()
{
if (HttpService::RUNNING == HttpService::instanceOf()->getState())
{
- return HttpStatus(HttpStatus::LLCORE, HE_OPT_NOT_DYNAMIC);
+ return 0;
}
- return HttpService::instanceOf()->getGlobalOptions().set(opt, value);
+ return HttpService::instanceOf()->createPolicyClass();
}
-HttpStatus HttpRequest::setPolicyGlobalOption(EGlobalPolicy opt, const std::string & value)
+HttpStatus HttpRequest::setStaticPolicyOption(EPolicyOption opt, policy_t pclass,
+ long value, long * ret_value)
{
if (HttpService::RUNNING == HttpService::instanceOf()->getState())
{
return HttpStatus(HttpStatus::LLCORE, HE_OPT_NOT_DYNAMIC);
}
- return HttpService::instanceOf()->getGlobalOptions().set(opt, value);
+ return HttpService::instanceOf()->setPolicyOption(opt, pclass, value, ret_value);
}
-HttpRequest::policy_t HttpRequest::createPolicyClass()
+HttpStatus HttpRequest::setStaticPolicyOption(EPolicyOption opt, policy_t pclass,
+ const std::string & value, std::string * ret_value)
{
if (HttpService::RUNNING == HttpService::instanceOf()->getState())
{
- return 0;
+ return HttpStatus(HttpStatus::LLCORE, HE_OPT_NOT_DYNAMIC);
}
- return HttpService::instanceOf()->createPolicyClass();
+ return HttpService::instanceOf()->setPolicyOption(opt, pclass, value, ret_value);
}
-HttpStatus HttpRequest::setPolicyClassOption(policy_t policy_id,
- EClassPolicy opt,
- long value)
+HttpHandle HttpRequest::setPolicyOption(EPolicyOption opt, policy_t pclass,
+ long value, HttpHandler * handler)
{
- if (HttpService::RUNNING == HttpService::instanceOf()->getState())
+ HttpStatus status;
+ HttpHandle handle(LLCORE_HTTP_HANDLE_INVALID);
+
+ HttpOpSetGet * op = new HttpOpSetGet();
+ if (! (status = op->setupSet(opt, pclass, value)))
{
- return HttpStatus(HttpStatus::LLCORE, HE_OPT_NOT_DYNAMIC);
+ op->release();
+ mLastReqStatus = status;
+ return handle;
+ }
+ op->setReplyPath(mReplyQueue, handler);
+ if (! (status = mRequestQueue->addOp(op))) // transfers refcount
+ {
+ op->release();
+ mLastReqStatus = status;
+ return handle;
+ }
+
+ mLastReqStatus = status;
+ handle = static_cast<HttpHandle>(op);
+
+ return handle;
+}
+
+
+HttpHandle HttpRequest::setPolicyOption(EPolicyOption opt, policy_t pclass,
+ const std::string & value, HttpHandler * handler)
+{
+ HttpStatus status;
+ HttpHandle handle(LLCORE_HTTP_HANDLE_INVALID);
+
+ HttpOpSetGet * op = new HttpOpSetGet();
+ if (! (status = op->setupSet(opt, pclass, value)))
+ {
+ op->release();
+ mLastReqStatus = status;
+ return handle;
+ }
+ op->setReplyPath(mReplyQueue, handler);
+ if (! (status = mRequestQueue->addOp(op))) // transfers refcount
+ {
+ op->release();
+ mLastReqStatus = status;
+ return handle;
}
- return HttpService::instanceOf()->getClassOptions(policy_id).set(opt, value);
+
+ mLastReqStatus = status;
+ handle = static_cast<HttpHandle>(op);
+
+ return handle;
}
@@ -474,31 +516,6 @@ HttpHandle HttpRequest::requestSpin(int mode)
return handle;
}
-// ====================================
-// Dynamic Policy Methods
-// ====================================
-
-HttpHandle HttpRequest::requestSetHttpProxy(const std::string & proxy, HttpHandler * handler)
-{
- HttpStatus status;
- HttpHandle handle(LLCORE_HTTP_HANDLE_INVALID);
-
- HttpOpSetGet * op = new HttpOpSetGet();
- op->setupSet(GP_HTTP_PROXY, proxy);
- op->setReplyPath(mReplyQueue, handler);
- if (! (status = mRequestQueue->addOp(op))) // transfers refcount
- {
- op->release();
- mLastReqStatus = status;
- return handle;
- }
-
- mLastReqStatus = status;
- handle = static_cast<HttpHandle>(op);
-
- return handle;
-}
-
} // end namespace LLCore