diff options
Diffstat (limited to 'indra/newview/llmeshrepository.cpp')
-rwxr-xr-x | indra/newview/llmeshrepository.cpp | 122 |
1 files changed, 62 insertions, 60 deletions
diff --git a/indra/newview/llmeshrepository.cpp b/indra/newview/llmeshrepository.cpp index 2e02805c02..ff4d96eb54 100755 --- a/indra/newview/llmeshrepository.cpp +++ b/indra/newview/llmeshrepository.cpp @@ -29,7 +29,7 @@ #include "apr_pools.h" #include "apr_dso.h" -#include "llhttpstatuscodes.h" +#include "llhttpconstants.h" #include "llmeshrepository.h" #include "llagent.h" @@ -203,6 +203,7 @@ U32 LLMeshRepoThread::sMaxConcurrentRequests = 1; class LLMeshHeaderResponder : public LLCurl::Responder { + LOG_CLASS(LLMeshHeaderResponder); public: LLVolumeParams mMeshParams; bool mProcessed; @@ -231,14 +232,14 @@ public: } } - virtual void completedRaw(U32 status, const std::string& reason, - const LLChannelDescriptors& channels, + virtual void completedRaw(const LLChannelDescriptors& channels, const LLIOPipe::buffer_ptr_t& buffer); }; class LLMeshLODResponder : public LLCurl::Responder { + LOG_CLASS(LLMeshLODResponder); public: LLVolumeParams mMeshParams; S32 mLOD; @@ -267,14 +268,14 @@ public: } } - virtual void completedRaw(U32 status, const std::string& reason, - const LLChannelDescriptors& channels, + virtual void completedRaw(const LLChannelDescriptors& channels, const LLIOPipe::buffer_ptr_t& buffer); }; class LLMeshSkinInfoResponder : public LLCurl::Responder { + LOG_CLASS(LLMeshSkinInfoResponder); public: LLUUID mMeshID; U32 mRequestedBytes; @@ -299,14 +300,14 @@ public: } } - virtual void completedRaw(U32 status, const std::string& reason, - const LLChannelDescriptors& channels, + virtual void completedRaw(const LLChannelDescriptors& channels, const LLIOPipe::buffer_ptr_t& buffer); }; class LLMeshDecompositionResponder : public LLCurl::Responder { + LOG_CLASS(LLMeshDecompositionResponder); public: LLUUID mMeshID; U32 mRequestedBytes; @@ -331,14 +332,14 @@ public: } } - virtual void completedRaw(U32 status, const std::string& reason, - const LLChannelDescriptors& channels, + virtual void completedRaw(const LLChannelDescriptors& channels, const LLIOPipe::buffer_ptr_t& buffer); }; class LLMeshPhysicsShapeResponder : public LLCurl::Responder { + LOG_CLASS(LLMeshPhysicsShapeResponder); public: LLUUID mMeshID; U32 mRequestedBytes; @@ -363,8 +364,7 @@ public: } } - virtual void completedRaw(U32 status, const std::string& reason, - const LLChannelDescriptors& channels, + virtual void completedRaw(const LLChannelDescriptors& channels, const LLIOPipe::buffer_ptr_t& buffer); }; @@ -420,6 +420,7 @@ void log_upload_error(S32 status, const LLSD& content, std::string stage, std::s class LLWholeModelFeeResponder: public LLCurl::Responder { + LOG_CLASS(LLWholeModelFeeResponder); LLMeshUploadThread* mThread; LLSD mModelData; LLHandle<LLWholeModelFeeObserver> mObserverHandle; @@ -443,21 +444,20 @@ public: } } - virtual void completed(U32 status, - const std::string& reason, - const LLSD& content) +protected: + virtual void httpCompleted() { - LLSD cc = content; + LLSD cc = getContent(); if (gSavedSettings.getS32("MeshUploadFakeErrors")&1) { cc = llsd_from_file("fake_upload_error.xml"); } - + dump_llsd_to_file(cc,make_dump_name("whole_model_fee_response_",dump_num)); LLWholeModelFeeObserver* observer = mObserverHandle.get(); - if (isGoodStatus(status) && + if (isGoodStatus() && cc["state"].asString() == "upload") { mThread->mWholeModelUploadURL = cc["uploader"].asString(); @@ -470,13 +470,14 @@ public: } else { - llwarns << "fee request failed" << llendl; + llwarns << "fee request failed " << dumpResponse() << llendl; + S32 status = getStatus(); log_upload_error(status,cc,"fee",mModelData["name"]); mThread->mWholeModelUploadURL = ""; if (observer) { - observer->setModelPhysicsFeeErrorStatus(status, reason); + observer->setModelPhysicsFeeErrorStatus(status, getReason()); } } } @@ -485,6 +486,7 @@ public: class LLWholeModelUploadResponder: public LLCurl::Responder { + LOG_CLASS(LLWholeModelUploadResponder); LLMeshUploadThread* mThread; LLSD mModelData; LLHandle<LLWholeModelUploadObserver> mObserverHandle; @@ -509,11 +511,10 @@ public: } } - virtual void completed(U32 status, - const std::string& reason, - const LLSD& content) +protected: + virtual void httpCompleted() { - LLSD cc = content; + LLSD cc = getContent(); if (gSavedSettings.getS32("MeshUploadFakeErrors")&2) { cc = llsd_from_file("fake_upload_error.xml"); @@ -525,7 +526,7 @@ public: // requested "mesh" asset type isn't actually the type // of the resultant object, fix it up here. - if (isGoodStatus(status) && + if (isGoodStatus() && cc["state"].asString() == "complete") { mModelData["asset_type"] = "object"; @@ -538,9 +539,9 @@ public: } else { - llwarns << "upload failed" << llendl; + llwarns << "upload failed " << dumpResponse() << llendl; std::string model_name = mModelData["name"].asString(); - log_upload_error(status,cc,"upload",model_name); + log_upload_error(getStatus(),cc,"upload",model_name); if (observer) { @@ -829,7 +830,7 @@ bool LLMeshRepoThread::fetchMeshSkinInfo(const LLUUID& mesh_id) //reading from VFS failed for whatever reason, fetch from sim std::vector<std::string> headers; - headers.push_back("Accept: application/octet-stream"); + headers.push_back(HTTP_OUT_HEADER_ACCEPT + ": " + HTTP_CONTENT_OCTET_STREAM); std::string http_url = constructUrl(mesh_id); if (!http_url.empty()) @@ -911,7 +912,7 @@ bool LLMeshRepoThread::fetchMeshDecomposition(const LLUUID& mesh_id) //reading from VFS failed for whatever reason, fetch from sim std::vector<std::string> headers; - headers.push_back("Accept: application/octet-stream"); + headers.push_back(HTTP_OUT_HEADER_ACCEPT + ": " + HTTP_CONTENT_OCTET_STREAM); std::string http_url = constructUrl(mesh_id); if (!http_url.empty()) @@ -992,7 +993,7 @@ bool LLMeshRepoThread::fetchMeshPhysicsShape(const LLUUID& mesh_id) //reading from VFS failed for whatever reason, fetch from sim std::vector<std::string> headers; - headers.push_back("Accept: application/octet-stream"); + headers.push_back(HTTP_OUT_HEADER_ACCEPT + ": " + HTTP_CONTENT_OCTET_STREAM); std::string http_url = constructUrl(mesh_id); if (!http_url.empty()) @@ -1073,7 +1074,7 @@ bool LLMeshRepoThread::fetchMeshHeader(const LLVolumeParams& mesh_params, U32& c //either cache entry doesn't exist or is corrupt, request header from simulator bool retval = true ; std::vector<std::string> headers; - headers.push_back("Accept: application/octet-stream"); + headers.push_back(HTTP_OUT_HEADER_ACCEPT + ": " + HTTP_CONTENT_OCTET_STREAM); std::string http_url = constructUrl(mesh_params.getSculptID()); if (!http_url.empty()) @@ -1148,7 +1149,7 @@ bool LLMeshRepoThread::fetchMeshLOD(const LLVolumeParams& mesh_params, S32 lod, //reading from VFS failed for whatever reason, fetch from sim std::vector<std::string> headers; - headers.push_back("Accept: application/octet-stream"); + headers.push_back(HTTP_OUT_HEADER_ACCEPT + ": " + HTTP_CONTENT_OCTET_STREAM); std::string http_url = constructUrl(mesh_id); if (!http_url.empty()) @@ -1919,10 +1920,10 @@ void LLMeshRepository::cacheOutgoingMesh(LLMeshUploadData& data, LLSD& header) } -void LLMeshLODResponder::completedRaw(U32 status, const std::string& reason, - const LLChannelDescriptors& channels, - const LLIOPipe::buffer_ptr_t& buffer) +void LLMeshLODResponder::completedRaw(const LLChannelDescriptors& channels, + const LLIOPipe::buffer_ptr_t& buffer) { + S32 status = getStatus(); mProcessed = true; // thread could have already be destroyed during logout @@ -1933,9 +1934,10 @@ void LLMeshLODResponder::completedRaw(U32 status, const std::string& reason, S32 data_size = buffer->countAfter(channels.in(), NULL); + // *TODO: What about 3xx redirect codes? What about status 400 (Bad Request)? if (status < 200 || status > 400) { - llwarns << status << ": " << reason << llendl; + llwarns << dumpResponse() << llendl; } if (data_size < mRequestedBytes) @@ -1948,8 +1950,8 @@ void LLMeshLODResponder::completedRaw(U32 status, const std::string& reason, } else { + llwarns << "Unhandled status " << dumpResponse() << llendl; llassert(status == HTTP_INTERNAL_ERROR || status == HTTP_SERVICE_UNAVAILABLE); //intentionally trigger a breakpoint - llwarns << "Unhandled status " << status << llendl; } return; } @@ -1983,10 +1985,10 @@ void LLMeshLODResponder::completedRaw(U32 status, const std::string& reason, delete [] data; } -void LLMeshSkinInfoResponder::completedRaw(U32 status, const std::string& reason, - const LLChannelDescriptors& channels, - const LLIOPipe::buffer_ptr_t& buffer) +void LLMeshSkinInfoResponder::completedRaw(const LLChannelDescriptors& channels, + const LLIOPipe::buffer_ptr_t& buffer) { + S32 status = getStatus(); mProcessed = true; // thread could have already be destroyed during logout @@ -1997,9 +1999,10 @@ void LLMeshSkinInfoResponder::completedRaw(U32 status, const std::string& reason S32 data_size = buffer->countAfter(channels.in(), NULL); + // *TODO: What about 3xx redirect codes? What about status 400 (Bad Request)? if (status < 200 || status > 400) { - llwarns << status << ": " << reason << llendl; + llwarns << dumpResponse() << llendl; } if (data_size < mRequestedBytes) @@ -2012,8 +2015,8 @@ void LLMeshSkinInfoResponder::completedRaw(U32 status, const std::string& reason } else { + llwarns << "Unhandled status " << dumpResponse() << llendl; llassert(status == HTTP_INTERNAL_ERROR || status == HTTP_SERVICE_UNAVAILABLE); //intentionally trigger a breakpoint - llwarns << "Unhandled status " << status << llendl; } return; } @@ -2047,10 +2050,10 @@ void LLMeshSkinInfoResponder::completedRaw(U32 status, const std::string& reason delete [] data; } -void LLMeshDecompositionResponder::completedRaw(U32 status, const std::string& reason, - const LLChannelDescriptors& channels, - const LLIOPipe::buffer_ptr_t& buffer) +void LLMeshDecompositionResponder::completedRaw(const LLChannelDescriptors& channels, + const LLIOPipe::buffer_ptr_t& buffer) { + S32 status = getStatus(); mProcessed = true; if( !gMeshRepo.mThread ) @@ -2060,9 +2063,10 @@ void LLMeshDecompositionResponder::completedRaw(U32 status, const std::string& r S32 data_size = buffer->countAfter(channels.in(), NULL); + // *TODO: What about 3xx redirect codes? What about status 400 (Bad Request)? if (status < 200 || status > 400) { - llwarns << status << ": " << reason << llendl; + llwarns << dumpResponse() << llendl; } if (data_size < mRequestedBytes) @@ -2075,8 +2079,8 @@ void LLMeshDecompositionResponder::completedRaw(U32 status, const std::string& r } else { + llwarns << "Unhandled status " << dumpResponse() << llendl; llassert(status == HTTP_INTERNAL_ERROR || status == HTTP_SERVICE_UNAVAILABLE); //intentionally trigger a breakpoint - llwarns << "Unhandled status " << status << llendl; } return; } @@ -2110,10 +2114,10 @@ void LLMeshDecompositionResponder::completedRaw(U32 status, const std::string& r delete [] data; } -void LLMeshPhysicsShapeResponder::completedRaw(U32 status, const std::string& reason, - const LLChannelDescriptors& channels, - const LLIOPipe::buffer_ptr_t& buffer) +void LLMeshPhysicsShapeResponder::completedRaw(const LLChannelDescriptors& channels, + const LLIOPipe::buffer_ptr_t& buffer) { + S32 status = getStatus(); mProcessed = true; // thread could have already be destroyed during logout @@ -2124,9 +2128,10 @@ void LLMeshPhysicsShapeResponder::completedRaw(U32 status, const std::string& re S32 data_size = buffer->countAfter(channels.in(), NULL); + // *TODO: What about 3xx redirect codes? What about status 400 (Bad Request)? if (status < 200 || status > 400) { - llwarns << status << ": " << reason << llendl; + llwarns << dumpResponse() << llendl; } if (data_size < mRequestedBytes) @@ -2139,8 +2144,8 @@ void LLMeshPhysicsShapeResponder::completedRaw(U32 status, const std::string& re } else { + llwarns << "Unhandled status " << dumpResponse() << llendl; llassert(status == HTTP_INTERNAL_ERROR || status == HTTP_SERVICE_UNAVAILABLE); //intentionally trigger a breakpoint - llwarns << "Unhandled status " << status << llendl; } return; } @@ -2174,10 +2179,10 @@ void LLMeshPhysicsShapeResponder::completedRaw(U32 status, const std::string& re delete [] data; } -void LLMeshHeaderResponder::completedRaw(U32 status, const std::string& reason, - const LLChannelDescriptors& channels, - const LLIOPipe::buffer_ptr_t& buffer) +void LLMeshHeaderResponder::completedRaw(const LLChannelDescriptors& channels, + const LLIOPipe::buffer_ptr_t& buffer) { + S32 status = getStatus(); mProcessed = true; // thread could have already be destroyed during logout @@ -2186,6 +2191,7 @@ void LLMeshHeaderResponder::completedRaw(U32 status, const std::string& reason, return; } + // *TODO: What about 3xx redirect codes? What about status 400 (Bad Request)? if (status < 200 || status > 400) { //llwarns @@ -2199,8 +2205,6 @@ void LLMeshHeaderResponder::completedRaw(U32 status, const std::string& reason, // and (somewhat more optional than the others) retries // again after some set period of time - llassert(status == HTTP_NOT_FOUND || status == HTTP_SERVICE_UNAVAILABLE || status == HTTP_REQUEST_TIME_OUT || status == HTTP_INTERNAL_ERROR); - if (status == HTTP_SERVICE_UNAVAILABLE || status == HTTP_REQUEST_TIME_OUT || status == HTTP_INTERNAL_ERROR) { //retry llwarns << "Timeout or service unavailable, retrying." << llendl; @@ -2213,7 +2217,7 @@ void LLMeshHeaderResponder::completedRaw(U32 status, const std::string& reason, } else { - llwarns << "Unhandled status: " << status << llendl; + llwarns << "Unhandled status " << dumpResponse() << llendl; } } @@ -2235,9 +2239,7 @@ void LLMeshHeaderResponder::completedRaw(U32 status, const std::string& reason, if (!success) { - llwarns - << "Unable to parse mesh header: " - << status << ": " << reason << llendl; + llwarns << "Unable to parse mesh header: " << dumpResponse() << llendl; } else if (data && data_size > 0) { |