summaryrefslogtreecommitdiff
path: root/indra/llmessage
diff options
context:
space:
mode:
authorChristian Goetze <cg@lindenlab.com>2007-12-01 01:29:28 +0000
committerChristian Goetze <cg@lindenlab.com>2007-12-01 01:29:28 +0000
commit7b7dd4e6f61aa731ef7f9f255014f5b76d5b9fec (patch)
tree08bf4cb9354f975940b83cd695a2aa8bb8d74870 /indra/llmessage
parent5c53c187fff573ef73a643949b3bded1084b0983 (diff)
svn merge -r74808:74832 svn+ssh://svn/svn/linden/branches/qa-dpo-9a
Diffstat (limited to 'indra/llmessage')
-rw-r--r--indra/llmessage/llservicebuilder.cpp99
-rw-r--r--indra/llmessage/llurlrequest.cpp1
-rw-r--r--indra/llmessage/llurlrequest.h2
-rw-r--r--indra/llmessage/message.cpp11
-rw-r--r--indra/llmessage/message.h7
5 files changed, 120 insertions, 0 deletions
diff --git a/indra/llmessage/llservicebuilder.cpp b/indra/llmessage/llservicebuilder.cpp
index 4fb3530c15..22e5c4af43 100644
--- a/indra/llmessage/llservicebuilder.cpp
+++ b/indra/llmessage/llservicebuilder.cpp
@@ -116,6 +116,104 @@ std::string LLServiceBuilder::buildServiceURI(
// Find the Service Name
if(!service_url.empty() && option_map.isMap())
{
+ // throw in a ridiculously large limiter to make sure we don't
+ // loop forever with bad input.
+ int iterations = 100;
+ bool keep_looping = true;
+ while(keep_looping)
+ {
+ if(0 == --iterations)
+ {
+ keep_looping = false;
+ }
+
+ int depth = 0;
+ int deepest = 0;
+ bool find_match = false;
+ std::string::iterator iter(service_url.begin());
+ std::string::iterator end(service_url.end());
+ std::string::iterator deepest_node(service_url.end());
+ std::string::iterator deepest_node_end(service_url.end());
+ for(; iter != end; ++iter)
+ {
+ switch(*iter)
+ {
+ case '{':
+ ++depth;
+ if(depth > deepest)
+ {
+ deepest = depth;
+ deepest_node = iter;
+ find_match = true;
+ }
+ break;
+ case '}':
+ --depth;
+ if(find_match)
+ {
+ deepest_node_end = iter;
+ find_match = false;
+ }
+ break;
+ default:
+ break;
+ }
+ }
+ if((deepest_node == end) || (deepest_node_end == end))
+ {
+ break;
+ }
+
+ // *NOTE: since the c++ implementation only understands
+ // params and straight string substitution, so it's a
+ // known distance of 2 to skip the directive.
+ std::string key(deepest_node + 2, deepest_node_end);
+ LLSD value = option_map[key];
+ switch(*(deepest_node + 1))
+ {
+ case '$':
+ if(value.isDefined())
+ {
+ service_url.replace(
+ deepest_node,
+ deepest_node_end + 1,
+ value.asString());
+ }
+ else
+ {
+ llinfos << "Unknown key: " << key << llendl;
+ keep_looping = false;
+ }
+ break;
+ case '%':
+ {
+ std::string query_str = LLURI::mapToQueryString(value);
+ service_url.replace(
+ deepest_node,
+ deepest_node_end + 1,
+ query_str);
+ }
+ break;
+ default:
+ llinfos << "Unknown directive: " << *(deepest_node + 1)
+ << llendl;
+ keep_looping = false;
+ break;
+ }
+ }
+ }
+ if (service_url.find('{') != std::string::npos)
+ {
+ llwarns << "Constructed a likely bogus service URL: " << service_url
+ << llendl;
+ }
+ return service_url;
+}
+
+
+
+// Old, not as good implementation. Phoenix 2007-10-15
+#if 0
// Do brace replacements - NOT CURRENTLY RECURSIVE
for(LLSD::map_const_iterator option_itr = option_map.beginMap();
option_itr != option_map.endMap();
@@ -157,3 +255,4 @@ std::string LLServiceBuilder::buildServiceURI(
return service_url;
}
+#endif
diff --git a/indra/llmessage/llurlrequest.cpp b/indra/llmessage/llurlrequest.cpp
index 857f804859..6a09a8bbec 100644
--- a/indra/llmessage/llurlrequest.cpp
+++ b/indra/llmessage/llurlrequest.cpp
@@ -480,6 +480,7 @@ bool LLURLRequest::configure()
mDetail->mHeaders);
}
curl_easy_setopt(mDetail->mCurl, CURLOPT_URL, mDetail->mURL);
+ lldebugs << "URL: " << mDetail->mURL << llendl;
curl_multi_add_handle(mDetail->mCurlMulti, mDetail->mCurl);
mDetail->mNeedToRemoveEasyHandle = true;
}
diff --git a/indra/llmessage/llurlrequest.h b/indra/llmessage/llurlrequest.h
index f335316ab6..7cb6b6a618 100644
--- a/indra/llmessage/llurlrequest.h
+++ b/indra/llmessage/llurlrequest.h
@@ -42,6 +42,7 @@
#include <string>
#include "lliopipe.h"
#include "llchainio.h"
+#include "llerror.h"
class LLURLRequestDetail;
@@ -62,6 +63,7 @@ class LLURLRequestComplete;
*/
class LLURLRequest : public LLIOPipe
{
+ LOG_CLASS(LLURLRequest);
public:
/**
* @brief This enumeration is for specifying the type of request.
diff --git a/indra/llmessage/message.cpp b/indra/llmessage/message.cpp
index d446730c33..a1b63ead75 100644
--- a/indra/llmessage/message.cpp
+++ b/indra/llmessage/message.cpp
@@ -1100,6 +1100,17 @@ void LLMessageSystem::forwardReliable(const U32 circuit_code)
sendReliable(findHost(circuit_code));
}
+S32 LLMessageSystem::forwardReliable( const LLHost &host,
+ S32 retries,
+ BOOL ping_based_timeout,
+ F32 timeout,
+ void (*callback)(void **,S32),
+ void ** callback_data)
+{
+ copyMessageRtoS();
+ return sendReliable(host, retries, ping_based_timeout, timeout, callback, callback_data);
+}
+
S32 LLMessageSystem::flushSemiReliable(const LLHost &host, void (*callback)(void **,S32), void ** callback_data)
{
F32 timeout;
diff --git a/indra/llmessage/message.h b/indra/llmessage/message.h
index 3381ece222..4debcddf99 100644
--- a/indra/llmessage/message.h
+++ b/indra/llmessage/message.h
@@ -464,6 +464,13 @@ public:
void forwardMessage(const LLHost &host);
void forwardReliable(const LLHost &host);
void forwardReliable(const U32 circuit_code);
+ S32 forwardReliable(
+ const LLHost &host,
+ S32 retries,
+ BOOL ping_based_timeout,
+ F32 timeout,
+ void (*callback)(void **,S32),
+ void ** callback_data);
LLHTTPClient::ResponderPtr createResponder(const std::string& name);
S32 sendMessage(const LLHost &host);