From b51b8035b44d3345a649eed8212c41dfd1581733 Mon Sep 17 00:00:00 2001 From: Ansariel Date: Wed, 22 Oct 2014 03:21:14 +0200 Subject: [PATCH] Post-merge curl fixing --- indra/newview/fsdata.cpp | 30 +++++++++++++++++++----------- indra/newview/fsgridhandler.cpp | 25 ++++++++++++------------- indra/newview/llstartup.cpp | 14 +++++++------- 3 files changed, 38 insertions(+), 31 deletions(-) diff --git a/indra/newview/fsdata.cpp b/indra/newview/fsdata.cpp index 669ce750a5..650ef2228e 100644 --- a/indra/newview/fsdata.cpp +++ b/indra/newview/fsdata.cpp @@ -76,27 +76,32 @@ public: mURL(url) {} - void result(const LLSD& content) + void httpSuccess() { // check for parse failure that can happen with [200] OK result. if (mDeserializeError) { - FSData::getInstance()->processResponder(content, mURL, false, mLastModified); + FSData::getInstance()->processResponder(getContent(), mURL, false, mLastModified); } else { - FSData::getInstance()->processResponder(content, mURL, true, mLastModified); + FSData::getInstance()->processResponder(getContent(), mURL, true, mLastModified); } + + completedHeader(); } - void errorWithContent(U32 status, const std::string& reason, const LLSD& content) + void httpFailure() { - FSData::getInstance()->processResponder(content, mURL, false, mLastModified); + FSData::getInstance()->processResponder(getContent(), mURL, false, mLastModified); + + completedHeader(); } - void completedHeader(U32 status, const std::string& reason, const LLSD& content) + void completedHeader() { - LL_DEBUGS("fsdata") << "Status: [" << status << "]: " << "last-modified: " << content["last-modified"].asString() << LL_ENDL; // Wed, 21 Mar 2012 17:41:14 GMT + LLSD content = getResponseHeaders(); + LL_DEBUGS("fsdata") << "Status: [" << getStatus() << "]: " << "last-modified: " << content["last-modified"].asString() << LL_ENDL; // Wed, 21 Mar 2012 17:41:14 GMT if (content.has("last-modified")) { mLastModified.secondsSinceEpoch(FSCommon::secondsSinceEpochFromString("%a, %d %b %Y %H:%M:%S %ZP", content["last-modified"].asString())); @@ -122,9 +127,11 @@ public: const LLChannelDescriptors& channels, const LLIOPipe::buffer_ptr_t& buffer) { + completedHeader(); + if (!isGoodStatus()) { - if (getStatus() == 304) + if (getStatus() == HTTP_NOT_MODIFIED) { LL_INFOS("fsdata") << "Got [304] not modified for " << mURL << LL_ENDL; } @@ -138,7 +145,7 @@ public: S32 data_size = buffer->countAfter(channels.in(), NULL); if (data_size <= 0) { - LL_WARNS("fsdata") << "Recieved zero data for " << mURL << LL_ENDL; + LL_WARNS("fsdata") << "Received zero data for " << mURL << LL_ENDL; return; } @@ -172,9 +179,10 @@ public: data = NULL; } - void completedHeader(U32 status, const std::string& reason, const LLSD& content) + void completedHeader() { - LL_DEBUGS("fsdata") << "Status: [" << status << "]: " << "last-modified: " << content["last-modified"].asString() << LL_ENDL; // Wed, 21 Mar 2012 17:41:14 GMT + LLSD content = getResponseHeaders(); + LL_DEBUGS("fsdata") << "Status: [" << getStatus() << "]: " << "last-modified: " << content["last-modified"].asString() << LL_ENDL; // Wed, 21 Mar 2012 17:41:14 GMT if (content.has("last-modified")) { mLastModified.secondsSinceEpoch(FSCommon::secondsSinceEpochFromString("%a, %d %b %Y %H:%M:%S %ZP", content["last-modified"].asString())); diff --git a/indra/newview/fsgridhandler.cpp b/indra/newview/fsgridhandler.cpp index 68ebf54451..f24344f891 100644 --- a/indra/newview/fsgridhandler.cpp +++ b/indra/newview/fsgridhandler.cpp @@ -67,17 +67,16 @@ public: } // the grid info is no LLSD *sigh* ... override the default LLSD parsing behaviour - virtual void completedRaw(U32 status, const std::string& reason, - const LLChannelDescriptors& channels, - const LLIOPipe::buffer_ptr_t& buffer) + virtual void completedRaw(const LLChannelDescriptors& channels, + const LLIOPipe::buffer_ptr_t& buffer) { mOwner->decResponderCount(); - LL_DEBUGS("GridManager") << mData->grid[GRID_VALUE] << " status: " << status << " reason: " << reason << LL_ENDL; - if(LLGridManager::TRYLEGACY == mState && 200 == status) + LL_DEBUGS("GridManager") << mData->grid[GRID_VALUE] << " status: " << getStatus() << " reason: " << getReason() << LL_ENDL; + if(LLGridManager::TRYLEGACY == mState && HTTP_OK == getStatus()) { mOwner->addGrid(mData, LLGridManager::SYSTEM); } - else if (200 == status)// OK + else if (HTTP_OK == getStatus())// OK { LL_DEBUGS("GridManager") << "Parsing gridinfo xml file from " << mData->grid[GRID_VALUE] << LL_ENDL; @@ -101,29 +100,29 @@ public: mOwner->addGrid(mData, LLGridManager::FAIL); } } - else if (304 == status && !LLGridManager::TRYLEGACY == mState)// not modified + else if (HTTP_NOT_MODIFIED == getStatus() && !LLGridManager::TRYLEGACY == mState)// not modified { mOwner->addGrid(mData, LLGridManager::FINISH); } - else if (499 == status && LLGridManager::LOCAL == mState) //add localhost even if its not up + else if (HTTP_INTERNAL_ERROR == getStatus() && LLGridManager::LOCAL == mState) //add localhost even if its not up { mOwner->addGrid(mData, LLGridManager::FINISH); //since we know now that its not up we cold also start it } else { - error(status, reason); + httpFailure(); } } - virtual void result(const LLSD& content) + virtual void httpSuccess() { } - virtual void error(U32 status, const std::string& reason) + virtual void httpFailure() { - if (504 == status)// gateway timeout ... well ... retry once >_> + if (HTTP_GATEWAY_TIME_OUT == getStatus())// gateway timeout ... well ... retry once >_> { if (LLGridManager::FETCH == mState) { @@ -150,7 +149,7 @@ public: { // remember the error we got when trying to get grid info where we expect it std::ostringstream last_error; - last_error << status << " " << reason; + last_error << getStatus() << " " << getReason(); mData->last_http_error = last_error.str(); mOwner->addGrid(mData, LLGridManager::TRYLEGACY); diff --git a/indra/newview/llstartup.cpp b/indra/newview/llstartup.cpp index d173e71d52..9022e2100c 100755 --- a/indra/newview/llstartup.cpp +++ b/indra/newview/llstartup.cpp @@ -343,28 +343,28 @@ class GridListRequestResponder : public LLHTTPClient::Responder { public: //If we get back a normal response, handle it here - virtual void result(const LLSD& content) + virtual void httpSuccess() { std::string filename = gDirUtilp->getExpandedFilename(LL_PATH_USER_SETTINGS, "grids.remote.xml"); llofstream out_file; out_file.open(filename); - LLSDSerialize::toPrettyXML(content, out_file); + LLSDSerialize::toPrettyXML(getContent(), out_file); out_file.close(); LL_INFOS() << "GridListRequest: got new list." << LL_ENDL; sGridListRequestReady = true; } //If we get back an error (not found, etc...), handle it here - virtual void error(U32 status, const std::string& reason) + virtual void httpFailure() { sGridListRequestReady = true; - if (304 == status) + if (HTTP_NOT_MODIFIED == getStatus()) { LL_DEBUGS("GridManager") << "<- no error :P ... GridListRequest: List not modified since last session" << LL_ENDL; } else - LL_WARNS() << "GridListRequest::error("<< status << ": " << reason << ")" << LL_ENDL; + LL_WARNS() << "GridListRequest::error("<< getStatus() << ": " << getReason() << ")" << LL_ENDL; } }; // @@ -376,9 +376,9 @@ public: virtual void completedRaw(const LLChannelDescriptors& channels, const LLIOPipe::buffer_ptr_t& buffer) { S32 status = getStatus(); - if (!isGoodStatus() && status != 304) + if (!isGoodStatus() && status != HTTP_NOT_MODIFIED) { - if (status == 499) + if (status == HTTP_INTERNAL_ERROR) { reportToNearbyChat(LLTrans::getString("SLGridStatusTimedOut")); }