summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--indra/llcommon/lluri.cpp35
-rw-r--r--indra/llcommon/lluri.h3
-rw-r--r--indra/llmessage/llhttpclient.cpp20
3 files changed, 53 insertions, 5 deletions
diff --git a/indra/llcommon/lluri.cpp b/indra/llcommon/lluri.cpp
index a2c651b444..bf0d2cb21e 100644
--- a/indra/llcommon/lluri.cpp
+++ b/indra/llcommon/lluri.cpp
@@ -279,6 +279,23 @@ LLURI LLURI::buildBulkAgentPresenceURI(LLApp* app)
}
// static
+LLURI LLURI::buildBulkAgentNamesURI(LLApp* app)
+{
+ std::string host = "localhost:12040";
+
+ if (app)
+ {
+ host = app->getOption("backbone-host-port").asString();
+ }
+
+ LLSD path = LLSD::emptyArray();
+ path.append("agent");
+ path.append("names");
+
+ return buildHTTP(host, path);
+}
+
+// static
LLURI LLURI::buildAgentSessionURI(const LLUUID& agent_id, LLApp* app)
{
return buildBackboneURL(app, "agent", agent_id.asString(), "session");
@@ -304,6 +321,24 @@ LLURI LLURI::buildInventoryHostURI(const LLUUID& agent_id, LLApp* app)
}
// static
+LLURI LLURI::buildAgentNameURI(const LLUUID& agent_id, LLApp* app)
+{
+ std::string host = "localhost:12040";
+
+ if (app)
+ {
+ host = app->getOption("backbone-host-port").asString();
+ }
+
+ LLSD path = LLSD::emptyArray();
+ path.append("agent");
+ path.append(agent_id);
+ path.append("name");
+
+ return buildHTTP(host, path);
+}
+
+// static
LLURI LLURI::buildAgentLoginInfoURI(const LLUUID& agent_id, const std::string& dataserver)
{
LLSD path = LLSD::emptyArray();
diff --git a/indra/llcommon/lluri.h b/indra/llcommon/lluri.h
index b5c3a84173..865a3b21a0 100644
--- a/indra/llcommon/lluri.h
+++ b/indra/llcommon/lluri.h
@@ -79,10 +79,11 @@ public:
// Functions for building specific URIs for web services
static LLURI buildAgentPresenceURI(const LLUUID& agent_id, LLApp* app);
static LLURI buildBulkAgentPresenceURI(LLApp* app);
+ static LLURI buildBulkAgentNamesURI(LLApp* app);
static LLURI buildAgentSessionURI(const LLUUID& agent_id, LLApp* app);
static LLURI buildAgentLoginInfoURI(const LLUUID& agent_id, const std::string& dataserver);
static LLURI buildInventoryHostURI(const LLUUID& agent_id, LLApp* app);
-
+ static LLURI buildAgentNameURI(const LLUUID& agent_id, LLApp* app);
private:
std::string mScheme;
std::string mEscapedOpaque;
diff --git a/indra/llmessage/llhttpclient.cpp b/indra/llmessage/llhttpclient.cpp
index f93a12b274..0929f93dc1 100644
--- a/indra/llmessage/llhttpclient.cpp
+++ b/indra/llmessage/llhttpclient.cpp
@@ -265,11 +265,19 @@ public:
LLSD asLLSD()
{
LLSD content;
+
+ if (mBuffer.empty()) return content;
+
std::istringstream istr(mBuffer);
LLSDSerialize::fromXML(content, istr);
return content;
}
+ std::string asString()
+ {
+ return mBuffer;
+ }
+
private:
std::string mBuffer;
};
@@ -298,15 +306,20 @@ LLSD LLHTTPClient::blockingGet(const std::string& url)
S32 http_status = 499;
curl_easy_getinfo(curlp,CURLINFO_RESPONSE_CODE, &http_status);
+ response["status"] = http_status;
+
if (curl_success != 0
&& http_status != 404) // We expect 404s, don't spam for them.
{
llwarns << "CURL ERROR: " << curl_error_buffer << llendl;
+
+ response["body"] = http_buffer.asString();
+ }
+ else
+ {
+ response["body"] = http_buffer.asLLSD();
}
- response["status"] = http_status;
- response["body"] = http_buffer.asLLSD();
-
curl_easy_cleanup(curlp);
return response;
@@ -375,4 +388,3 @@ namespace boost
}
}
};
-