summaryrefslogtreecommitdiff
path: root/indra/newview/llassetuploadresponders.cpp
diff options
context:
space:
mode:
authorSimon Linden <simon@lindenlab.com>2014-07-18 22:28:33 +0000
committerSimon Linden <simon@lindenlab.com>2014-07-18 22:28:33 +0000
commit7714c7679da7c6c28c3f3f09af6b586a680dc26c (patch)
treef14c766b090f50cbb866123305f676e831ef483b /indra/newview/llassetuploadresponders.cpp
parent1655887f30e40ea390b6dca9f64ac5e84309be05 (diff)
parentff3827f278d2d53f565bc585edc4db5bc5e5dc38 (diff)
Merge in downstream viewer-tiger
Diffstat (limited to 'indra/newview/llassetuploadresponders.cpp')
-rwxr-xr-xindra/newview/llassetuploadresponders.cpp128
1 files changed, 42 insertions, 86 deletions
diff --git a/indra/newview/llassetuploadresponders.cpp b/indra/newview/llassetuploadresponders.cpp
index d86e63589f..a98ff64d0a 100755
--- a/indra/newview/llassetuploadresponders.cpp
+++ b/indra/newview/llassetuploadresponders.cpp
@@ -225,37 +225,41 @@ LLAssetUploadResponder::~LLAssetUploadResponder()
}
// virtual
-void LLAssetUploadResponder::errorWithContent(U32 statusNum, const std::string& reason, const LLSD& content)
+void LLAssetUploadResponder::httpFailure()
{
- LL_INFOS() << "LLAssetUploadResponder::error [status:"
- << statusNum << "]: " << content << LL_ENDL;
+ // *TODO: Add adaptive retry policy?
+ LL_WARNS() << dumpResponse() << LL_ENDL;
LLSD args;
- switch(statusNum)
+ if (isHttpClientErrorStatus(getStatus()))
{
- case 400:
- args["FILE"] = (mFileName.empty() ? mVFileID.asString() : mFileName);
- args["REASON"] = "Error in upload request. Please visit "
- "http://secondlife.com/support for help fixing this problem.";
- LLNotificationsUtil::add("CannotUploadReason", args);
- break;
- case 500:
- default:
- args["FILE"] = (mFileName.empty() ? mVFileID.asString() : mFileName);
- args["REASON"] = "The server is experiencing unexpected "
- "difficulties.";
- LLNotificationsUtil::add("CannotUploadReason", args);
- break;
+ args["FILE"] = (mFileName.empty() ? mVFileID.asString() : mFileName);
+ args["REASON"] = "Error in upload request. Please visit "
+ "http://secondlife.com/support for help fixing this problem.";
+ LLNotificationsUtil::add("CannotUploadReason", args);
+ }
+ else
+ {
+ args["FILE"] = (mFileName.empty() ? mVFileID.asString() : mFileName);
+ args["REASON"] = "The server is experiencing unexpected "
+ "difficulties.";
+ LLNotificationsUtil::add("CannotUploadReason", args);
}
LLUploadDialog::modalUploadFinished();
LLFilePicker::instance().reset(); // unlock file picker when bulk upload fails
}
//virtual
-void LLAssetUploadResponder::result(const LLSD& content)
+void LLAssetUploadResponder::httpSuccess()
{
+ const LLSD& content = getContent();
+ if (!content.isMap())
+ {
+ failureResult(HTTP_INTERNAL_ERROR, "Malformed response contents", content);
+ return;
+ }
LL_DEBUGS() << "LLAssetUploadResponder::result from capabilities" << LL_ENDL;
- std::string state = content["state"];
+ const std::string& state = content["state"].asStringRef();
if (state == "upload")
{
@@ -280,7 +284,7 @@ void LLAssetUploadResponder::result(const LLSD& content)
void LLAssetUploadResponder::uploadUpload(const LLSD& content)
{
- std::string uploader = content["uploader"];
+ const std::string& uploader = content["uploader"].asStringRef();
if (mFileName.empty())
{
LLHTTPClient::postFile(uploader, mVFileID, mAssetType, this);
@@ -293,6 +297,7 @@ void LLAssetUploadResponder::uploadUpload(const LLSD& content)
void LLAssetUploadResponder::uploadFailure(const LLSD& content)
{
+ LL_WARNS() << dumpResponse() << LL_ENDL;
// remove the "Uploading..." message
LLUploadDialog::modalUploadFinished();
LLFloater* floater_snapshot = LLFloaterReg::findInstance("snapshot");
@@ -301,7 +306,7 @@ void LLAssetUploadResponder::uploadFailure(const LLSD& content)
floater_snapshot->notify(LLSD().with("set-finished", LLSD().with("ok", false).with("msg", "inventory")));
}
- std::string reason = content["state"];
+ const std::string& reason = content["state"].asStringRef();
// deal with L$ errors
if (reason == "insufficient funds")
{
@@ -340,9 +345,9 @@ LLNewAgentInventoryResponder::LLNewAgentInventoryResponder(
}
// virtual
-void LLNewAgentInventoryResponder::errorWithContent(U32 statusNum, const std::string& reason, const LLSD& content)
+void LLNewAgentInventoryResponder::httpFailure()
{
- LLAssetUploadResponder::errorWithContent(statusNum, reason, content);
+ LLAssetUploadResponder::httpFailure();
//LLImportColladaAssetCache::getInstance()->assetUploaded(mVFileID, LLUUID(), FALSE);
}
@@ -445,58 +450,6 @@ void LLNewAgentInventoryResponder::uploadComplete(const LLSD& content)
//LLImportColladaAssetCache::getInstance()->assetUploaded(mVFileID, content["new_asset"], TRUE);
}
-LLSendTexLayerResponder::LLSendTexLayerResponder(const LLSD& post_data,
- const LLUUID& vfile_id,
- LLAssetType::EType asset_type,
- LLBakedUploadData * baked_upload_data) :
- LLAssetUploadResponder(post_data, vfile_id, asset_type),
- mBakedUploadData(baked_upload_data)
-{
-}
-
-LLSendTexLayerResponder::~LLSendTexLayerResponder()
-{
- // mBakedUploadData is normally deleted by calls to LLViewerTexLayerSetBuffer::onTextureUploadComplete() below
- if (mBakedUploadData)
- { // ...but delete it in the case where uploadComplete() is never called
- delete mBakedUploadData;
- mBakedUploadData = NULL;
- }
-}
-
-
-// Baked texture upload completed
-void LLSendTexLayerResponder::uploadComplete(const LLSD& content)
-{
- LLUUID item_id = mPostData["item_id"];
-
- std::string result = content["state"];
- LLUUID new_id = content["new_asset"];
-
- LL_INFOS() << "result: " << result << " new_id: " << new_id << LL_ENDL;
- if (result == "complete"
- && mBakedUploadData != NULL)
- { // Invoke
- LLViewerTexLayerSetBuffer::onTextureUploadComplete(new_id, (void*) mBakedUploadData, 0, LL_EXSTAT_NONE);
- mBakedUploadData = NULL; // deleted in onTextureUploadComplete()
- }
- else
- { // Invoke the original callback with an error result
- LLViewerTexLayerSetBuffer::onTextureUploadComplete(new_id, (void*) mBakedUploadData, -1, LL_EXSTAT_NONE);
- mBakedUploadData = NULL; // deleted in onTextureUploadComplete()
- }
-}
-
-void LLSendTexLayerResponder::errorWithContent(U32 statusNum, const std::string& reason, const LLSD& content)
-{
- LL_INFOS() << "LLSendTexLayerResponder error [status:"
- << statusNum << "]: " << content << LL_ENDL;
-
- // Invoke the original callback with an error result
- LLViewerTexLayerSetBuffer::onTextureUploadComplete(LLUUID(), (void*) mBakedUploadData, -1, LL_EXSTAT_NONE);
- mBakedUploadData = NULL; // deleted in onTextureUploadComplete()
-}
-
LLUpdateAgentInventoryResponder::LLUpdateAgentInventoryResponder(
const LLSD& post_data,
const LLUUID& vfile_id,
@@ -1009,19 +962,14 @@ LLNewAgentInventoryVariablePriceResponder::~LLNewAgentInventoryVariablePriceResp
delete mImpl;
}
-void LLNewAgentInventoryVariablePriceResponder::errorWithContent(
- U32 statusNum,
- const std::string& reason,
- const LLSD& content)
+void LLNewAgentInventoryVariablePriceResponder::httpFailure()
{
- LL_DEBUGS()
- << "LLNewAgentInventoryVariablePrice::error " << statusNum
- << " reason: " << reason << LL_ENDL;
+ const LLSD& content = getContent();
+ LL_WARNS("Upload") << dumpResponse() << LL_ENDL;
- if ( content.has("error") )
+ static const std::string _ERROR = "error";
+ if ( content.has(_ERROR) )
{
- static const std::string _ERROR = "error";
-
mImpl->onTransportError(content[_ERROR]);
}
else
@@ -1030,8 +978,14 @@ void LLNewAgentInventoryVariablePriceResponder::errorWithContent(
}
}
-void LLNewAgentInventoryVariablePriceResponder::result(const LLSD& content)
+void LLNewAgentInventoryVariablePriceResponder::httpSuccess()
{
+ const LLSD& content = getContent();
+ if (!content.isMap())
+ {
+ failureResult(HTTP_INTERNAL_ERROR, "Malformed response contents", content);
+ return;
+ }
// Parse out application level errors and the appropriate
// responses for them
static const std::string _ERROR = "error";
@@ -1047,6 +1001,7 @@ void LLNewAgentInventoryVariablePriceResponder::result(const LLSD& content)
// Check for application level errors
if ( content.has(_ERROR) )
{
+ LL_WARNS("Upload") << dumpResponse() << LL_ENDL;
onApplicationLevelError(content[_ERROR]);
return;
}
@@ -1090,6 +1045,7 @@ void LLNewAgentInventoryVariablePriceResponder::result(const LLSD& content)
}
else
{
+ LL_WARNS("Upload") << dumpResponse() << LL_ENDL;
onApplicationLevelError("");
}
}