diff options
author | simon-linden <57500096+simon-linden@users.noreply.github.com> | 2023-05-15 17:07:19 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-05-15 17:07:19 -0700 |
commit | a8fc3fb32b9ccf3586a20ab3cb7b10522d808f1f (patch) | |
tree | 5871df1c2a339a0162dd81d62a50e4b0152f77f9 /indra/llmessage | |
parent | 60d8647a32db1dd54ffde742e157b54b183592a7 (diff) | |
parent | 2dca661b6a7b40c1dcf94a08f5304df277542597 (diff) |
Merge pull request #215 from secondlife/SL-19676-add-IL-reset
SL-19676 - more IL control, added Reset Interest List Debug menu command
Diffstat (limited to 'indra/llmessage')
-rw-r--r-- | indra/llmessage/llcorehttputil.cpp | 42 | ||||
-rw-r--r-- | indra/llmessage/llcorehttputil.h | 4 |
2 files changed, 46 insertions, 0 deletions
diff --git a/indra/llmessage/llcorehttputil.cpp b/indra/llmessage/llcorehttputil.cpp index c8c9280029..6b9ce54c92 100644 --- a/indra/llmessage/llcorehttputil.cpp +++ b/indra/llmessage/llcorehttputil.cpp @@ -1336,6 +1336,48 @@ void HttpCoroutineAdapter::trivialPostCoro(std::string url, LLCore::HttpRequest: } +/*static*/ +void HttpCoroutineAdapter::callbackHttpDel(const std::string &url, LLCore::HttpRequest::policy_t policyId, completionCallback_t success, + completionCallback_t failure) +{ + LLCoros::instance().launch("HttpCoroutineAdapter::genericDelCoro", + boost::bind(&HttpCoroutineAdapter::trivialDelCoro, url, policyId, success, failure)); +} + +/*static*/ +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); + + httpOpts->setWantHeaders(true); + + LL_INFOS("HttpCoroutineAdapter", "genericDelCoro") << "Generic DEL for " << url << LL_ENDL; + + LLSD result = httpAdapter->deleteAndSuspend(httpRequest, url, httpOpts); + + LLSD httpResults = result[LLCoreHttpUtil::HttpCoroutineAdapter::HTTP_RESULTS]; + LLCore::HttpStatus status = LLCoreHttpUtil::HttpCoroutineAdapter::getStatusFromLLSD(httpResults); + + if (!status) + { + if (failure) + { + failure(httpResults); + } + } + else + { + if (success) + { + success(result); + } + } +} + + } // end namespace LLCoreHttpUtil diff --git a/indra/llmessage/llcorehttputil.h b/indra/llmessage/llcorehttputil.h index 6f0b865f83..8df1425f2a 100644 --- a/indra/llmessage/llcorehttputil.h +++ b/indra/llmessage/llcorehttputil.h @@ -608,6 +608,9 @@ public: callbackHttpPost(url, LLCore::HttpRequest::DEFAULT_POLICY_ID, postData, success, failure); } + static void callbackHttpDel(const std::string &url, LLCore::HttpRequest::policy_t policyId, completionCallback_t success = NULL, + completionCallback_t failure = NULL); + /// Generic Get and post routines for HTTP via coroutines. /// These static methods do all required setup for the GET or POST operation. /// When the operation completes successfully they will put the success message in the log at INFO level, @@ -669,6 +672,7 @@ private: static void trivialGetCoro(std::string url, LLCore::HttpRequest::policy_t policyId, completionCallback_t success, completionCallback_t failure); static void trivialPostCoro(std::string url, LLCore::HttpRequest::policy_t policyId, LLSD postData, completionCallback_t success, completionCallback_t failure); + static void trivialDelCoro(std::string url, LLCore::HttpRequest::policy_t policyId, completionCallback_t success, completionCallback_t failure); void checkDefaultHeaders(LLCore::HttpHeaders::ptr_t &headers); |