diff options
| author | Don Kjer <don@lindenlab.com> | 2007-05-01 21:52:29 +0000 | 
|---|---|---|
| committer | Don Kjer <don@lindenlab.com> | 2007-05-01 21:52:29 +0000 | 
| commit | eb3731a3ca0d202809ed20a0f49a7a77ecd4c669 (patch) | |
| tree | d8ad688e5b5092418125ecc1b27669860b148b5b /indra | |
| parent | 4ecb9cb63e4993b3b4bc65d73ed255139b5c3f75 (diff) | |
svn merge -r 61099:61168 svn+ssh://svn/svn/linden/branches/release-candidate into release
Diffstat (limited to 'indra')
| -rw-r--r-- | indra/llcommon/lluri.cpp | 42 | ||||
| -rw-r--r-- | indra/llcommon/lluri.h | 1 | ||||
| -rw-r--r-- | indra/llmessage/llhttpclient.cpp | 9 | ||||
| -rw-r--r-- | indra/llmessage/llhttpclient.h | 1 | 
4 files changed, 35 insertions, 18 deletions
| diff --git a/indra/llcommon/lluri.cpp b/indra/llcommon/lluri.cpp index 52270376f8..ee14028ec9 100644 --- a/indra/llcommon/lluri.cpp +++ b/indra/llcommon/lluri.cpp @@ -218,24 +218,11 @@ LLURI LLURI::buildHTTP(const std::string& prefix,  					   const LLSD& path,  					   const LLSD& query)  { -	LLURI result = buildHTTP(prefix, path); +	LLURI uri = buildHTTP(prefix, path); +	uri.mEscapedQuery = mapToQueryString(query);  	// break out and escape each query component -	if (query.isMap()) -	{ -		for (LLSD::map_const_iterator it = query.beginMap(); -			 it != query.endMap(); -			 it++) -		{ -			result.mEscapedQuery += escapeQueryVariable(it->first) + -				(it->second.isUndefined() ? "" : "=" + escapeQueryValue(it->second.asString())) + -				"&"; -		} -		if (query.size() > 0) -		{ -			result.mEscapedOpaque += "?" + result.mEscapedQuery; -		} -	} -	return result; +	uri.mEscapedOpaque += "?" + uri.mEscapedQuery ; +	return uri;  }  // static @@ -255,7 +242,6 @@ LLURI LLURI::buildHTTP(const std::string& host,  	return LLURI::buildHTTP(llformat("%s:%u", host.c_str(), port), path, query);  } -  namespace {  	LLURI buildBackboneURL(LLApp* app,  				const std::string& p1 = "", @@ -507,3 +493,23 @@ LLSD LLURI::queryMap(std::string escaped_query_string)  	return result;  } +std::string LLURI::mapToQueryString(const LLSD& queryMap) +{ +	std::string query_string; + +	if (queryMap.isMap()) +	{ +		for (LLSD::map_const_iterator iter = queryMap.beginMap(); +			 iter != queryMap.endMap(); +			 iter++) +		{ +			query_string += escapeQueryVariable(iter->first) + +				(iter->second.isUndefined() ? "" : "=" + escapeQueryValue(iter->second.asString())) + "&" ; +		} +		//if (queryMap.size() > 0) +		//{ +		//	query_string += "?" + query_string ; +		//} +	} +	return query_string; +} diff --git a/indra/llcommon/lluri.h b/indra/llcommon/lluri.h index f42cc102e6..78ffcf0a87 100644 --- a/indra/llcommon/lluri.h +++ b/indra/llcommon/lluri.h @@ -70,6 +70,7 @@ public:    std::string query() const;		// ex.: "x=34", section after "?"    LLSD queryMap() const;			// above decoded into a map    static LLSD queryMap(std::string escaped_query_string); +  static std::string mapToQueryString(const LLSD& queryMap);    // Escaping Utilities    // Escape a string by urlencoding all the characters that aren't in the allowed string. diff --git a/indra/llmessage/llhttpclient.cpp b/indra/llmessage/llhttpclient.cpp index 92c309f1bc..a7d187f534 100644 --- a/indra/llmessage/llhttpclient.cpp +++ b/indra/llmessage/llhttpclient.cpp @@ -17,6 +17,7 @@  #include "llsdserialize.h"  #include "llvfile.h"  #include "llvfs.h" +#include "lluri.h"  #include "message.h"  #include <curl/curl.h> @@ -263,6 +264,14 @@ void LLHTTPClient::get(const std::string& url, ResponderPtr responder, const F32  	request(url, LLURLRequest::HTTP_GET, NULL, responder, timeout);  } +void LLHTTPClient::get(const std::string& url, const LLSD& query, ResponderPtr responder, const F32 timeout) +{ +	LLURI uri; +	 +	uri = LLURI::buildHTTP(url, LLSD::emptyArray(), query); +	get(uri.asString(), responder, timeout); +} +  // A simple class for managing data returned from a curl http request.  class LLHTTPBuffer  { diff --git a/indra/llmessage/llhttpclient.h b/indra/llmessage/llhttpclient.h index 060293c930..f2674ba417 100644 --- a/indra/llmessage/llhttpclient.h +++ b/indra/llmessage/llhttpclient.h @@ -53,6 +53,7 @@ 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, const LLSD& query, ResponderPtr, 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); | 
