diff options
author | Jacek Antonelli | 2008-08-15 23:45:04 -0500 |
---|---|---|
committer | Jacek Antonelli | 2008-08-15 23:45:04 -0500 |
commit | 117e22047c5752352342d64e3fb7ce00a4eb8113 (patch) | |
tree | e32de2cfba0dda8705ae528fcd1fbe23ba075685 /linden/indra/llcommon/lluri.cpp | |
parent | Second Life viewer sources 1.18.0.6 (diff) | |
download | meta-impy-117e22047c5752352342d64e3fb7ce00a4eb8113.zip meta-impy-117e22047c5752352342d64e3fb7ce00a4eb8113.tar.gz meta-impy-117e22047c5752352342d64e3fb7ce00a4eb8113.tar.bz2 meta-impy-117e22047c5752352342d64e3fb7ce00a4eb8113.tar.xz |
Second Life viewer sources 1.18.1.2
Diffstat (limited to 'linden/indra/llcommon/lluri.cpp')
-rw-r--r-- | linden/indra/llcommon/lluri.cpp | 35 |
1 files changed, 23 insertions, 12 deletions
diff --git a/linden/indra/llcommon/lluri.cpp b/linden/indra/llcommon/lluri.cpp index 83de022..43d2147 100644 --- a/linden/indra/llcommon/lluri.cpp +++ b/linden/indra/llcommon/lluri.cpp | |||
@@ -295,9 +295,10 @@ LLURI LLURI::buildHTTP(const std::string& prefix, | |||
295 | const LLSD& query) | 295 | const LLSD& query) |
296 | { | 296 | { |
297 | LLURI uri = buildHTTP(prefix, path); | 297 | LLURI uri = buildHTTP(prefix, path); |
298 | uri.mEscapedQuery = mapToQueryString(query); | ||
299 | // break out and escape each query component | 298 | // break out and escape each query component |
300 | uri.mEscapedOpaque += "?" + uri.mEscapedQuery ; | 299 | uri.mEscapedQuery = mapToQueryString(query); |
300 | uri.mEscapedOpaque += uri.mEscapedQuery ; | ||
301 | uri.mEscapedQuery.erase(0,1); // trim the leading '?' | ||
301 | return uri; | 302 | return uri; |
302 | } | 303 | } |
303 | 304 | ||
@@ -601,20 +602,30 @@ LLSD LLURI::queryMap(std::string escaped_query_string) | |||
601 | std::string LLURI::mapToQueryString(const LLSD& queryMap) | 602 | std::string LLURI::mapToQueryString(const LLSD& queryMap) |
602 | { | 603 | { |
603 | std::string query_string; | 604 | std::string query_string; |
604 | |||
605 | if (queryMap.isMap()) | 605 | if (queryMap.isMap()) |
606 | { | 606 | { |
607 | for (LLSD::map_const_iterator iter = queryMap.beginMap(); | 607 | bool first_element = true; |
608 | iter != queryMap.endMap(); | 608 | LLSD::map_const_iterator iter = queryMap.beginMap(); |
609 | iter++) | 609 | LLSD::map_const_iterator end = queryMap.endMap(); |
610 | std::ostringstream ostr; | ||
611 | for (; iter != end; ++iter) | ||
610 | { | 612 | { |
611 | query_string += escapeQueryVariable(iter->first) + | 613 | if(first_element) |
612 | (iter->second.isUndefined() ? "" : "=" + escapeQueryValue(iter->second.asString())) + "&" ; | 614 | { |
615 | ostr << "?"; | ||
616 | first_element = false; | ||
617 | } | ||
618 | else | ||
619 | { | ||
620 | ostr << "&"; | ||
621 | } | ||
622 | ostr << escapeQueryVariable(iter->first); | ||
623 | if(iter->second.isDefined()) | ||
624 | { | ||
625 | ostr << "=" << escapeQueryValue(iter->second.asString()); | ||
626 | } | ||
613 | } | 627 | } |
614 | //if (queryMap.size() > 0) | 628 | query_string = ostr.str(); |
615 | //{ | ||
616 | // query_string += "?" + query_string ; | ||
617 | //} | ||
618 | } | 629 | } |
619 | return query_string; | 630 | return query_string; |
620 | } | 631 | } |