summaryrefslogtreecommitdiff
path: root/indra/llmessage/llhttpclient.cpp
diff options
context:
space:
mode:
authorKartic Krishnamurthy <drunkensufi@lindenlab.com>2007-07-18 01:28:59 +0000
committerKartic Krishnamurthy <drunkensufi@lindenlab.com>2007-07-18 01:28:59 +0000
commite1ab7d8a30cc40cbd1d471c67def21508c82ff49 (patch)
tree3f834cc8207ea481f6caf820738c8cbf5388bc9a /indra/llmessage/llhttpclient.cpp
parent7964c6f7a5b622d698f7d471690b29122966b1b2 (diff)
svn merge -r63705:65463 svn+ssh://svn/svn/linden/branches/dpo-3-bug-fix
NOTE: r63705 is *not* the earliest rev# for dpo-3-bug-fix.
Diffstat (limited to 'indra/llmessage/llhttpclient.cpp')
-rw-r--r--indra/llmessage/llhttpclient.cpp40
1 files changed, 37 insertions, 3 deletions
diff --git a/indra/llmessage/llhttpclient.cpp b/indra/llmessage/llhttpclient.cpp
index 1bc6d742f1..c798e6473c 100644
--- a/indra/llmessage/llhttpclient.cpp
+++ b/indra/llmessage/llhttpclient.cpp
@@ -232,6 +232,7 @@ static void request(
LLURLRequest::ERequestAction method,
Injector* body_injector,
LLHTTPClient::ResponderPtr responder,
+ const LLSD& headers,
const F32 timeout=HTTP_REQUEST_EXPIRY_SECS)
{
if (!LLHTTPClient::hasPump())
@@ -243,6 +244,19 @@ static void request(
LLURLRequest *req = new LLURLRequest(method, url);
req->requestEncoding("");
+
+ if (headers.isMap())
+ {
+ LLSD::map_const_iterator iter = headers.beginMap();
+ LLSD::map_const_iterator end = headers.endMap();
+
+ for (; iter != end; ++iter)
+ {
+ std::ostringstream header;
+ header << iter->first << ": " << iter->second.asString() ;
+ req->addHeader(header.str().c_str());
+ }
+ }
if (!gCABundle.empty())
{
req->checkRootCertificate(true, gCABundle.c_str());
@@ -267,17 +281,37 @@ static void request(
theClientPump->addChain(chain, timeout);
}
+static void request(
+ const std::string& url,
+ LLURLRequest::ERequestAction method,
+ Injector* body_injector,
+ LLHTTPClient::ResponderPtr responder,
+ const F32 timeout=HTTP_REQUEST_EXPIRY_SECS)
+{
+ request(url, method, body_injector, responder, LLSD(), timeout);
+}
+
+void LLHTTPClient::get(const std::string& url, ResponderPtr responder, const LLSD& headers, const F32 timeout)
+{
+ request(url, LLURLRequest::HTTP_GET, NULL, responder, headers, timeout);
+}
+
void LLHTTPClient::get(const std::string& url, ResponderPtr responder, const F32 timeout)
{
- request(url, LLURLRequest::HTTP_GET, NULL, responder, timeout);
+ get(url, responder, LLSD(), timeout);
}
-void LLHTTPClient::get(const std::string& url, const LLSD& query, ResponderPtr responder, const F32 timeout)
+void LLHTTPClient::get(const std::string& url, const LLSD& query, ResponderPtr responder, const LLSD& headers, const F32 timeout)
{
LLURI uri;
uri = LLURI::buildHTTP(url, LLSD::emptyArray(), query);
- get(uri.asString(), responder, timeout);
+ get(uri.asString(), responder, headers, timeout);
+}
+
+void LLHTTPClient::get(const std::string& url, const LLSD& query, ResponderPtr responder, const F32 timeout)
+{
+ get(url, query, responder, LLSD(), timeout);
}
// A simple class for managing data returned from a curl http request.