diff options
| author | simon <none@none> | 2013-04-11 16:04:21 -0700 | 
|---|---|---|
| committer | simon <none@none> | 2013-04-11 16:04:21 -0700 | 
| commit | c7bab8ab8b25249d1f8f87746b50fce4820f542a (patch) | |
| tree | f10f811e0a03002b4c545eb5c51f99d7c5b83a5b /indra/llmessage | |
| parent | a976f5c217ce97c70a7e151b9a490e6a6ebf1396 (diff) | |
| parent | 460c81070e5fa1c51ce7e186a9ecb8c5f1c995e1 (diff) | |
Merge
Diffstat (limited to 'indra/llmessage')
| -rw-r--r-- | indra/llmessage/CMakeLists.txt | 5 | ||||
| -rw-r--r-- | indra/llmessage/llavatarnamecache.cpp | 6 | ||||
| -rw-r--r-- | indra/llmessage/llcachename.cpp | 4 | ||||
| -rw-r--r-- | indra/llmessage/llcurl.cpp | 4 | ||||
| -rw-r--r-- | indra/llmessage/llhttpassetstorage.cpp | 4 | ||||
| -rwxr-xr-x[-rw-r--r--] | indra/llmessage/llhttpclient.cpp | 15 | ||||
| -rw-r--r-- | indra/llmessage/llhttpclientadapter.cpp | 7 | ||||
| -rw-r--r-- | indra/llmessage/lliosocket.cpp | 9 | ||||
| -rw-r--r-- | indra/llmessage/llregionflags.h | 65 | ||||
| -rw-r--r-- | indra/llmessage/llurlrequest.cpp | 4 | ||||
| -rw-r--r-- | indra/llmessage/message_prehash.cpp | 7 | ||||
| -rw-r--r-- | indra/llmessage/message_prehash.h | 7 | ||||
| -rw-r--r-- | indra/llmessage/tests/llhttpclient_test.cpp | 84 | ||||
| -rw-r--r-- | indra/llmessage/tests/test_llsdmessage_peer.py | 46 | 
14 files changed, 137 insertions, 130 deletions
| diff --git a/indra/llmessage/CMakeLists.txt b/indra/llmessage/CMakeLists.txt index d98781e9e6..1a90c32fe4 100644 --- a/indra/llmessage/CMakeLists.txt +++ b/indra/llmessage/CMakeLists.txt @@ -218,6 +218,9 @@ add_library (llmessage ${llmessage_SOURCE_FILES})  target_link_libraries(    llmessage    ${CURL_LIBRARIES} +  ${LLCOMMON_LIBRARIES} +  ${LLVFS_LIBRARES} +  ${LLMATH_LIBRARIES}    ${CARES_LIBRARIES}    ${OPENSSL_LIBRARIES}    ${CRYPTO_LIBRARIES} @@ -243,7 +246,7 @@ if (LL_TESTS)      ${LLVFS_LIBRARIES}      ${LLMATH_LIBRARIES}      ${LLCOMMON_LIBRARIES} -      ${GOOGLEMOCK_LIBRARIES} +    ${GOOGLEMOCK_LIBRARIES}      )    LL_ADD_INTEGRATION_TEST( diff --git a/indra/llmessage/llavatarnamecache.cpp b/indra/llmessage/llavatarnamecache.cpp index 8f91d2a23f..9a68093427 100644 --- a/indra/llmessage/llavatarnamecache.cpp +++ b/indra/llmessage/llavatarnamecache.cpp @@ -435,8 +435,10 @@ void LLAvatarNameCache::cleanupClass()  void LLAvatarNameCache::importFile(std::istream& istr)  {  	LLSD data; -	S32 parse_count = LLSDSerialize::fromXMLDocument(data, istr); -	if (parse_count < 1) return; +	if (LLSDParser::PARSE_FAILURE == LLSDSerialize::fromXMLDocument(data, istr)) +	{ +		return; +	}  	// by convention LLSD storage is a map  	// we only store one entry in the map diff --git a/indra/llmessage/llcachename.cpp b/indra/llmessage/llcachename.cpp index 3fb36eecf0..267c48e1d2 100644 --- a/indra/llmessage/llcachename.cpp +++ b/indra/llmessage/llcachename.cpp @@ -308,8 +308,10 @@ boost::signals2::connection LLCacheName::addObserver(const LLCacheNameCallback&  bool LLCacheName::importFile(std::istream& istr)  {  	LLSD data; -	if(LLSDSerialize::fromXMLDocument(data, istr) < 1) +	if(LLSDParser::PARSE_FAILURE == LLSDSerialize::fromXMLDocument(data, istr)) +	{  		return false; +	}  	// We'll expire entries more than a week old  	U32 now = (U32)time(NULL); diff --git a/indra/llmessage/llcurl.cpp b/indra/llmessage/llcurl.cpp index 6da153279c..f2a3e059ef 100644 --- a/indra/llmessage/llcurl.cpp +++ b/indra/llmessage/llcurl.cpp @@ -176,9 +176,11 @@ void LLCurl::Responder::completedRaw(  {  	LLSD content;  	LLBufferStream istr(channels, buffer.get()); -	if (!LLSDSerialize::fromXML(content, istr)) +	const bool emit_errors = false; +	if (LLSDParser::PARSE_FAILURE == LLSDSerialize::fromXML(content, istr, emit_errors))  	{  		llinfos << "Failed to deserialize LLSD. " << mURL << " [" << status << "]: " << reason << llendl; +		content["reason"] = reason;  	}  	completed(status, reason, content); diff --git a/indra/llmessage/llhttpassetstorage.cpp b/indra/llmessage/llhttpassetstorage.cpp index d6ed08055e..7dcf160c9b 100644 --- a/indra/llmessage/llhttpassetstorage.cpp +++ b/indra/llmessage/llhttpassetstorage.cpp @@ -747,9 +747,9 @@ LLAssetRequest* LLHTTPAssetStorage::findNextRequest(LLAssetStorage::request_list  	request_list_t::iterator running_end   = running.end();  	request_list_t::iterator pending_iter = pending.begin(); -	request_list_t::iterator pending_end  = pending.end(); +  	// Loop over all pending requests until we miss finding it in the running list. -	for (; pending_iter != pending_end; ++pending_iter) +	for (; pending_iter != pending.end(); ++pending_iter)  	{  		LLAssetRequest* req = *pending_iter;  		// Look for this pending request in the running list. diff --git a/indra/llmessage/llhttpclient.cpp b/indra/llmessage/llhttpclient.cpp index 0c325a68aa..3561459bb4 100644..100755 --- a/indra/llmessage/llhttpclient.cpp +++ b/indra/llmessage/llhttpclient.cpp @@ -222,7 +222,11 @@ static void request(  {  	if (!LLHTTPClient::hasPump())  	{ -		responder->completed(U32_MAX, "No pump", LLSD()); +		if (responder) +		{ +			responder->completed(U32_MAX, "No pump", LLSD()); +		} +		delete body_injector;  		return;  	}  	LLPumpIO::chain_t chain; @@ -230,8 +234,13 @@ static void request(  	LLURLRequest* req = new LLURLRequest(method, url);  	if(!req->isValid())//failed  	{ -		delete req ; -		return ; +		if (responder) +		{ +			responder->completed(498, "Internal Error - curl failure", LLSD()); +		} +		delete req; +		delete body_injector; +		return;  	}  	req->setSSLVerifyCallback(LLHTTPClient::getCertVerifyCallback(), (void *)req); diff --git a/indra/llmessage/llhttpclientadapter.cpp b/indra/llmessage/llhttpclientadapter.cpp index f5d7a9abb6..0b59209af1 100644 --- a/indra/llmessage/llhttpclientadapter.cpp +++ b/indra/llmessage/llhttpclientadapter.cpp @@ -43,8 +43,11 @@ void LLHTTPClientAdapter::get(const std::string& url, LLCurl::ResponderPtr respo  void LLHTTPClientAdapter::get(const std::string& url, LLCurl::ResponderPtr responder, const LLSD& headers)   {  	LLSD empty_pragma_header = headers; -	// as above -	empty_pragma_header["Pragma"] = " "; +	if (!empty_pragma_header.has("Pragma")) +	{ +		// as above +		empty_pragma_header["Pragma"] = " "; +	}  	LLHTTPClient::get(url, responder, empty_pragma_header);  } diff --git a/indra/llmessage/lliosocket.cpp b/indra/llmessage/lliosocket.cpp index 0287026659..2043bae5e7 100644 --- a/indra/llmessage/lliosocket.cpp +++ b/indra/llmessage/lliosocket.cpp @@ -592,6 +592,15 @@ LLIOPipe::EStatus LLIOServerSocket::process_impl(  	PUMP_DEBUG;  	apr_pool_t* new_pool = NULL;  	apr_status_t status = apr_pool_create(&new_pool, mPool); +	if(ll_apr_warn_status(status)) +	{ +		if(new_pool) +		{	 +			apr_pool_destroy(new_pool); +		} +		return STATUS_ERROR; +	} +  	apr_socket_t* socket = NULL;  	status = apr_socket_accept(  		&socket, diff --git a/indra/llmessage/llregionflags.h b/indra/llmessage/llregionflags.h index 7b796a0fa8..1cf940918b 100644 --- a/indra/llmessage/llregionflags.h +++ b/indra/llmessage/llregionflags.h @@ -28,95 +28,98 @@  #define LL_LLREGIONFLAGS_H  // Can you be hurt here? Should health be on? -const U32 REGION_FLAGS_ALLOW_DAMAGE				= (1 << 0); +const U64 REGION_FLAGS_ALLOW_DAMAGE				= (1 << 0);  // Can you make landmarks here? -const U32 REGION_FLAGS_ALLOW_LANDMARK			= (1 << 1); +const U64 REGION_FLAGS_ALLOW_LANDMARK			= (1 << 1);  // Do we reset the home position when someone teleports away from here? -const U32 REGION_FLAGS_ALLOW_SET_HOME			= (1 << 2); +const U64 REGION_FLAGS_ALLOW_SET_HOME			= (1 << 2);  // Do we reset the home position when someone teleports away from here? -const U32 REGION_FLAGS_RESET_HOME_ON_TELEPORT	= (1 << 3); +const U64 REGION_FLAGS_RESET_HOME_ON_TELEPORT	= (1 << 3);  // Does the sun move? -const U32 REGION_FLAGS_SUN_FIXED				= (1 << 4); +const U64 REGION_FLAGS_SUN_FIXED				= (1 << 4);  // Can't change the terrain heightfield, even on owned parcels,  // but can plant trees and grass. -const U32 REGION_FLAGS_BLOCK_TERRAFORM			= (1 << 6); +const U64 REGION_FLAGS_BLOCK_TERRAFORM			= (1 << 6);  // Can't release, sell, or buy land. -const U32 REGION_FLAGS_BLOCK_LAND_RESELL		= (1 << 7); +const U64 REGION_FLAGS_BLOCK_LAND_RESELL		= (1 << 7);  // All content wiped once per night -const U32 REGION_FLAGS_SANDBOX					= (1 << 8); -const U32 REGION_FLAGS_SKIP_COLLISIONS			= (1 << 12); // Pin all non agent rigid bodies -const U32 REGION_FLAGS_SKIP_SCRIPTS				= (1 << 13); -const U32 REGION_FLAGS_SKIP_PHYSICS				= (1 << 14); // Skip all physics -const U32 REGION_FLAGS_EXTERNALLY_VISIBLE		= (1 << 15); -const U32 REGION_FLAGS_ALLOW_RETURN_ENCROACHING_OBJECT = (1 << 16); -const U32 REGION_FLAGS_ALLOW_RETURN_ENCROACHING_ESTATE_OBJECT = (1 << 17); -const U32 REGION_FLAGS_BLOCK_DWELL				= (1 << 18); +const U64 REGION_FLAGS_SANDBOX					= (1 << 8); +const U64 REGION_FLAGS_SKIP_COLLISIONS			= (1 << 12); // Pin all non agent rigid bodies +const U64 REGION_FLAGS_SKIP_SCRIPTS				= (1 << 13); +const U64 REGION_FLAGS_SKIP_PHYSICS				= (1 << 14); // Skip all physics +const U64 REGION_FLAGS_EXTERNALLY_VISIBLE		= (1 << 15); +const U64 REGION_FLAGS_ALLOW_RETURN_ENCROACHING_OBJECT = (1 << 16); +const U64 REGION_FLAGS_ALLOW_RETURN_ENCROACHING_ESTATE_OBJECT = (1 << 17); +const U64 REGION_FLAGS_BLOCK_DWELL				= (1 << 18);  // Is flight allowed? -const U32 REGION_FLAGS_BLOCK_FLY				= (1 << 19);	 +const U64 REGION_FLAGS_BLOCK_FLY				= (1 << 19);	  // Is direct teleport (p2p) allowed? -const U32 REGION_FLAGS_ALLOW_DIRECT_TELEPORT	= (1 << 20); +const U64 REGION_FLAGS_ALLOW_DIRECT_TELEPORT	= (1 << 20);  // Is there an administrative override on scripts in the region at the  // moment. This is the similar skip scripts, except this flag is  // presisted in the database on an estate level. -const U32 REGION_FLAGS_ESTATE_SKIP_SCRIPTS		= (1 << 21); +const U64 REGION_FLAGS_ESTATE_SKIP_SCRIPTS		= (1 << 21); -const U32 REGION_FLAGS_RESTRICT_PUSHOBJECT		= (1 << 22); +const U64 REGION_FLAGS_RESTRICT_PUSHOBJECT		= (1 << 22); -const U32 REGION_FLAGS_DENY_ANONYMOUS			= (1 << 23); +const U64 REGION_FLAGS_DENY_ANONYMOUS			= (1 << 23); -const U32 REGION_FLAGS_ALLOW_PARCEL_CHANGES		= (1 << 26); +const U64 REGION_FLAGS_ALLOW_PARCEL_CHANGES		= (1 << 26); -const U32 REGION_FLAGS_ALLOW_VOICE = (1 << 28); +const U64 REGION_FLAGS_ALLOW_VOICE = (1 << 28); -const U32 REGION_FLAGS_BLOCK_PARCEL_SEARCH = (1 << 29); -const U32 REGION_FLAGS_DENY_AGEUNVERIFIED	= (1 << 30); +const U64 REGION_FLAGS_BLOCK_PARCEL_SEARCH = (1 << 29); +const U64 REGION_FLAGS_DENY_AGEUNVERIFIED	= (1 << 30); -const U32 REGION_FLAGS_DEFAULT = REGION_FLAGS_ALLOW_LANDMARK | +const U64 REGION_FLAGS_DEFAULT = REGION_FLAGS_ALLOW_LANDMARK |  								 REGION_FLAGS_ALLOW_SET_HOME |                                   REGION_FLAGS_ALLOW_PARCEL_CHANGES |                                   REGION_FLAGS_ALLOW_VOICE; -const U32 REGION_FLAGS_PRELUDE_SET = REGION_FLAGS_RESET_HOME_ON_TELEPORT; -const U32 REGION_FLAGS_PRELUDE_UNSET = REGION_FLAGS_ALLOW_LANDMARK  +const U64 REGION_FLAGS_PRELUDE_SET = REGION_FLAGS_RESET_HOME_ON_TELEPORT; +const U64 REGION_FLAGS_PRELUDE_UNSET = REGION_FLAGS_ALLOW_LANDMARK   									   | REGION_FLAGS_ALLOW_SET_HOME; -const U32 REGION_FLAGS_ESTATE_MASK = REGION_FLAGS_EXTERNALLY_VISIBLE +const U64 REGION_FLAGS_ESTATE_MASK = REGION_FLAGS_EXTERNALLY_VISIBLE  									 | REGION_FLAGS_SUN_FIXED  									 | REGION_FLAGS_DENY_ANONYMOUS  									 | REGION_FLAGS_DENY_AGEUNVERIFIED; -inline BOOL is_prelude( U32 flags ) +inline BOOL is_prelude( U64 flags )  {  	// definition of prelude does not depend on fixed-sun  	return 0 == (flags & REGION_FLAGS_PRELUDE_UNSET)  		   && 0 != (flags & REGION_FLAGS_PRELUDE_SET);  } -inline U32 set_prelude_flags(U32 flags) +inline U64 set_prelude_flags(U64 flags)  {  	// also set the sun-fixed flag  	return ((flags & ~REGION_FLAGS_PRELUDE_UNSET)  			| (REGION_FLAGS_PRELUDE_SET | REGION_FLAGS_SUN_FIXED));  } -inline U32 unset_prelude_flags(U32 flags) +inline U64 unset_prelude_flags(U64 flags)  {  	// also unset the fixed-sun flag  	return ((flags | REGION_FLAGS_PRELUDE_UNSET)   			& ~(REGION_FLAGS_PRELUDE_SET | REGION_FLAGS_SUN_FIXED));  } +// Region protocols +const U64 REGION_PROTOCOLS_AGENT_APPEARANCE_SERVICE = (1 << 0); +  // estate constants. Need to match first few etries in indra.estate table.  const U32 ESTATE_ALL = 0; // will not match in db, reserved key for logic  const U32 ESTATE_MAINLAND = 1; diff --git a/indra/llmessage/llurlrequest.cpp b/indra/llmessage/llurlrequest.cpp index 227efdb07a..627d591839 100644 --- a/indra/llmessage/llurlrequest.cpp +++ b/indra/llmessage/llurlrequest.cpp @@ -174,6 +174,10 @@ LLURLRequest::~LLURLRequest()  void LLURLRequest::setURL(const std::string& url)  {  	mDetail->mURL = url; +	if (url.empty()) +	{ +		llwarns << "empty URL specified" << llendl; +	}  }  std::string LLURLRequest::getURL() const diff --git a/indra/llmessage/message_prehash.cpp b/indra/llmessage/message_prehash.cpp index d7658862da..39cfb6019e 100644 --- a/indra/llmessage/message_prehash.cpp +++ b/indra/llmessage/message_prehash.cpp @@ -279,6 +279,8 @@ char const* const _PREHASH_GrabOffset = LLMessageStringTable::getInstance()->get  char const* const _PREHASH_SimPort = LLMessageStringTable::getInstance()->getString("SimPort");  char const* const _PREHASH_PricePerMeter = LLMessageStringTable::getInstance()->getString("PricePerMeter");  char const* const _PREHASH_RegionFlags = LLMessageStringTable::getInstance()->getString("RegionFlags"); +char const* const _PREHASH_RegionFlagsExtended = LLMessageStringTable::getInstance()->getString("RegionFlagsExtended"); +char const* const _PREHASH_RegionProtocols = LLMessageStringTable::getInstance()->getString("RegionProtocols");  char const* const _PREHASH_VoteResult = LLMessageStringTable::getInstance()->getString("VoteResult");  char const* const _PREHASH_ParcelDirFeeEstimate = LLMessageStringTable::getInstance()->getString("ParcelDirFeeEstimate");  char const* const _PREHASH_ModifyBlock = LLMessageStringTable::getInstance()->getString("ModifyBlock"); @@ -305,6 +307,8 @@ char const* const _PREHASH_ViewerStartAuction = LLMessageStringTable::getInstanc  char const* const _PREHASH_StartAuction = LLMessageStringTable::getInstance()->getString("StartAuction");  char const* const _PREHASH_DuplicateFlags = LLMessageStringTable::getInstance()->getString("DuplicateFlags");  char const* const _PREHASH_RegionInfo2 = LLMessageStringTable::getInstance()->getString("RegionInfo2"); +char const* const _PREHASH_RegionInfo3 = LLMessageStringTable::getInstance()->getString("RegionInfo3"); +char const* const _PREHASH_RegionInfo4 = LLMessageStringTable::getInstance()->getString("RegionInfo4");  char const* const _PREHASH_TextColor = LLMessageStringTable::getInstance()->getString("TextColor");  char const* const _PREHASH_SlaveID = LLMessageStringTable::getInstance()->getString("SlaveID");  char const* const _PREHASH_Charter = LLMessageStringTable::getInstance()->getString("Charter"); @@ -1376,3 +1380,6 @@ char const* const _PREHASH_ProductSKU = LLMessageStringTable::getInstance()->get  char const* const _PREHASH_SeeAVs = LLMessageStringTable::getInstance()->getString("SeeAVs");  char const* const _PREHASH_AnyAVSounds = LLMessageStringTable::getInstance()->getString("AnyAVSounds");  char const* const _PREHASH_GroupAVSounds = LLMessageStringTable::getInstance()->getString("GroupAVSounds"); +char const* const _PREHASH_AppearanceData = LLMessageStringTable::getInstance()->getString("AppearanceData"); +char const* const _PREHASH_AppearanceVersion = LLMessageStringTable::getInstance()->getString("AppearanceVersion"); +char const* const _PREHASH_CofVersion = LLMessageStringTable::getInstance()->getString("CofVersion"); diff --git a/indra/llmessage/message_prehash.h b/indra/llmessage/message_prehash.h index da2b613f53..573e10dc0b 100644 --- a/indra/llmessage/message_prehash.h +++ b/indra/llmessage/message_prehash.h @@ -279,6 +279,8 @@ extern char const* const _PREHASH_GrabOffset;  extern char const* const _PREHASH_SimPort;  extern char const* const _PREHASH_PricePerMeter;  extern char const* const _PREHASH_RegionFlags; +extern char const* const _PREHASH_RegionFlagsExtended; +extern char const* const _PREHASH_RegionProtocols;  extern char const* const _PREHASH_VoteResult;  extern char const* const _PREHASH_ParcelDirFeeEstimate;  extern char const* const _PREHASH_ModifyBlock; @@ -305,6 +307,8 @@ extern char const* const _PREHASH_ViewerStartAuction;  extern char const* const _PREHASH_StartAuction;  extern char const* const _PREHASH_DuplicateFlags;  extern char const* const _PREHASH_RegionInfo2; +extern char const* const _PREHASH_RegionInfo3; +extern char const* const _PREHASH_RegionInfo4;  extern char const* const _PREHASH_TextColor;  extern char const* const _PREHASH_SlaveID;  extern char const* const _PREHASH_Charter; @@ -1376,4 +1380,7 @@ extern char const* const _PREHASH_ProductSKU;  extern char const* const _PREHASH_SeeAVs;  extern char const* const _PREHASH_AnyAVSounds;  extern char const* const _PREHASH_GroupAVSounds; +extern char const* const _PREHASH_AppearanceData; +extern char const* const _PREHASH_AppearanceVersion; +extern char const* const _PREHASH_CofVersion;  #endif diff --git a/indra/llmessage/tests/llhttpclient_test.cpp b/indra/llmessage/tests/llhttpclient_test.cpp index 7c3def6024..87cbafa404 100644 --- a/indra/llmessage/tests/llhttpclient_test.cpp +++ b/indra/llmessage/tests/llhttpclient_test.cpp @@ -47,37 +47,6 @@  namespace tut  { -	LLSD storage; - -	class LLSDStorageNode : public LLHTTPNode -	{ -	public: -		LLSD simpleGet() const					{ return storage; } -		LLSD simplePut(const LLSD& value) const	{ storage = value; return LLSD(); } -	}; - -	class ErrorNode : public LLHTTPNode -	{ -	public: -		void get(ResponsePtr r, const LLSD& context) const -			{ r->status(599, "Intentional error"); } -		void post(ResponsePtr r, const LLSD& context, const LLSD& input) const -			{ r->status(input["status"], input["reason"]); } -	}; - -	class TimeOutNode : public LLHTTPNode -	{ -	public: -		void get(ResponsePtr r, const LLSD& context) const -		{ -            /* do nothing, the request will eventually time out */  -		} -	}; - -	LLHTTPRegistration<LLSDStorageNode> gStorageNode("/test/storage"); -	LLHTTPRegistration<ErrorNode>		gErrorNode("/test/error"); -	LLHTTPRegistration<TimeOutNode>		gTimeOutNode("/test/timeout"); -  	struct HTTPClientTestData  	{  	public: @@ -91,7 +60,6 @@ namespace tut  			ensure("Set environment variable PORT to local test server port", PORT);  			apr_pool_create(&mPool, NULL);  			LLCurl::initClass(false); -			mServerPump = new LLPumpIO(mPool);  			mClientPump = new LLPumpIO(mPool);  			LLHTTPClient::setPump(*mClientPump); @@ -99,20 +67,11 @@ namespace tut  		~HTTPClientTestData()  		{ -			delete mServerPump;  			delete mClientPump;  			LLProxy::cleanupClass();  			apr_pool_destroy(mPool);  		} -		void setupTheServer() -		{ -			LLHTTPNode& root = LLIOHTTPServer::create(mPool, *mServerPump, 8888); - -			LLHTTPStandardServices::useServices(); -			LLHTTPRegistrar::buildAllServices(root); -		} -  		void runThePump(float timeout = 100.0f)  		{  			LLTimer timer; @@ -120,11 +79,7 @@ namespace tut  			while(!mSawCompleted && !mSawCompletedHeader && !timer.hasExpired())  			{ -				if (mServerPump) -				{ -					mServerPump->pump(); -					mServerPump->callback(); -				} +				LLFrameTimer::updateFrameTime();  				if (mClientPump)  				{  					mClientPump->pump(); @@ -133,18 +88,11 @@ namespace tut  			}  		} -		void killServer() -		{ -			delete mServerPump; -			mServerPump = NULL; -		} -  		const char* const PORT;  		const std::string local_server;  	private:  		apr_pool_t* mPool; -		LLPumpIO* mServerPump;  		LLPumpIO* mClientPump;  	protected: @@ -288,14 +236,12 @@ namespace tut  		sd["list"][1]["three"] = 3;  		sd["list"][1]["four"] = 4; -		setupTheServer(); - -		LLHTTPClient::post("http://localhost:8888/web/echo", sd, newResult()); +		LLHTTPClient::post(local_server + "web/echo", sd, newResult());  		runThePump();  		ensureStatusOK();  		ensure_equals("echoed result matches", getResult(), sd);  	} - +		  	template<> template<>  		void HTTPClientTestObject::test<4>()  	{ @@ -303,12 +249,11 @@ namespace tut  		sd["message"] = "This is my test message."; -		setupTheServer(); -		LLHTTPClient::put("http://localhost:8888/test/storage", sd, newResult()); +		LLHTTPClient::put(local_server + "test/storage", sd, newResult());  		runThePump();  		ensureStatusOK(); -		LLHTTPClient::get("http://localhost:8888/test/storage", newResult()); +		LLHTTPClient::get(local_server + "test/storage", newResult());  		runThePump();  		ensureStatusOK();  		ensure_equals("echoed result matches", getResult(), sd); @@ -322,9 +267,7 @@ namespace tut  		sd["status"] = 543;  		sd["reason"] = "error for testing"; -		setupTheServer(); - -		LLHTTPClient::post("http://localhost:8888/test/error", sd, newResult()); +		LLHTTPClient::post(local_server + "test/error", sd, newResult());  		runThePump();  		ensureStatusError();  		ensure_contains("reason", mReason, sd["reason"]); @@ -333,23 +276,16 @@ namespace tut  	template<> template<>  		void HTTPClientTestObject::test<6>()  	{ -		setupTheServer(); - -		LLHTTPClient::get("http://localhost:8888/test/timeout", newResult()); -		runThePump(1.0f); -		killServer(); -		runThePump(); +		const F32 timeout = 1.0f; +		LLHTTPClient::get(local_server + "test/timeout", newResult(), LLSD(), timeout); +		runThePump(timeout * 5.0f);  		ensureStatusError(); -		ensure_equals("reason", mReason, "STATUS_ERROR"); +		ensure_equals("reason", mReason, "STATUS_EXPIRED");  	}  	template<> template<>  		void HTTPClientTestObject::test<7>()  	{ -		// Can not use the little mini server.  The blocking request -		// won't ever let it run.  Instead get from a known LLSD -		// source and compare results with the non-blocking get which -		// is tested against the mini server earlier.  		LLHTTPClient::get(local_server, newResult());  		runThePump();  		ensureStatusOK(); diff --git a/indra/llmessage/tests/test_llsdmessage_peer.py b/indra/llmessage/tests/test_llsdmessage_peer.py index fe4f3a8c01..e45249b1cb 100644 --- a/indra/llmessage/tests/test_llsdmessage_peer.py +++ b/indra/llmessage/tests/test_llsdmessage_peer.py @@ -39,6 +39,9 @@ sys.path.insert(0, os.path.join(mydir, os.pardir, os.pardir, "lib", "python"))  from indra.util.fastest_elementtree import parse as xml_parse  from indra.base import llsd  from testrunner import freeport, run, debug, VERBOSE +import time + +_storage=None  class TestHTTPRequestHandler(BaseHTTPRequestHandler):      """This subclass of BaseHTTPRequestHandler is to receive and echo @@ -90,21 +93,14 @@ class TestHTTPRequestHandler(BaseHTTPRequestHandler):          # Read the provided POST data.          self.answer(self.read_xml()) +    def do_PUT(self): +        # Read the provided PUT data. +        self.answer(self.read_xml()) +      def answer(self, data, withdata=True): +        global _storage          debug("%s.answer(%s): self.path = %r", self.__class__.__name__, data, self.path) -        if "fail" not in self.path: -            data = data.copy()          # we're going to modify -            # Ensure there's a "reply" key in data, even if there wasn't before -            data["reply"] = data.get("reply", llsd.LLSD("success")) -            response = llsd.format_xml(data) -            debug("success: %s", response) -            self.send_response(200) -            self.send_header("Content-type", "application/llsd+xml") -            self.send_header("Content-Length", str(len(response))) -            self.end_headers() -            if withdata: -                self.wfile.write(response) -        else:                           # fail requested +        if "fail" in self.path or "test/error" in self.path: # fail requested              status = data.get("status", 500)              # self.responses maps an int status to a (short, long) pair of              # strings. We want the longer string. That's why we pass a string @@ -117,6 +113,30 @@ class TestHTTPRequestHandler(BaseHTTPRequestHandler):                                                     "without providing a reason" % status))[1])              debug("fail requested: %s: %r", status, reason)              self.send_error(status, reason) +        else: +            if "web/echo" in self.path: +                pass +            elif "test/timeout" in self.path: +                time.sleep(5.0) +                return +            elif "test/storage" in self.path: +                if "GET" == self.command: +                    data = _storage +                else: +                    _storage = data +                    data = "ok" +            else: +                data = data.copy()          # we're going to modify +                # Ensure there's a "reply" key in data, even if there wasn't before +                data["reply"] = data.get("reply", llsd.LLSD("success")) +            response = llsd.format_xml(data) +            debug("success: %s", response) +            self.send_response(200) +            self.send_header("Content-type", "application/llsd+xml") +            self.send_header("Content-Length", str(len(response))) +            self.end_headers() +            if withdata: +                self.wfile.write(response)      if not VERBOSE:          # When VERBOSE is set, skip both these overrides because they exist to | 
