diff options
| -rwxr-xr-x | indra/llcorehttp/_httpoprequest.cpp | 10 | ||||
| -rwxr-xr-x | indra/llcorehttp/_httpoprequest.h | 5 | ||||
| -rwxr-xr-x | indra/llcorehttp/_httppolicyglobal.cpp | 4 | ||||
| -rwxr-xr-x | indra/llcorehttp/_httppolicyglobal.h | 6 | ||||
| -rwxr-xr-x | indra/llcorehttp/_httpservice.cpp | 4 | ||||
| -rwxr-xr-x | indra/llcorehttp/_httpservice.h | 6 | ||||
| -rwxr-xr-x | indra/llcorehttp/httpcommon.h | 75 | ||||
| -rwxr-xr-x | indra/llcorehttp/httpoptions.cpp | 8 | ||||
| -rwxr-xr-x | indra/llcorehttp/httpoptions.h | 90 | ||||
| -rwxr-xr-x | indra/llcorehttp/httprequest.cpp | 10 | ||||
| -rwxr-xr-x | indra/llcorehttp/httprequest.h | 4 | ||||
| -rw-r--r-- | indra/llmessage/llhttpsdhandler.cpp | 2 | ||||
| -rw-r--r-- | indra/llmessage/llhttpsdhandler.h | 4 | ||||
| -rwxr-xr-x | indra/newview/llagent.cpp | 11 | ||||
| -rwxr-xr-x | indra/newview/llagent.h | 4 | ||||
| -rwxr-xr-x | indra/newview/llagentlanguage.cpp | 2 | ||||
| -rwxr-xr-x | indra/newview/llappcorehttp.cpp | 2 | ||||
| -rwxr-xr-x | indra/newview/llappearancemgr.cpp | 6 | ||||
| -rw-r--r-- | indra/newview/llavatarrenderinfoaccountant.cpp | 131 | ||||
| -rw-r--r-- | indra/newview/llavatarrenderinfoaccountant.h | 10 | ||||
| -rwxr-xr-x | indra/newview/llmaterialmgr.cpp | 4 | 
21 files changed, 271 insertions, 127 deletions
| diff --git a/indra/llcorehttp/_httpoprequest.cpp b/indra/llcorehttp/_httpoprequest.cpp index 48e22468cd..5768fe5a90 100755 --- a/indra/llcorehttp/_httpoprequest.cpp +++ b/indra/llcorehttp/_httpoprequest.cpp @@ -115,9 +115,8 @@ namespace LLCore  { -HttpOpRequest::HttpOpRequest(HttpRequest const * const request) +HttpOpRequest::HttpOpRequest()  	: HttpOperation(), -	  mRequest(request),  	  mProcFlags(0U),  	  mReqMethod(HOR_GET),  	  mReqBody(NULL), @@ -490,13 +489,13 @@ HttpStatus HttpOpRequest::prepareRequest(HttpService * service)  	long follow_redirect(1L);  	long sslPeerV(0L);  	long sslHostV(0L); -	long dnsCacheTimeout(15L); +    long dnsCacheTimeout(-1L);  	if (mReqOptions)  	{  		follow_redirect = mReqOptions->getFollowRedirects() ? 1L : 0L; -		sslPeerV = mReqOptions->getSSLVerifyHost() ? 0L : 1L; -		sslHostV = mReqOptions->getSSLVerifyHost(); +		sslPeerV = mReqOptions->getSSLVerifyPeer() ? 1L : 0L; +		sslHostV = mReqOptions->getSSLVerifyHost() ? 2L : 0L;  		dnsCacheTimeout = mReqOptions->getDNSCacheTimeout();  	}  	code = curl_easy_setopt(mCurlHandle, CURLOPT_FOLLOWLOCATION, follow_redirect); @@ -516,7 +515,6 @@ HttpStatus HttpOpRequest::prepareRequest(HttpService * service)  	code = curl_easy_setopt(mCurlHandle, CURLOPT_DNS_CACHE_TIMEOUT, dnsCacheTimeout);  	check_curl_easy_code(code, CURLOPT_DNS_CACHE_TIMEOUT); -  	if (gpolicy.mUseLLProxy)  	{  		// Use the viewer-based thread-safe API which has a diff --git a/indra/llcorehttp/_httpoprequest.h b/indra/llcorehttp/_httpoprequest.h index 7a4b7c189e..e71d1d1edf 100755 --- a/indra/llcorehttp/_httpoprequest.h +++ b/indra/llcorehttp/_httpoprequest.h @@ -66,7 +66,7 @@ class HttpOptions;  class HttpOpRequest : public HttpOperation  {  public: -	HttpOpRequest(HttpRequest const * const request); +	HttpOpRequest();  protected:  	virtual ~HttpOpRequest();							// Use release() @@ -165,11 +165,10 @@ protected:  	static const unsigned int	PF_SAVE_HEADERS = 0x00000002U;  	static const unsigned int	PF_USE_RETRY_AFTER = 0x00000004U; -	HttpRequest::policyCallback	mCallbackSSLVerify; +	HttpRequest::policyCallback_t	mCallbackSSLVerify;  public:  	// Request data -	HttpRequest const * const mRequest;  	EMethod				mReqMethod;  	std::string			mReqURL;  	BufferArray *		mReqBody; diff --git a/indra/llcorehttp/_httppolicyglobal.cpp b/indra/llcorehttp/_httppolicyglobal.cpp index c4ef38a815..3d0df96ade 100755 --- a/indra/llcorehttp/_httppolicyglobal.cpp +++ b/indra/llcorehttp/_httppolicyglobal.cpp @@ -106,7 +106,7 @@ HttpStatus HttpPolicyGlobal::set(HttpRequest::EPolicyOption opt, const std::stri  	return HttpStatus();  } -HttpStatus HttpPolicyGlobal::set(HttpRequest::EPolicyOption opt, HttpRequest::policyCallback value) +HttpStatus HttpPolicyGlobal::set(HttpRequest::EPolicyOption opt, HttpRequest::policyCallback_t value)  {  	switch (opt)  	{ @@ -169,7 +169,7 @@ HttpStatus HttpPolicyGlobal::get(HttpRequest::EPolicyOption opt, std::string * v  } -HttpStatus HttpPolicyGlobal::get(HttpRequest::EPolicyOption opt, HttpRequest::policyCallback * value) const +HttpStatus HttpPolicyGlobal::get(HttpRequest::EPolicyOption opt, HttpRequest::policyCallback_t * value) const  {  	switch (opt)  	{ diff --git a/indra/llcorehttp/_httppolicyglobal.h b/indra/llcorehttp/_httppolicyglobal.h index 1696238814..e02da4386a 100755 --- a/indra/llcorehttp/_httppolicyglobal.h +++ b/indra/llcorehttp/_httppolicyglobal.h @@ -60,10 +60,10 @@ private:  public:  	HttpStatus set(HttpRequest::EPolicyOption opt, long value);  	HttpStatus set(HttpRequest::EPolicyOption opt, const std::string & value); -	HttpStatus set(HttpRequest::EPolicyOption opt, HttpRequest::policyCallback value); +	HttpStatus set(HttpRequest::EPolicyOption opt, HttpRequest::policyCallback_t value);  	HttpStatus get(HttpRequest::EPolicyOption opt, long * value) const;  	HttpStatus get(HttpRequest::EPolicyOption opt, std::string * value) const; -	HttpStatus get(HttpRequest::EPolicyOption opt, HttpRequest::policyCallback * value) const; +	HttpStatus get(HttpRequest::EPolicyOption opt, HttpRequest::policyCallback_t * value) const;  public:  	long				mConnectionLimit; @@ -72,7 +72,7 @@ public:  	std::string			mHttpProxy;  	long				mTrace;  	long				mUseLLProxy; -	HttpRequest::policyCallback	mSslCtxCallback; +	HttpRequest::policyCallback_t	mSslCtxCallback;  };  // end class HttpPolicyGlobal  }  // end namespace LLCore diff --git a/indra/llcorehttp/_httpservice.cpp b/indra/llcorehttp/_httpservice.cpp index 7b8aac35a8..252db78c89 100755 --- a/indra/llcorehttp/_httpservice.cpp +++ b/indra/llcorehttp/_httpservice.cpp @@ -415,7 +415,7 @@ HttpStatus HttpService::getPolicyOption(HttpRequest::EPolicyOption opt, HttpRequ  }  HttpStatus HttpService::getPolicyOption(HttpRequest::EPolicyOption opt, HttpRequest::policy_t pclass, -	HttpRequest::policyCallback * ret_value) +	HttpRequest::policyCallback_t * ret_value)  {  	HttpStatus status(HttpStatus::LLCORE, LLCore::HE_INVALID_ARG); @@ -520,7 +520,7 @@ HttpStatus HttpService::setPolicyOption(HttpRequest::EPolicyOption opt, HttpRequ  }  HttpStatus HttpService::setPolicyOption(HttpRequest::EPolicyOption opt, HttpRequest::policy_t pclass, -	HttpRequest::policyCallback value, HttpRequest::policyCallback * ret_value) +	HttpRequest::policyCallback_t value, HttpRequest::policyCallback_t * ret_value)  {  	HttpStatus status(HttpStatus::LLCORE, LLCore::HE_INVALID_ARG); diff --git a/indra/llcorehttp/_httpservice.h b/indra/llcorehttp/_httpservice.h index 699a8eaa4f..ac518a5de7 100755 --- a/indra/llcorehttp/_httpservice.h +++ b/indra/llcorehttp/_httpservice.h @@ -209,15 +209,15 @@ protected:  	HttpStatus getPolicyOption(HttpRequest::EPolicyOption opt, HttpRequest::policy_t,  							   std::string * ret_value);  	HttpStatus getPolicyOption(HttpRequest::EPolicyOption opt, HttpRequest::policy_t, -								HttpRequest::policyCallback * ret_value); +								HttpRequest::policyCallback_t * ret_value);  	HttpStatus setPolicyOption(HttpRequest::EPolicyOption opt, HttpRequest::policy_t,  							   long value, long * ret_value);  	HttpStatus setPolicyOption(HttpRequest::EPolicyOption opt, HttpRequest::policy_t,  							   const std::string & value, std::string * ret_value);  	HttpStatus setPolicyOption(HttpRequest::EPolicyOption opt, HttpRequest::policy_t, -								HttpRequest::policyCallback value,  -								HttpRequest::policyCallback * ret_value); +								HttpRequest::policyCallback_t value,  +								HttpRequest::policyCallback_t * ret_value);  protected:  	static const OptionDescriptor		sOptionDesc[HttpRequest::PO_LAST]; diff --git a/indra/llcorehttp/httpcommon.h b/indra/llcorehttp/httpcommon.h index 64075f5f20..ada5c1bbe7 100755 --- a/indra/llcorehttp/httpcommon.h +++ b/indra/llcorehttp/httpcommon.h @@ -190,6 +190,7 @@  #include "linden_common.h"		// Modifies curl/curl.h interfaces  #include "boost/intrusive_ptr.hpp"  #include "boost/shared_ptr.hpp" +#include "boost/function.hpp"  #include <string>  namespace LLCore @@ -294,50 +295,50 @@ struct HttpStatus  	typedef unsigned short type_enum_t;  	HttpStatus() -		{ -			mDetails = new Details(LLCORE, HE_SUCCESS); -	} +	{ +		mDetails = boost::shared_ptr<Details>(new Details(LLCORE, HE_SUCCESS)); +    }  	HttpStatus(type_enum_t type, short status) -		{ -			mDetails = new Details(type, status); -		} +	{ +        mDetails = boost::shared_ptr<Details>(new Details(type, status)); +	}  	HttpStatus(int http_status) -		{ -			mDetails = new Details(http_status,  -				(http_status >= 200 && http_status <= 299) ? HE_SUCCESS : HE_REPLY_ERROR); -			llassert(http_status >= 100 && http_status <= 999); -		} +	{ +        mDetails = boost::shared_ptr<Details>(new Details(http_status,  +			(http_status >= 200 && http_status <= 299) ? HE_SUCCESS : HE_REPLY_ERROR)); +		llassert(http_status >= 100 && http_status <= 999); +	}  	HttpStatus(int http_status, const std::string &message) -		{ -			mDetails = new Details(http_status, -				(http_status >= 200 && http_status <= 299) ? HE_SUCCESS : HE_REPLY_ERROR); -			llassert(http_status >= 100 && http_status <= 999); -			mDetails->mMessage = message; -		} +	{ +        mDetails = boost::shared_ptr<Details>(new Details(http_status, +			(http_status >= 200 && http_status <= 299) ? HE_SUCCESS : HE_REPLY_ERROR)); +		llassert(http_status >= 100 && http_status <= 999); +		mDetails->mMessage = message; +	}  	HttpStatus(const HttpStatus & rhs) -		{ -			mDetails = new Details(*rhs.mDetails); -		} +	{ +		mDetails = rhs.mDetails; +	}  	~HttpStatus() -		{ -			delete mDetails; -		} +	{ +	}  	HttpStatus & operator=(const HttpStatus & rhs) -		{ -			// Don't care if lhs & rhs are the same object -			mDetails->mType = rhs.mDetails->mType; -			mDetails->mStatus = rhs.mDetails->mStatus; -			mDetails->mMessage = rhs.mDetails->mMessage; -			mDetails->mErrorData = rhs.mDetails->mErrorData; - -			return *this; -		} +	{ +        mDetails = rhs.mDetails; +		return *this; +	} + +    HttpStatus & clone(const HttpStatus &rhs) +    { +        mDetails = boost::shared_ptr<Details>(new Details(*rhs.mDetails)); +        return *this; +    }  	static const type_enum_t EXT_CURL_EASY = 0;			///< mStatus is an error from a curl_easy_*() call  	static const type_enum_t EXT_CURL_MULTI = 1;		///< mStatus is an error from a curl_multi_*() call @@ -365,8 +366,7 @@ struct HttpStatus  	/// which will do the wrong thing in conditional expressions.  	bool operator==(const HttpStatus & rhs) const  	{ -		return (mDetails->mType == rhs.mDetails->mType) &&  -			(mDetails->mStatus == rhs.mDetails->mStatus); +        return (*mDetails == *rhs.mDetails);   	}  	bool operator!=(const HttpStatus & rhs) const @@ -474,6 +474,10 @@ private:  			mErrorData(rhs.mErrorData)  		{} +        bool operator == (const Details &rhs) const +        { +            return (mType == rhs.mType) && (mStatus == rhs.mStatus); +        }  		type_enum_t	mType;  		short		mStatus; @@ -481,8 +485,7 @@ private:  		void *		mErrorData;  	}; -	//boost::unique_ptr<Details>	mDetails; -	Details * mDetails; +    boost::shared_ptr<Details> mDetails;  }; // end struct HttpStatus diff --git a/indra/llcorehttp/httpoptions.cpp b/indra/llcorehttp/httpoptions.cpp index 28c2c25e92..a4d08a80df 100755 --- a/indra/llcorehttp/httpoptions.cpp +++ b/indra/llcorehttp/httpoptions.cpp @@ -42,8 +42,8 @@ HttpOptions::HttpOptions() : RefCounted(true),  	mUseRetryAfter(HTTP_USE_RETRY_AFTER_DEFAULT),  	mFollowRedirects(false),  	mVerifyPeer(false), -	mVerifyHost(0), -	mDNSCacheTimeout(15) +	mVerifyHost(false), +    mDNSCacheTimeout(-1L)  {} @@ -95,9 +95,9 @@ void HttpOptions::setSSLVerifyPeer(bool verify)  	mVerifyPeer = verify;  } -void HttpOptions::setSSLVerifyHost(unsigned int type) +void HttpOptions::setSSLVerifyHost(bool verify)  { -	mVerifyHost = llclamp<unsigned int>(type, 0, 2); +	mVerifyHost = verify;  }  void HttpOptions::setDNSCacheTimeout(int timeout) diff --git a/indra/llcorehttp/httpoptions.h b/indra/llcorehttp/httpoptions.h index 3b9ad9598b..765d2431bb 100755 --- a/indra/llcorehttp/httpoptions.h +++ b/indra/llcorehttp/httpoptions.h @@ -69,72 +69,86 @@ protected:  	void operator=(const HttpOptions &);		// Not defined  public: +  	// Default:   false  	void				setWantHeaders(bool wanted);  	bool				getWantHeaders() const -		{ -			return mWantHeaders; -		} +	{ +		return mWantHeaders; +	}  	// Default:  0  	void				setTrace(int long);  	int					getTrace() const -		{ -			return mTracing; -		} +	{ +		return mTracing; +	}  	// Default:  30  	void				setTimeout(unsigned int timeout);  	unsigned int		getTimeout() const -		{ -			return mTimeout; -		} +	{ +		return mTimeout; +	}  	// Default:  0  	void				setTransferTimeout(unsigned int timeout);  	unsigned int		getTransferTimeout() const -		{ -			return mTransferTimeout; -		} +	{ +		return mTransferTimeout; +	} +    /// Sets the number of retries on an LLCore::HTTPRequest before the  +    /// request fails.  	// Default:  8  	void				setRetries(unsigned int retries);  	unsigned int		getRetries() const -		{ -			return mRetries; -		} +	{ +		return mRetries; +	}  	// Default:  true  	void				setUseRetryAfter(bool use_retry);  	bool				getUseRetryAfter() const -		{ -			return mUseRetryAfter; -		} +	{ +		return mUseRetryAfter; +	} -	// Default: false +    /// Instructs the LLCore::HTTPRequest to follow redirects  +	/// Default: false  	void				setFollowRedirects(bool follow_redirect);  	bool				getFollowRedirects() const -		{ -			return mFollowRedirects; -		} - -	void				setSSLVerifyPeer(bool verify); +	{ +		return mFollowRedirects; +	} + +    /// Instructs the LLCore::HTTPRequest to verify that the exchanged security +    /// certificate is authentic.  +    /// Default: false +    void				setSSLVerifyPeer(bool verify);  	bool				getSSLVerifyPeer() const -		{ -			return mVerifyPeer; -		} - -	void				setSSLVerifyHost(unsigned int type); -	unsigned int		getSSLVerifyHost() const -		{ -			return mVerifyHost; -		} - +	{ +		return mVerifyPeer; +	} + +    /// Instructs the LLCore::HTTPRequest to verify that the name in the  +    /// security certificate matches the name of the host contacted. +    /// Default: false +    void				setSSLVerifyHost(bool verify); +	bool	        	getSSLVerifyHost() const +	{ +		return mVerifyHost; +	} + +    /// Sets the time for DNS name caching in seconds.  Setting this value +    /// to 0 will disable name caching.  Setting this value to -1 causes the  +    /// name cache to never time out. +    /// Default: -1  	void				setDNSCacheTimeout(int timeout);  	int					getDNSCacheTimeout() const -		{ -			return mDNSCacheTimeout; -		} +	{ +		return mDNSCacheTimeout; +	}  protected:  	bool				mWantHeaders; @@ -145,7 +159,7 @@ protected:  	bool				mUseRetryAfter;  	bool				mFollowRedirects;  	bool				mVerifyPeer; -	unsigned int		mVerifyHost; +	bool        		mVerifyHost;  	int					mDNSCacheTimeout;  }; // end class HttpOptions diff --git a/indra/llcorehttp/httprequest.cpp b/indra/llcorehttp/httprequest.cpp index 5f1ed3d43b..df8502b947 100755 --- a/indra/llcorehttp/httprequest.cpp +++ b/indra/llcorehttp/httprequest.cpp @@ -117,7 +117,7 @@ HttpStatus HttpRequest::setStaticPolicyOption(EPolicyOption opt, policy_t pclass  	return HttpService::instanceOf()->setPolicyOption(opt, pclass, value, ret_value);  } -HttpStatus HttpRequest::setStaticPolicyOption(EPolicyOption opt, policy_t pclass, policyCallback value, policyCallback * ret_value) +HttpStatus HttpRequest::setStaticPolicyOption(EPolicyOption opt, policy_t pclass, policyCallback_t value, policyCallback_t * ret_value)  {  	if (HttpService::RUNNING == HttpService::instanceOf()->getState())  	{ @@ -204,7 +204,7 @@ HttpHandle HttpRequest::requestGet(policy_t policy_id,  	HttpStatus status;  	HttpHandle handle(LLCORE_HTTP_HANDLE_INVALID); -	HttpOpRequest * op = new HttpOpRequest(this); +	HttpOpRequest * op = new HttpOpRequest();  	if (! (status = op->setupGet(policy_id, priority, url, options, headers)))  	{  		op->release(); @@ -238,7 +238,7 @@ HttpHandle HttpRequest::requestGetByteRange(policy_t policy_id,  	HttpStatus status;  	HttpHandle handle(LLCORE_HTTP_HANDLE_INVALID); -	HttpOpRequest * op = new HttpOpRequest(this); +	HttpOpRequest * op = new HttpOpRequest();  	if (! (status = op->setupGetByteRange(policy_id, priority, url, offset, len, options, headers)))  	{  		op->release(); @@ -271,7 +271,7 @@ HttpHandle HttpRequest::requestPost(policy_t policy_id,  	HttpStatus status;  	HttpHandle handle(LLCORE_HTTP_HANDLE_INVALID); -	HttpOpRequest * op = new HttpOpRequest(this); +	HttpOpRequest * op = new HttpOpRequest();  	if (! (status = op->setupPost(policy_id, priority, url, body, options, headers)))  	{  		op->release(); @@ -304,7 +304,7 @@ HttpHandle HttpRequest::requestPut(policy_t policy_id,  	HttpStatus status;  	HttpHandle handle(LLCORE_HTTP_HANDLE_INVALID); -	HttpOpRequest * op = new HttpOpRequest(this); +	HttpOpRequest * op = new HttpOpRequest();  	if (! (status = op->setupPut(policy_id, priority, url, body, options, headers)))  	{  		op->release(); diff --git a/indra/llcorehttp/httprequest.h b/indra/llcorehttp/httprequest.h index 4cacb3a20b..f7ce82d412 100755 --- a/indra/llcorehttp/httprequest.h +++ b/indra/llcorehttp/httprequest.h @@ -237,7 +237,7 @@ public:  	/// Prototype for policy based callbacks.  The callback methods will be executed  	/// on the worker thread so no modifications should be made to the HttpHandler object. -	typedef HttpStatus(*policyCallback)(const std::string &, HttpHandler const * const, void *); +    typedef boost::function<HttpStatus(const std::string &, HttpHandler const * const, void *)> policyCallback_t;  	/// Set a policy option for a global or class parameter at  	/// startup time (prior to thread start). @@ -255,7 +255,7 @@ public:  	static HttpStatus setStaticPolicyOption(EPolicyOption opt, policy_t pclass,  											const std::string & value, std::string * ret_value);  	static HttpStatus setStaticPolicyOption(EPolicyOption opt, policy_t pclass, -											policyCallback value, policyCallback * ret_value);; +											policyCallback_t value, policyCallback_t * ret_value);;  	/// Set a parameter on a class-based policy option.  Calls  	/// made after the start of the servicing thread are diff --git a/indra/llmessage/llhttpsdhandler.cpp b/indra/llmessage/llhttpsdhandler.cpp index 0d385d6497..72ecfe77e2 100644 --- a/indra/llmessage/llhttpsdhandler.cpp +++ b/indra/llmessage/llhttpsdhandler.cpp @@ -89,7 +89,7 @@ LLHttpSDGenericHandler::LLHttpSDGenericHandler(const LLURI &uri, const std::stri  {  } -void LLHttpSDGenericHandler::onSuccess(LLCore::HttpResponse * response, LLSD &content) +void LLHttpSDGenericHandler::onSuccess(LLCore::HttpResponse * response, const LLSD &content)  {  	LL_DEBUGS() << mCaps << " Success." << LL_ENDL;  } diff --git a/indra/llmessage/llhttpsdhandler.h b/indra/llmessage/llhttpsdhandler.h index b3eb7d6145..a2598c9709 100644 --- a/indra/llmessage/llhttpsdhandler.h +++ b/indra/llmessage/llhttpsdhandler.h @@ -49,7 +49,7 @@ public:  	}  protected: -	virtual void onSuccess(LLCore::HttpResponse * response, LLSD &content) = 0; +	virtual void onSuccess(LLCore::HttpResponse * response, const LLSD &content) = 0;  	virtual void onFailure(LLCore::HttpResponse * response, LLCore::HttpStatus status) = 0;  private: @@ -65,7 +65,7 @@ public:  	LLHttpSDGenericHandler(const LLURI &uri, const std::string &action);  protected: -	virtual void onSuccess(LLCore::HttpResponse * response, LLSD &content); +	virtual void onSuccess(LLCore::HttpResponse * response, const LLSD &content);  	virtual void onFailure(LLCore::HttpResponse * response, LLCore::HttpStatus status);  private: diff --git a/indra/newview/llagent.cpp b/indra/newview/llagent.cpp index 81387fb927..667d530e39 100755 --- a/indra/newview/llagent.cpp +++ b/indra/newview/llagent.cpp @@ -2559,7 +2559,7 @@ public:  	{ }  protected: -	virtual void onSuccess(LLCore::HttpResponse * response, LLSD &content); +	virtual void onSuccess(LLCore::HttpResponse * response, const LLSD &content);  	virtual void onFailure(LLCore::HttpResponse * response, LLCore::HttpStatus status);  private: @@ -2572,7 +2572,7 @@ private:  };  //------------------------------------------------------------------------- -void LLMaturityHttpHandler::onSuccess(LLCore::HttpResponse * response, LLSD &content) +void LLMaturityHttpHandler::onSuccess(LLCore::HttpResponse * response, const LLSD &content)  {  	U8 actualMaturity = parseMaturityFromServerResponse(content); @@ -2774,7 +2774,7 @@ void LLAgent::sendMaturityPreferenceToServer(U8 pPreferredMaturity)  		LL_INFOS() << "Sending viewer preferred maturity to '" << LLViewerRegion::accessToString(pPreferredMaturity)  			<< "' via capability to: " << url << LL_ENDL; -		LLCore::HttpHandle handle = requestPostCapibility("UpdateAgentInformation", url, postData, handler); +		LLCore::HttpHandle handle = requestPostCapability("UpdateAgentInformation", url, postData, handler);  		if (handle == LLCORE_HTTP_HANDLE_INVALID)  		{ @@ -2784,7 +2784,7 @@ void LLAgent::sendMaturityPreferenceToServer(U8 pPreferredMaturity)  	}  } -LLCore::HttpHandle LLAgent::requestPostCapibility(const std::string &cap, const std::string &url, LLSD &postData, LLHttpSDHandler *usrhndlr) +LLCore::HttpHandle LLAgent::requestPostCapability(const std::string &cap, const std::string &url, LLSD &postData, LLHttpSDHandler *usrhndlr)  {  	LLHttpSDHandler * handler = (usrhndlr) ? usrhndlr : new LLHttpSDGenericHandler(url, cap);  	LLCore::HttpHandle handle = LLCoreHttpUtil::requestPostWithLLSD(mHttpRequest, @@ -2793,6 +2793,9 @@ LLCore::HttpHandle LLAgent::requestPostCapibility(const std::string &cap, const  	if (handle == LLCORE_HTTP_HANDLE_INVALID)  	{ +        // If no handler was passed in we delete the handler default handler allocated  +        // at the start of this function. +        // *TODO: Change this metaphore to use boost::shared_ptr<> for handlers.  Requires change in LLCore::HTTP  		if (!usrhndlr)  			delete handler;  		LLCore::HttpStatus status = mHttpRequest->getStatus(); diff --git a/indra/newview/llagent.h b/indra/newview/llagent.h index 6b636a2dc0..26120b52f6 100755 --- a/indra/newview/llagent.h +++ b/indra/newview/llagent.h @@ -925,8 +925,8 @@ public:  public:  	/// Utilities for allowing the the agent sub managers to post and get via  	/// HTTP using the agent's policy settings and headers. -	LLCore::HttpHandle	requestPostCapibility(const std::string &cap, const std::string &url, LLSD &postData, LLHttpSDHandler *usrhndlr = NULL); -	//LLCore::HttpHandle	httpGetCapibility(const std::string &cap, const LLURI &uri, LLHttpSDHandler *usrhndlr = NULL); +	LLCore::HttpHandle	requestPostCapability(const std::string &cap, const std::string &url, LLSD &postData, LLHttpSDHandler *usrhndlr = NULL); +	//LLCore::HttpHandle	httpGetCapability(const std::string &cap, const LLURI &uri, LLHttpSDHandler *usrhndlr = NULL);  /**                    Utility   **                                                                            ** diff --git a/indra/newview/llagentlanguage.cpp b/indra/newview/llagentlanguage.cpp index 81fce9b257..f2ac323578 100755 --- a/indra/newview/llagentlanguage.cpp +++ b/indra/newview/llagentlanguage.cpp @@ -71,7 +71,7 @@ bool LLAgentLanguage::update()  		body["language_is_public"] = gSavedSettings.getBOOL("LanguageIsPublic");  		//LLHTTPClient::post(url, body, new LLHTTPClient::Responder); -		LLCore::HttpHandle handle = gAgent.requestPostCapibility("UpdateAgentLanguage", url, body); +		LLCore::HttpHandle handle = gAgent.requestPostCapability("UpdateAgentLanguage", url, body);  		if (handle == LLCORE_HTTP_HANDLE_INVALID)  		{  			LL_WARNS() << "Unable to change language." << LL_ENDL; diff --git a/indra/newview/llappcorehttp.cpp b/indra/newview/llappcorehttp.cpp index cd9166f7b7..51cca273d8 100755 --- a/indra/newview/llappcorehttp.cpp +++ b/indra/newview/llappcorehttp.cpp @@ -494,7 +494,7 @@ LLCore::HttpStatus LLAppCoreHttp::sslVerify(const std::string &url,  	validation_params[CERT_HOSTNAME] = uri.hostName(); -	// *TODO*: In the case of an exception while validating the cert, we need a way +	// *TODO: In the case of an exception while validating the cert, we need a way  	// to pass the offending(?) cert back out. *Rider*  	try diff --git a/indra/newview/llappearancemgr.cpp b/indra/newview/llappearancemgr.cpp index be71c430f4..709d9881e1 100755 --- a/indra/newview/llappearancemgr.cpp +++ b/indra/newview/llappearancemgr.cpp @@ -1260,7 +1260,7 @@ public:  	virtual void onCompleted(LLCore::HttpHandle handle, LLCore::HttpResponse * response);  protected: -	virtual void onSuccess(LLCore::HttpResponse * response, LLSD &content); +	virtual void onSuccess(LLCore::HttpResponse * response, const LLSD &content);  	virtual void onFailure(LLCore::HttpResponse * response, LLCore::HttpStatus status);  private: @@ -1278,7 +1278,7 @@ void LLAppearanceMgrHttpHandler::onCompleted(LLCore::HttpHandle handle, LLCore::  	LLHttpSDHandler::onCompleted(handle, response);  } -void LLAppearanceMgrHttpHandler::onSuccess(LLCore::HttpResponse * response, LLSD &content) +void LLAppearanceMgrHttpHandler::onSuccess(LLCore::HttpResponse * response, const LLSD &content)  {  	if (!content.isMap())  	{ @@ -3443,7 +3443,7 @@ void LLAppearanceMgr::requestServerAppearanceUpdate()  	gAgentAvatarp->mLastUpdateRequestCOFVersion = cof_version; -	LLCore::HttpHandle handle = gAgent.requestPostCapibility("UpdateAvatarAppearance", url, postData, handler); +	LLCore::HttpHandle handle = gAgent.requestPostCapability("UpdateAvatarAppearance", url, postData, handler);  	if (handle == LLCORE_HTTP_HANDLE_INVALID)  	{ diff --git a/indra/newview/llavatarrenderinfoaccountant.cpp b/indra/newview/llavatarrenderinfoaccountant.cpp index 38e153137c..aeaa832bc7 100644 --- a/indra/newview/llavatarrenderinfoaccountant.cpp +++ b/indra/newview/llavatarrenderinfoaccountant.cpp @@ -43,7 +43,9 @@  #include "llviewerregion.h"  #include "llvoavatar.h"  #include "llworld.h" - +#include "llhttpsdhandler.h" +#include "httpheaders.h" +#include "httpoptions.h"  static	const std::string KEY_AGENTS = "agents";			// map  static 	const std::string KEY_WEIGHT = "weight";			// integer @@ -55,8 +57,113 @@ static	const std::string KEY_ERROR = "error";  // Send data updates about once per minute, only need per-frame resolution  LLFrameTimer LLAvatarRenderInfoAccountant::sRenderInfoReportTimer; +//LLCore::HttpRequest::ptr_t LLAvatarRenderInfoAccountant::sHttpRequest; + +#if 0 +//========================================================================= +class LLAvatarRenderInfoHandler : public LLHttpSDHandler +{ +public: +	LLAvatarRenderInfoHandler(const LLURI &uri, U64 regionHandle); + +protected: +	virtual void onSuccess(LLCore::HttpResponse * response, LLSD &content); +	virtual void onFailure(LLCore::HttpResponse * response, LLCore::HttpStatus status); + +private: +	U64	mRegionHandle; +}; + +LLAvatarRenderInfoHandler::LLAvatarRenderInfoHandler(const LLURI &uri, U64 regionHandle) : +	LLHttpSDHandler(uri), +	mRegionHandle(regionHandle) +{ +} + +void LLAvatarRenderInfoHandler::onSuccess(LLCore::HttpResponse * response, LLSD &content) +{ +	LLViewerRegion * regionp = LLWorld::getInstance()->getRegionFromHandle(mRegionHandle); +	if (regionp) +	{ +		if (LLAvatarRenderInfoAccountant::logRenderInfo()) +		{ +			LL_INFOS() << "LRI: Result for avatar weights request for region " << regionp->getName() << ":" << LL_ENDL; +		} + +		if (content.isMap()) +		{ +			if (content.has(KEY_AGENTS)) +			{ +				const LLSD & agents = content[KEY_AGENTS]; +				if (agents.isMap()) +				{ +					LLSD::map_const_iterator	report_iter = agents.beginMap(); +					while (report_iter != agents.endMap()) +					{ +						LLUUID target_agent_id = LLUUID(report_iter->first); +						const LLSD & agent_info_map = report_iter->second; +						LLViewerObject* avatarp = gObjectList.findObject(target_agent_id); +						if (avatarp && +							avatarp->isAvatar() && +							agent_info_map.isMap()) +						{	// Extract the data for this avatar + +							if (LLAvatarRenderInfoAccountant::logRenderInfo()) +							{ +								LL_INFOS() << "LRI:  Agent " << target_agent_id +									<< ": " << agent_info_map << LL_ENDL; +							} + +							if (agent_info_map.has(KEY_WEIGHT)) +							{ +								((LLVOAvatar *)avatarp)->setReportedVisualComplexity(agent_info_map[KEY_WEIGHT].asInteger()); +							} +						} +						report_iter++; +					} +				} +			}	// has "agents" +			else if (content.has(KEY_ERROR)) +			{ +				const LLSD & error = content[KEY_ERROR]; +				LL_WARNS() << "Avatar render info GET error: " +					<< error[KEY_IDENTIFIER] +					<< ": " << error[KEY_MESSAGE] +					<< " from region " << regionp->getName() +					<< LL_ENDL; +			} +		} +	} +	else +	{ +		LL_INFOS() << "Avatar render weight info received but region not found for " +			<< mRegionHandle << LL_ENDL; +	} +} +void LLAvatarRenderInfoHandler::onFailure(LLCore::HttpResponse * response, LLCore::HttpStatus status) +{ +	LLViewerRegion * regionp = LLWorld::getInstance()->getRegionFromHandle(mRegionHandle); +	if (regionp) +	{ +		LL_WARNS() << "HTTP error result for avatar weight GET: " << status.toULong() +			<< ", " << status.toString() +			<< " returned by region " << regionp->getName() +			<< LL_ENDL; +	} +	else +	{ +		LL_WARNS() << "Avatar render weight GET error received but region not found for "  +			<< mRegionHandle  +			<< ", error " << status.toULong() +			<< ", " << status.toString() +			<< LL_ENDL; +	} +} + +//------------------------------------------------------------------------- +#else  // HTTP responder class for GET request for avatar render weight information  class LLAvatarRenderInfoGetResponder : public LLHTTPClient::Responder  { @@ -142,7 +249,7 @@ public:  		}  		else  		{ -			LL_INFOS() << "Avatar render weight info recieved but region not found for "  +			LL_INFOS() << "Avatar render weight info received but region not found for "   				<< mRegionHandle << LL_ENDL;  		}  	} @@ -150,7 +257,7 @@ public:  private:  	U64		mRegionHandle;  }; - +#endif  // HTTP responder class for POST request for avatar render weight information  class LLAvatarRenderInfoPostResponder : public LLHTTPClient::Responder @@ -172,7 +279,7 @@ public:  		}  		else  		{ -			LL_WARNS() << "Avatar render weight POST error recieved but region not found for "  +			LL_WARNS() << "Avatar render weight POST error received but region not found for "   				<< mRegionHandle   				<< ", error " << statusNum   				<< ", " << reason @@ -215,7 +322,6 @@ private:  	U64		mRegionHandle;  }; -  // static   // Send request for one region, no timer checks  void LLAvatarRenderInfoAccountant::sendRenderInfoToRegion(LLViewerRegion * regionp) @@ -292,7 +398,19 @@ void LLAvatarRenderInfoAccountant::getRenderInfoFromRegion(LLViewerRegion * regi  		}  		// First send a request to get the latest data +#if 0 +		if (!LLAvatarRenderInfoAccountant::sHttpRequest) +			sHttpRequest = LLCore::HttpRequest::ptr_t(new LLCore::HttpRequest()); +		LLAppCoreHttp & app_core_http(LLAppViewer::instance()->getAppCoreHttp()); + +		LLCore::HttpHeaders::ptr_t httpHeaders = LLCore::HttpHeaders::ptr_t(new LLCore::HttpHeaders(), false); +		LLCore::HttpOptions::ptr_t httpOptions = LLCore::HttpOptions::ptr_t(new LLCore::HttpOptions(), false); +		LLCore::HttpRequest::policy_t httpPolicy = app_core_http.getPolicy(LLAppCoreHttp::AP_AGENT); + +		LLCore::HttpHandle handle = sHttpRequest-> +#else  		LLHTTPClient::get(url, new LLAvatarRenderInfoGetResponder(regionp->getHandle())); +#endif  	}  } @@ -301,6 +419,9 @@ void LLAvatarRenderInfoAccountant::getRenderInfoFromRegion(LLViewerRegion * regi  // Called every frame - send render weight requests to every region  void LLAvatarRenderInfoAccountant::idle()  { +//	if (!LLAvatarRenderInfoAccountant::sHttpRequest) +//		sHttpRequest = LLCore::HttpRequest::ptr_t(new LLCore::HttpRequest()); +  	if (sRenderInfoReportTimer.hasExpired())  	{  		const F32 SECS_BETWEEN_REGION_SCANS   =  5.f;		// Scan the region list every 5 seconds diff --git a/indra/newview/llavatarrenderinfoaccountant.h b/indra/newview/llavatarrenderinfoaccountant.h index d68f2dccfb..13054f5e2f 100644 --- a/indra/newview/llavatarrenderinfoaccountant.h +++ b/indra/newview/llavatarrenderinfoaccountant.h @@ -29,6 +29,8 @@  #if ! defined(LL_llavatarrenderinfoaccountant_H)  #define LL_llavatarrenderinfoaccountant_H +#include "httpcommon.h" +  class LLViewerRegion;  // Class to gather avatar rendering information  @@ -36,8 +38,6 @@ class LLViewerRegion;  class LLAvatarRenderInfoAccountant  {  public: -	LLAvatarRenderInfoAccountant()	{}; -	~LLAvatarRenderInfoAccountant()	{};  	static void sendRenderInfoToRegion(LLViewerRegion * regionp);  	static void getRenderInfoFromRegion(LLViewerRegion * regionp); @@ -49,8 +49,14 @@ public:  	static bool logRenderInfo();  private: +	LLAvatarRenderInfoAccountant() {}; +	~LLAvatarRenderInfoAccountant()	{}; +  	// Send data updates about once per minute, only need per-frame resolution  	static LLFrameTimer sRenderInfoReportTimer; + +//	static LLCore::HttpRequest::ptr_t	sHttpRequest; +  };  #endif /* ! defined(LL_llavatarrenderinfoaccountant_H) */ diff --git a/indra/newview/llmaterialmgr.cpp b/indra/newview/llmaterialmgr.cpp index 065d763596..78fbe9af0a 100755 --- a/indra/newview/llmaterialmgr.cpp +++ b/indra/newview/llmaterialmgr.cpp @@ -75,7 +75,7 @@ public:  	virtual ~LLMaterialHttpHandler();  protected: -	virtual void onSuccess(LLCore::HttpResponse * response, LLSD &content); +	virtual void onSuccess(LLCore::HttpResponse * response, const LLSD &content);  	virtual void onFailure(LLCore::HttpResponse * response, LLCore::HttpStatus status);  private: @@ -95,7 +95,7 @@ LLMaterialHttpHandler::~LLMaterialHttpHandler()  {  } -void LLMaterialHttpHandler::onSuccess(LLCore::HttpResponse * response, LLSD &content) +void LLMaterialHttpHandler::onSuccess(LLCore::HttpResponse * response, const LLSD &content)  {  	LL_DEBUGS("Materials") << LL_ENDL;  	mCallback(true, content); | 
