diff options
author | Rider Linden <rider@lindenlab.com> | 2016-04-25 12:12:18 -0700 |
---|---|---|
committer | Rider Linden <rider@lindenlab.com> | 2016-04-25 12:12:18 -0700 |
commit | 1eaed3d37f49e1a9e4d1c6c432de7801797a5d49 (patch) | |
tree | dee4380972c7b60de17f58ee9801fc6702c67776 /indra | |
parent | 1fa27575113a552ded77bf9f19989c77b677bb7f (diff) | |
parent | 4d9dd3271b1a015d9afd21767e579a4cd71982ed (diff) |
Merge
Diffstat (limited to 'indra')
-rw-r--r-- | indra/llmessage/llcorehttputil.cpp | 38 | ||||
-rw-r--r-- | indra/llmessage/llcorehttputil.h | 9 | ||||
-rwxr-xr-x | indra/newview/llappcorehttp.cpp | 5 |
3 files changed, 46 insertions, 6 deletions
diff --git a/indra/llmessage/llcorehttputil.cpp b/indra/llmessage/llcorehttputil.cpp index 9a23ede81b..7742cbc182 100644 --- a/indra/llmessage/llcorehttputil.cpp +++ b/indra/llmessage/llcorehttputil.cpp @@ -41,14 +41,41 @@ #include "message.h" // for getting the port -using namespace LLCore; +using namespace LLCore; namespace LLCoreHttpUtil { const F32 HTTP_REQUEST_EXPIRY_SECS = 60.0f; +namespace +{ + const std::string HTTP_LOGBODY_KEY("HTTPLogBodyOnError"); + + BoolSettingQuery_t mBoolSettingGet; + BoolSettingUpdate_t mBoolSettingPut; + + inline bool getBoolSetting(const std::string &keyname) + { + if (!mBoolSettingGet || mBoolSettingGet.empty()) + return(false); + return mBoolSettingGet(HTTP_LOGBODY_KEY); + } + +} + +void setPropertyMethods(BoolSettingQuery_t queryfn, BoolSettingUpdate_t updatefn) +{ + mBoolSettingGet = queryfn; + mBoolSettingPut = updatefn; + + if (mBoolSettingPut && !mBoolSettingPut.empty()) + { + mBoolSettingPut(HTTP_LOGBODY_KEY, false, "Log the entire HTTP body in the case of an HTTP error."); + } +} + void logMessageSuccess(std::string logAuth, std::string url, std::string message) { @@ -293,10 +320,11 @@ void HttpCoroHandler::onCompleted(LLCore::HttpHandle handle, LLCore::HttpRespons bas >> std::noskipws; bodyData.assign(std::istream_iterator<U8>(bas), std::istream_iterator<U8>()); httpStatus["error_body"] = LLSD(bodyData); -#if 1 - // commenting out, but keeping since this can be useful for debugging - LL_WARNS() << "Returned body=" << std::endl << httpStatus["error_body"].asString() << LL_ENDL; -#endif + if (getBoolSetting(HTTP_LOGBODY_KEY)) + { + // commenting out, but keeping since this can be useful for debugging + LL_WARNS() << "Returned body=" << std::endl << httpStatus["error_body"].asString() << LL_ENDL; + } } mReplyPump.post(result); diff --git a/indra/llmessage/llcorehttputil.h b/indra/llmessage/llcorehttputil.h index d21f5ff45c..6f0b865f83 100644 --- a/indra/llmessage/llcorehttputil.h +++ b/indra/llmessage/llcorehttputil.h @@ -57,7 +57,14 @@ /// namespace LLCoreHttpUtil { - extern const F32 HTTP_REQUEST_EXPIRY_SECS; +/// Allow access to to the property settings methods. +typedef boost::function<bool(const std::string &)> BoolSettingQuery_t; +typedef boost::function<void(const std::string &, bool, const std::string &)> BoolSettingUpdate_t; + +void setPropertyMethods(BoolSettingQuery_t queryfn, BoolSettingUpdate_t updatefn); + + +extern const F32 HTTP_REQUEST_EXPIRY_SECS; /// Attempt to convert a response object's contents to LLSD. /// It is expected that the response body will be of non-zero diff --git a/indra/newview/llappcorehttp.cpp b/indra/newview/llappcorehttp.cpp index 7dee309a62..49291ea564 100755 --- a/indra/newview/llappcorehttp.cpp +++ b/indra/newview/llappcorehttp.cpp @@ -36,6 +36,8 @@ #include "llsecapi.h" #include <curl/curl.h> +#include "llcorehttputil.h" + // Here is where we begin to get our connection usage under control. // This establishes llcorehttp policy classes that, among other // things, limit the maximum number of connections to outside @@ -138,6 +140,9 @@ LLAppCoreHttp::~LLAppCoreHttp() void LLAppCoreHttp::init() { + LLCoreHttpUtil::setPropertyMethods( + boost::bind(&LLControlGroup::getBOOL, boost::ref(gSavedSettings), _1), + boost::bind(&LLControlGroup::declareBOOL, boost::ref(gSavedSettings), _1, _2, _3, LLControlVariable::PERSIST_NONDFT)); LLCore::LLHttp::initialize(); |