summaryrefslogtreecommitdiff
path: root/indra/llmessage/llcorehttputil.cpp
diff options
context:
space:
mode:
authorRider Linden <rider@lindenlab.com>2016-04-25 12:06:33 -0700
committerRider Linden <rider@lindenlab.com>2016-04-25 12:06:33 -0700
commit4d9dd3271b1a015d9afd21767e579a4cd71982ed (patch)
tree11e4a04fc77749dcfe461b7564c523a9a18f41cd /indra/llmessage/llcorehttputil.cpp
parent899489ae0a4bc4eb187e7813e338b937384a1866 (diff)
MAINT-6338: Add methods for getting and setting boolean properties from gSavedSettings in the HTTPCore. Use those methods to access new key HTTPLogBodyOnError. Dump body of HTTP message to log in case of error if this key is true.
Diffstat (limited to 'indra/llmessage/llcorehttputil.cpp')
-rw-r--r--indra/llmessage/llcorehttputil.cpp38
1 files changed, 33 insertions, 5 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);