summaryrefslogtreecommitdiff
path: root/indra/llmessage
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
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')
-rw-r--r--indra/llmessage/llhttpclient.cpp40
-rw-r--r--indra/llmessage/llhttpclient.h2
-rw-r--r--indra/llmessage/llmessageconfig.cpp16
-rw-r--r--indra/llmessage/llmessageconfig.h2
-rw-r--r--indra/llmessage/llservicebuilder.cpp19
5 files changed, 75 insertions, 4 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.
diff --git a/indra/llmessage/llhttpclient.h b/indra/llmessage/llhttpclient.h
index 447bd691ba..e3074ee707 100644
--- a/indra/llmessage/llhttpclient.h
+++ b/indra/llmessage/llhttpclient.h
@@ -59,7 +59,9 @@ public:
typedef boost::intrusive_ptr<Responder> ResponderPtr;
static void get(const std::string& url, ResponderPtr, const F32 timeout=HTTP_REQUEST_EXPIRY_SECS);
+ static void get(const std::string& url, ResponderPtr, const LLSD& headers, const F32 timeout=HTTP_REQUEST_EXPIRY_SECS);
static void get(const std::string& url, const LLSD& query, ResponderPtr, const F32 timeout=HTTP_REQUEST_EXPIRY_SECS);
+ static void get(const std::string& url, const LLSD& query, ResponderPtr, const LLSD& headers, const F32 timeout=HTTP_REQUEST_EXPIRY_SECS);
static void put(const std::string& url, const LLSD& body, ResponderPtr, const F32 timeout=HTTP_REQUEST_EXPIRY_SECS);
///< non-blocking
static void post(const std::string& url, const LLSD& body, ResponderPtr, const F32 timeout=HTTP_REQUEST_EXPIRY_SECS);
diff --git a/indra/llmessage/llmessageconfig.cpp b/indra/llmessage/llmessageconfig.cpp
index dd2d725d32..25bdc9fb16 100644
--- a/indra/llmessage/llmessageconfig.cpp
+++ b/indra/llmessage/llmessageconfig.cpp
@@ -232,3 +232,19 @@ bool LLMessageConfig::isCapBanned(const std::string& cap_name)
{
return LLMessageConfigFile::instance().isCapBanned(cap_name);
}
+
+// return the web-service path to use for a given
+// message. This entry *should* match the entry
+// in simulator.xml!
+LLSD LLMessageConfig::getConfigForMessage(const std::string& msg_name)
+{
+ if (sServerName.empty())
+ {
+ llerrs << "LLMessageConfig::isMessageTrusted(name) before"
+ << " LLMessageConfig::initClass()" << llendl;
+ }
+ LLMessageConfigFile& file = LLMessageConfigFile::instance();
+ // LLSD for the CamelCase message name
+ LLSD config = file.mMessages[msg_name];
+ return config;
+}
diff --git a/indra/llmessage/llmessageconfig.h b/indra/llmessage/llmessageconfig.h
index a99cdc46fa..9cc20fe98b 100644
--- a/indra/llmessage/llmessageconfig.h
+++ b/indra/llmessage/llmessageconfig.h
@@ -10,6 +10,7 @@
#define LL_MESSAGECONFIG_H
#include <string>
+#include "llsd.h"
class LLSD;
@@ -30,5 +31,6 @@ public:
static SenderTrust getSenderTrustedness(const std::string& msg_name);
static bool isValidMessage(const std::string& msg_name);
static bool isCapBanned(const std::string& cap_name);
+ static LLSD getConfigForMessage(const std::string& msg_name);
};
#endif // LL_MESSAGECONFIG_H
diff --git a/indra/llmessage/llservicebuilder.cpp b/indra/llmessage/llservicebuilder.cpp
index 8c34a506de..806a888b2b 100644
--- a/indra/llmessage/llservicebuilder.cpp
+++ b/indra/llmessage/llservicebuilder.cpp
@@ -89,7 +89,7 @@ std::string LLServiceBuilder::buildServiceURI(
const LLSD& option_map)
{
std::string service_url = buildServiceURI(service_name);
-
+
// Find the Service Name
if(!service_url.empty() && option_map.isMap())
{
@@ -108,6 +108,23 @@ std::string LLServiceBuilder::buildServiceURI(
find_pos,
variable_name.length(),
(*option_itr).second.asString());
+ continue;
+ }
+ variable_name.assign("{%");
+ variable_name.append((*option_itr).first);
+ variable_name.append("}");
+ find_pos = service_url.find(variable_name);
+ if(find_pos != std::string::npos)
+ {
+ std::string query_str = LLURI::mapToQueryString(
+ (*option_itr).second);
+ if(!query_str.empty())
+ {
+ service_url.replace(
+ find_pos,
+ variable_name.length(),
+ query_str);
+ }
}
}
}