diff options
Diffstat (limited to 'indra/llmessage/llcorehttputil.cpp')
| -rw-r--r-- | indra/llmessage/llcorehttputil.cpp | 68 |
1 files changed, 34 insertions, 34 deletions
diff --git a/indra/llmessage/llcorehttputil.cpp b/indra/llmessage/llcorehttputil.cpp index 992e145758..b24e5e4fcc 100644 --- a/indra/llmessage/llcorehttputil.cpp +++ b/indra/llmessage/llcorehttputil.cpp @@ -57,7 +57,7 @@ namespace inline bool getBoolSetting(const std::string &keyname) { - if (!mBoolSettingGet || mBoolSettingGet.empty()) + if (mBoolSettingGet == nullptr) return(false); return mBoolSettingGet(HTTP_LOGBODY_KEY); } @@ -69,7 +69,7 @@ void setPropertyMethods(BoolSettingQuery_t queryfn, BoolSettingUpdate_t updatefn mBoolSettingGet = queryfn; mBoolSettingPut = updatefn; - if (mBoolSettingPut && !mBoolSettingPut.empty()) + if (mBoolSettingPut != nullptr) { mBoolSettingPut(HTTP_LOGBODY_KEY, false, "Log the entire HTTP body in the case of an HTTP error."); } @@ -666,9 +666,9 @@ const std::string HttpCoroutineAdapter::HTTP_RESULTS_HEADERS("headers"); const std::string HttpCoroutineAdapter::HTTP_RESULTS_CONTENT("content"); const std::string HttpCoroutineAdapter::HTTP_RESULTS_RAW("raw"); -HttpCoroutineAdapter::HttpCoroutineAdapter(const std::string &name, +HttpCoroutineAdapter::HttpCoroutineAdapter(std::string name, LLCore::HttpRequest::policy_t policyId) : - mAdapterName(name), + mAdapterName(std::move(name)), mPolicyId(policyId), mYieldingHandle(LLCORE_HTTP_HANDLE_INVALID), mWeakRequest(), @@ -686,7 +686,7 @@ LLSD HttpCoroutineAdapter::postAndSuspend(LLCore::HttpRequest::ptr_t request, LLCore::HttpOptions::ptr_t options, LLCore::HttpHeaders::ptr_t headers) { LLEventStream replyPump(mAdapterName, true); - HttpCoroHandler::ptr_t httpHandler(new HttpCoroLLSDHandler(replyPump)); + HttpCoroHandler::ptr_t httpHandler = std::make_shared<HttpCoroLLSDHandler>(replyPump); return postAndSuspend_(request, url, body, options, headers, httpHandler); } @@ -723,7 +723,7 @@ LLSD HttpCoroutineAdapter::postAndSuspend(LLCore::HttpRequest::ptr_t request, LLCore::HttpOptions::ptr_t options, LLCore::HttpHeaders::ptr_t headers) { LLEventStream replyPump(mAdapterName, true); - HttpCoroHandler::ptr_t httpHandler(new HttpCoroLLSDHandler(replyPump)); + HttpCoroHandler::ptr_t httpHandler = std::make_shared<HttpCoroLLSDHandler>(replyPump); return postAndSuspend_(request, url, rawbody, options, headers, httpHandler); } @@ -733,7 +733,7 @@ LLSD HttpCoroutineAdapter::postRawAndSuspend(LLCore::HttpRequest::ptr_t request, LLCore::HttpOptions::ptr_t options, LLCore::HttpHeaders::ptr_t headers) { LLEventStream replyPump(mAdapterName, true); - HttpCoroHandler::ptr_t httpHandler(new HttpCoroRawHandler(replyPump)); + HttpCoroHandler::ptr_t httpHandler = std::make_shared<HttpCoroRawHandler>(replyPump); return postAndSuspend_(request, url, rawbody, options, headers, httpHandler); } @@ -797,7 +797,7 @@ LLSD HttpCoroutineAdapter::postJsonAndSuspend(LLCore::HttpRequest::ptr_t request LLCore::HttpOptions::ptr_t options, LLCore::HttpHeaders::ptr_t headers) { LLEventStream replyPump(mAdapterName, true); - HttpCoroHandler::ptr_t httpHandler(new HttpCoroJSONHandler(replyPump)); + HttpCoroHandler::ptr_t httpHandler = std::make_shared<HttpCoroJSONHandler>(replyPump); LLCore::BufferArray::ptr_t rawbody(new LLCore::BufferArray); @@ -846,7 +846,7 @@ LLSD HttpCoroutineAdapter::putAndSuspend(LLCore::HttpRequest::ptr_t request, LLCore::HttpOptions::ptr_t options, LLCore::HttpHeaders::ptr_t headers) { LLEventStream replyPump(mAdapterName + "Reply", true); - HttpCoroHandler::ptr_t httpHandler(new HttpCoroLLSDHandler(replyPump)); + HttpCoroHandler::ptr_t httpHandler = std::make_shared<HttpCoroLLSDHandler>(replyPump); return putAndSuspend_(request, url, body, options, headers, httpHandler); } @@ -856,7 +856,7 @@ LLSD HttpCoroutineAdapter::putJsonAndSuspend(LLCore::HttpRequest::ptr_t request, LLCore::HttpOptions::ptr_t options, LLCore::HttpHeaders::ptr_t headers) { LLEventStream replyPump(mAdapterName, true); - HttpCoroHandler::ptr_t httpHandler(new HttpCoroJSONHandler(replyPump)); + HttpCoroHandler::ptr_t httpHandler = std::make_shared<HttpCoroJSONHandler>(replyPump); LLCore::BufferArray::ptr_t rawbody(new LLCore::BufferArray); @@ -931,7 +931,7 @@ LLSD HttpCoroutineAdapter::getAndSuspend(LLCore::HttpRequest::ptr_t request, LLCore::HttpOptions::ptr_t options, LLCore::HttpHeaders::ptr_t headers) { LLEventStream replyPump(mAdapterName + "Reply", true); - HttpCoroHandler::ptr_t httpHandler(new HttpCoroLLSDHandler(replyPump)); + HttpCoroHandler::ptr_t httpHandler = std::make_shared<HttpCoroLLSDHandler>(replyPump); return getAndSuspend_(request, url, options, headers, httpHandler); } @@ -941,7 +941,7 @@ LLSD HttpCoroutineAdapter::getRawAndSuspend(LLCore::HttpRequest::ptr_t request, LLCore::HttpOptions::ptr_t options, LLCore::HttpHeaders::ptr_t headers) { LLEventStream replyPump(mAdapterName + "Reply", true); - HttpCoroHandler::ptr_t httpHandler(new HttpCoroRawHandler(replyPump)); + HttpCoroHandler::ptr_t httpHandler = std::make_shared<HttpCoroRawHandler>(replyPump); return getAndSuspend_(request, url, options, headers, httpHandler); } @@ -950,7 +950,7 @@ LLSD HttpCoroutineAdapter::getJsonAndSuspend(LLCore::HttpRequest::ptr_t request, const std::string & url, LLCore::HttpOptions::ptr_t options, LLCore::HttpHeaders::ptr_t headers) { LLEventStream replyPump(mAdapterName + "Reply", true); - HttpCoroHandler::ptr_t httpHandler(new HttpCoroJSONHandler(replyPump)); + HttpCoroHandler::ptr_t httpHandler = std::make_shared<HttpCoroJSONHandler>(replyPump); return getAndSuspend_(request, url, options, headers, httpHandler); } @@ -987,7 +987,7 @@ LLSD HttpCoroutineAdapter::deleteAndSuspend(LLCore::HttpRequest::ptr_t request, LLCore::HttpOptions::ptr_t options, LLCore::HttpHeaders::ptr_t headers) { LLEventStream replyPump(mAdapterName + "Reply", true); - HttpCoroHandler::ptr_t httpHandler(new HttpCoroLLSDHandler(replyPump)); + HttpCoroHandler::ptr_t httpHandler = std::make_shared<HttpCoroLLSDHandler>(replyPump); return deleteAndSuspend_(request, url, options, headers, httpHandler); } @@ -997,7 +997,7 @@ LLSD HttpCoroutineAdapter::deleteJsonAndSuspend(LLCore::HttpRequest::ptr_t reque LLCore::HttpOptions::ptr_t options, LLCore::HttpHeaders::ptr_t headers) { LLEventStream replyPump(mAdapterName + "Reply", true); - HttpCoroHandler::ptr_t httpHandler(new HttpCoroJSONHandler(replyPump)); + HttpCoroHandler::ptr_t httpHandler = std::make_shared<HttpCoroJSONHandler>(replyPump); return deleteAndSuspend_(request, url, options, headers, httpHandler); } @@ -1032,7 +1032,7 @@ LLSD HttpCoroutineAdapter::patchAndSuspend(LLCore::HttpRequest::ptr_t request, LLCore::HttpOptions::ptr_t options, LLCore::HttpHeaders::ptr_t headers) { LLEventStream replyPump(mAdapterName + "Reply", true); - HttpCoroHandler::ptr_t httpHandler(new HttpCoroLLSDHandler(replyPump)); + HttpCoroHandler::ptr_t httpHandler = std::make_shared<HttpCoroLLSDHandler>(replyPump); return patchAndSuspend_(request, url, body, options, headers, httpHandler); } @@ -1070,10 +1070,10 @@ LLSD HttpCoroutineAdapter::copyAndSuspend(LLCore::HttpRequest::ptr_t request, LLCore::HttpOptions::ptr_t options, LLCore::HttpHeaders::ptr_t headers) { LLEventStream replyPump(mAdapterName + "Reply", true); - HttpCoroHandler::ptr_t httpHandler(new HttpCoroLLSDHandler(replyPump)); + HttpCoroHandler::ptr_t httpHandler = std::make_shared<HttpCoroLLSDHandler>(replyPump); if (!headers) - headers.reset(new LLCore::HttpHeaders); + headers = std::make_shared<LLCore::HttpHeaders>(); headers->append(HTTP_OUT_HEADER_DESTINATION, dest); return copyAndSuspend_(request, url, options, headers, httpHandler); @@ -1112,10 +1112,10 @@ LLSD HttpCoroutineAdapter::moveAndSuspend(LLCore::HttpRequest::ptr_t request, LLCore::HttpOptions::ptr_t options, LLCore::HttpHeaders::ptr_t headers) { LLEventStream replyPump(mAdapterName + "Reply", true); - HttpCoroHandler::ptr_t httpHandler(new HttpCoroLLSDHandler(replyPump)); + HttpCoroHandler::ptr_t httpHandler = std::make_shared<HttpCoroLLSDHandler>(replyPump); if (!headers) - headers.reset(new LLCore::HttpHeaders); + headers = std::make_shared<LLCore::HttpHeaders>(); headers->append(HTTP_OUT_HEADER_DESTINATION, dest); return moveAndSuspend_(request, url, options, headers, httpHandler); @@ -1153,7 +1153,7 @@ LLSD HttpCoroutineAdapter::moveAndSuspend_(LLCore::HttpRequest::ptr_t &request, void HttpCoroutineAdapter::checkDefaultHeaders(LLCore::HttpHeaders::ptr_t &headers) { if (!headers) - headers.reset(new LLCore::HttpHeaders); + headers = std::make_shared<LLCore::HttpHeaders>(); if (!headers->find(HTTP_OUT_HEADER_ACCEPT)) { headers->append(HTTP_OUT_HEADER_ACCEPT, HTTP_CONTENT_LLSD_XML); @@ -1236,9 +1236,9 @@ void HttpCoroutineAdapter::callbackHttpGet(const std::string &url, LLCore::HttpR /*static*/ void HttpCoroutineAdapter::messageHttpGet(const std::string &url, const std::string &success, const std::string &failure) { - completionCallback_t cbSuccess = (success.empty()) ? NULL : + completionCallback_t cbSuccess = (success.empty()) ? nullptr : static_cast<completionCallback_t>(boost::bind(&logMessageSuccess, "HttpCoroutineAdapter", url, success)); - completionCallback_t cbFailure = (failure.empty()) ? NULL : + completionCallback_t cbFailure = (failure.empty()) ? nullptr : static_cast<completionCallback_t>(boost::bind(&logMessageFail, "HttpCoroutineAdapter", url, failure)); callbackHttpGet(url, cbSuccess, cbFailure); } @@ -1247,9 +1247,9 @@ void HttpCoroutineAdapter::messageHttpGet(const std::string &url, const std::str void HttpCoroutineAdapter::trivialGetCoro(std::string url, LLCore::HttpRequest::policy_t policyId, completionCallback_t success, completionCallback_t failure) { LLCoreHttpUtil::HttpCoroutineAdapter::ptr_t - httpAdapter(new LLCoreHttpUtil::HttpCoroutineAdapter("genericGetCoro", policyId)); - LLCore::HttpRequest::ptr_t httpRequest(new LLCore::HttpRequest); - LLCore::HttpOptions::ptr_t httpOpts(new LLCore::HttpOptions); + httpAdapter = std::make_shared<LLCoreHttpUtil::HttpCoroutineAdapter>("genericGetCoro", policyId); + LLCore::HttpRequest::ptr_t httpRequest = std::make_shared<LLCore::HttpRequest>(); + LLCore::HttpOptions::ptr_t httpOpts = std::make_shared<LLCore::HttpOptions>(); httpOpts->setWantHeaders(true); @@ -1286,9 +1286,9 @@ void HttpCoroutineAdapter::callbackHttpPost(const std::string &url, LLCore::Http /*static*/ void HttpCoroutineAdapter::messageHttpPost(const std::string &url, const LLSD &postData, const std::string &success, const std::string &failure) { - completionCallback_t cbSuccess = (success.empty()) ? NULL : + completionCallback_t cbSuccess = (success.empty()) ? nullptr : static_cast<completionCallback_t>(boost::bind(&logMessageSuccess, "HttpCoroutineAdapter", url, success)); - completionCallback_t cbFailure = (failure.empty()) ? NULL : + completionCallback_t cbFailure = (failure.empty()) ? nullptr : static_cast<completionCallback_t>(boost::bind(&logMessageFail, "HttpCoroutineAdapter", url, failure)); callbackHttpPost(url, postData, cbSuccess, cbFailure); @@ -1298,9 +1298,9 @@ void HttpCoroutineAdapter::messageHttpPost(const std::string &url, const LLSD &p void HttpCoroutineAdapter::trivialPostCoro(std::string url, LLCore::HttpRequest::policy_t policyId, LLSD postData, completionCallback_t success, completionCallback_t failure) { LLCoreHttpUtil::HttpCoroutineAdapter::ptr_t - httpAdapter(new LLCoreHttpUtil::HttpCoroutineAdapter("genericPostCoro", policyId)); - LLCore::HttpRequest::ptr_t httpRequest(new LLCore::HttpRequest); - LLCore::HttpOptions::ptr_t httpOpts(new LLCore::HttpOptions); + httpAdapter = std::make_shared<LLCoreHttpUtil::HttpCoroutineAdapter>("genericPostCoro", policyId); + LLCore::HttpRequest::ptr_t httpRequest = std::make_shared<LLCore::HttpRequest>(); + LLCore::HttpOptions::ptr_t httpOpts = std::make_shared<LLCore::HttpOptions>(); httpOpts->setWantHeaders(true); @@ -1342,9 +1342,9 @@ void HttpCoroutineAdapter::callbackHttpDel(const std::string &url, LLCore::HttpR void HttpCoroutineAdapter::trivialDelCoro(std::string url, LLCore::HttpRequest::policy_t policyId, completionCallback_t success, completionCallback_t failure) { - LLCoreHttpUtil::HttpCoroutineAdapter::ptr_t httpAdapter(new LLCoreHttpUtil::HttpCoroutineAdapter("genericDelCoro", policyId)); - LLCore::HttpRequest::ptr_t httpRequest(new LLCore::HttpRequest); - LLCore::HttpOptions::ptr_t httpOpts(new LLCore::HttpOptions); + LLCoreHttpUtil::HttpCoroutineAdapter::ptr_t httpAdapter = std::make_shared<LLCoreHttpUtil::HttpCoroutineAdapter>("genericDelCoro", policyId); + LLCore::HttpRequest::ptr_t httpRequest = std::make_shared<LLCore::HttpRequest>(); + LLCore::HttpOptions::ptr_t httpOpts = std::make_shared<LLCore::HttpOptions>(); httpOpts->setWantHeaders(true); |
