aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/linden/indra/llcommon
diff options
context:
space:
mode:
authorJacek Antonelli2008-08-15 23:44:56 -0500
committerJacek Antonelli2008-08-15 23:44:56 -0500
commitc07901e29ed545bbb02e3bddf148fe1104b94e9f (patch)
treef1ada64ce834acd7d92a425efb96c4b86bcf16b1 /linden/indra/llcommon
parentSecond Life viewer sources 1.15.0.2 (diff)
downloadmeta-impy-c07901e29ed545bbb02e3bddf148fe1104b94e9f.zip
meta-impy-c07901e29ed545bbb02e3bddf148fe1104b94e9f.tar.gz
meta-impy-c07901e29ed545bbb02e3bddf148fe1104b94e9f.tar.bz2
meta-impy-c07901e29ed545bbb02e3bddf148fe1104b94e9f.tar.xz
Second Life viewer sources 1.15.1.3
Diffstat (limited to 'linden/indra/llcommon')
-rw-r--r--linden/indra/llcommon/llstat.cpp6
-rw-r--r--linden/indra/llcommon/llstring.h2
-rw-r--r--linden/indra/llcommon/llstringtable.h6
-rw-r--r--linden/indra/llcommon/lluri.cpp84
-rw-r--r--linden/indra/llcommon/lluri.h2
-rw-r--r--linden/indra/llcommon/llversion.h4
6 files changed, 74 insertions, 30 deletions
diff --git a/linden/indra/llcommon/llstat.cpp b/linden/indra/llcommon/llstat.cpp
index 4e43923..7e6090f 100644
--- a/linden/indra/llcommon/llstat.cpp
+++ b/linden/indra/llcommon/llstat.cpp
@@ -119,9 +119,9 @@ void LLStatAccum::impl::sum(F64 value, U64 when)
119 } 119 }
120 if (when < mLastTime) 120 if (when < mLastTime)
121 { 121 {
122 // JAMESDEBUG spams on Athlon 122 // This happens a LOT on some dual core systems.
123 //llwarns << "LLStatAccum::sum clock has gone backwards from " 123 lldebugs << "LLStatAccum::sum clock has gone backwards from "
124 // << mLastTime << " to " << when << ", resetting" << llendl; 124 << mLastTime << " to " << when << ", resetting" << llendl;
125 125
126 reset(when); 126 reset(when);
127 return; 127 return;
diff --git a/linden/indra/llcommon/llstring.h b/linden/indra/llcommon/llstring.h
index d901e61..8a2c24c 100644
--- a/linden/indra/llcommon/llstring.h
+++ b/linden/indra/llcommon/llstring.h
@@ -1043,7 +1043,7 @@ void LLStringBase<T>::copyInto(std::basic_string<T>& dst, const std::basic_strin
1043 } 1043 }
1044 else 1044 else
1045 { 1045 {
1046 LLWString tail = dst.substr(offset); 1046 std::basic_string<T> tail = dst.substr(offset);
1047 1047
1048 dst = dst.substr(0, offset); 1048 dst = dst.substr(0, offset);
1049 dst += src; 1049 dst += src;
diff --git a/linden/indra/llcommon/llstringtable.h b/linden/indra/llcommon/llstringtable.h
index 337d937..8d91680 100644
--- a/linden/indra/llcommon/llstringtable.h
+++ b/linden/indra/llcommon/llstringtable.h
@@ -48,12 +48,6 @@
48#include <hash_map> 48#include <hash_map>
49#endif 49#endif
50 50
51// string_table.h
52// LLStringTable class header file
53// Provides a _fast_ method for finding unique copies of strings
54//
55// Copyright 2001-2002, Linden Research, Inc.
56
57const U32 MAX_STRINGS_LENGTH = 256; 51const U32 MAX_STRINGS_LENGTH = 256;
58 52
59class LLStringTableEntry 53class LLStringTableEntry
diff --git a/linden/indra/llcommon/lluri.cpp b/linden/indra/llcommon/lluri.cpp
index f85f294..c838b25 100644
--- a/linden/indra/llcommon/lluri.cpp
+++ b/linden/indra/llcommon/lluri.cpp
@@ -114,6 +114,13 @@ namespace
114 { return LLURI::escape(s, unreserved() + ":@!$'()*+,="); } // sub_delims - "&;" + ":@" 114 { return LLURI::escape(s, unreserved() + ":@!$'()*+,="); } // sub_delims - "&;" + ":@"
115} 115}
116 116
117// TODO: USE CURL!! After http textures gets merged everywhere.
118// static
119std::string LLURI::escape(const std::string& str)
120{
121 return escape(str,unreserved() + ":@!$'()*+,=");
122}
123
117LLURI::LLURI() 124LLURI::LLURI()
118{ 125{
119} 126}
@@ -238,24 +245,11 @@ LLURI LLURI::buildHTTP(const std::string& prefix,
238 const LLSD& path, 245 const LLSD& path,
239 const LLSD& query) 246 const LLSD& query)
240{ 247{
241 LLURI result = buildHTTP(prefix, path); 248 LLURI uri = buildHTTP(prefix, path);
249 uri.mEscapedQuery = mapToQueryString(query);
242 // break out and escape each query component 250 // break out and escape each query component
243 if (query.isMap()) 251 uri.mEscapedOpaque += "?" + uri.mEscapedQuery ;
244 { 252 return uri;
245 for (LLSD::map_const_iterator it = query.beginMap();
246 it != query.endMap();
247 it++)
248 {
249 result.mEscapedQuery += escapeQueryVariable(it->first) +
250 (it->second.isUndefined() ? "" : "=" + escapeQueryValue(it->second.asString())) +
251 "&";
252 }
253 if (query.size() > 0)
254 {
255 result.mEscapedOpaque += "?" + result.mEscapedQuery;
256 }
257 }
258 return result;
259} 253}
260 254
261// static 255// static
@@ -275,7 +269,6 @@ LLURI LLURI::buildHTTP(const std::string& host,
275 return LLURI::buildHTTP(llformat("%s:%u", host.c_str(), port), path, query); 269 return LLURI::buildHTTP(llformat("%s:%u", host.c_str(), port), path, query);
276} 270}
277 271
278
279namespace { 272namespace {
280 LLURI buildBackboneURL(LLApp* app, 273 LLURI buildBackboneURL(LLApp* app,
281 const std::string& p1 = "", 274 const std::string& p1 = "",
@@ -317,6 +310,23 @@ LLURI LLURI::buildBulkAgentNamesURI(LLApp* app)
317} 310}
318 311
319// static 312// static
313LLURI LLURI::buildBulkAgentNamesURI(LLApp* app)
314{
315 std::string host = "localhost:12040";
316
317 if (app)
318 {
319 host = app->getOption("backbone-host-port").asString();
320 }
321
322 LLSD path = LLSD::emptyArray();
323 path.append("agent");
324 path.append("names");
325
326 return buildHTTP(host, path);
327}
328
329// static
320LLURI LLURI::buildAgentSessionURI(const LLUUID& agent_id, LLApp* app) 330LLURI LLURI::buildAgentSessionURI(const LLUUID& agent_id, LLApp* app)
321{ 331{
322 return buildBackboneURL(app, "agent", agent_id.asString(), "session"); 332 return buildBackboneURL(app, "agent", agent_id.asString(), "session");
@@ -341,6 +351,24 @@ LLURI LLURI::buildAgentNameURI(const LLUUID& agent_id, LLApp* app)
341} 351}
342 352
343// static 353// static
354LLURI LLURI::buildAgentNameURI(const LLUUID& agent_id, LLApp* app)
355{
356 std::string host = "localhost:12040";
357
358 if (app)
359 {
360 host = app->getOption("backbone-host-port").asString();
361 }
362
363 LLSD path = LLSD::emptyArray();
364 path.append("agent");
365 path.append(agent_id);
366 path.append("name");
367
368 return buildHTTP(host, path);
369}
370
371// static
344LLURI LLURI::buildAgentLoginInfoURI(const LLUUID& agent_id, const std::string& dataserver) 372LLURI LLURI::buildAgentLoginInfoURI(const LLUUID& agent_id, const std::string& dataserver)
345{ 373{
346 LLSD path = LLSD::emptyArray(); 374 LLSD path = LLSD::emptyArray();
@@ -492,3 +520,23 @@ LLSD LLURI::queryMap(std::string escaped_query_string)
492 return result; 520 return result;
493} 521}
494 522
523std::string LLURI::mapToQueryString(const LLSD& queryMap)
524{
525 std::string query_string;
526
527 if (queryMap.isMap())
528 {
529 for (LLSD::map_const_iterator iter = queryMap.beginMap();
530 iter != queryMap.endMap();
531 iter++)
532 {
533 query_string += escapeQueryVariable(iter->first) +
534 (iter->second.isUndefined() ? "" : "=" + escapeQueryValue(iter->second.asString())) + "&" ;
535 }
536 //if (queryMap.size() > 0)
537 //{
538 // query_string += "?" + query_string ;
539 //}
540 }
541 return query_string;
542}
diff --git a/linden/indra/llcommon/lluri.h b/linden/indra/llcommon/lluri.h
index 77de595..d1499b8 100644
--- a/linden/indra/llcommon/lluri.h
+++ b/linden/indra/llcommon/lluri.h
@@ -90,9 +90,11 @@ public:
90 std::string query() const; // ex.: "x=34", section after "?" 90 std::string query() const; // ex.: "x=34", section after "?"
91 LLSD queryMap() const; // above decoded into a map 91 LLSD queryMap() const; // above decoded into a map
92 static LLSD queryMap(std::string escaped_query_string); 92 static LLSD queryMap(std::string escaped_query_string);
93 static std::string mapToQueryString(const LLSD& queryMap);
93 94
94 // Escaping Utilities 95 // Escaping Utilities
95 // Escape a string by urlencoding all the characters that aren't in the allowed string. 96 // Escape a string by urlencoding all the characters that aren't in the allowed string.
97 static std::string escape(const std::string& str);
96 static std::string escape(const std::string& str, const std::string & allowed); 98 static std::string escape(const std::string& str, const std::string & allowed);
97 static std::string unescape(const std::string& str); 99 static std::string unescape(const std::string& str);
98 100
diff --git a/linden/indra/llcommon/llversion.h b/linden/indra/llcommon/llversion.h
index 426eff0..a76551d 100644
--- a/linden/indra/llcommon/llversion.h
+++ b/linden/indra/llcommon/llversion.h
@@ -31,7 +31,7 @@
31 31
32const S32 LL_VERSION_MAJOR = 1; 32const S32 LL_VERSION_MAJOR = 1;
33const S32 LL_VERSION_MINOR = 15; 33const S32 LL_VERSION_MINOR = 15;
34const S32 LL_VERSION_PATCH = 0; 34const S32 LL_VERSION_PATCH = 1;
35const S32 LL_VERSION_BUILD = 2; 35const S32 LL_VERSION_BUILD = 3;
36 36
37#endif 37#endif