summaryrefslogtreecommitdiff
path: root/indra/llmessage/llcorehttputil.h
diff options
context:
space:
mode:
Diffstat (limited to 'indra/llmessage/llcorehttputil.h')
-rw-r--r--indra/llmessage/llcorehttputil.h20
1 files changed, 15 insertions, 5 deletions
diff --git a/indra/llmessage/llcorehttputil.h b/indra/llmessage/llcorehttputil.h
index 7d60bfbbaf..73a51fe83a 100644
--- a/indra/llmessage/llcorehttputil.h
+++ b/indra/llmessage/llcorehttputil.h
@@ -387,16 +387,26 @@ public:
///
void cancelYieldingOperation();
-
static LLCore::HttpStatus getStatusFromLLSD(const LLSD &httpResults);
+ /// The convenience routines below can be provided with callback functors
+ /// which will be invoked in the case of success or failure. These callbacks
+ /// should match this form.
+ /// @sa callbackHttpGet
+ /// @sa callbackHttpPost
+ typedef boost::function<void (const LLSD &)> completionCallback_t;
+
+ static void callbackHttpGet(const std::string &url, completionCallback_t success = NULL, completionCallback_t failure = NULL);
+ static void callbackHttpPost(const std::string &url, const LLSD &postData, 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,
/// If the operation fails the failure message is written to the log at WARN level.
///
- static void genericHttpGet(const std::string &url, const std::string &success = std::string(), const std::string &failure = std::string());
- static void genericHttpPost(const std::string &url, const LLSD &postData, const std::string &success, const std::string &failure);
+ static void messageHttpGet(const std::string &url, const std::string &success = std::string(), const std::string &failure = std::string());
+ static void messageHttpPost(const std::string &url, const LLSD &postData, const std::string &success, const std::string &failure);
+
private:
static LLSD buildImmediateErrorResult(const LLCore::HttpRequest::ptr_t &request, const std::string &url);
@@ -428,8 +438,8 @@ private:
const std::string & url, LLCore::HttpOptions::ptr_t &options,
LLCore::HttpHeaders::ptr_t &headers, HttpCoroHandler::ptr_t &handler);
- static void genericGetCoro(LLCoros::self& self, std::string &url, std::string success, std::string failure);
- static void genericPostCoro(LLCoros::self& self, std::string &url, LLSD postData, std::string success, std::string failure);
+ static void trivialGetCoro(LLCoros::self& self, std::string &url, completionCallback_t success, completionCallback_t failure);
+ static void trivialPostCoro(LLCoros::self& self, std::string &url, LLSD postData, completionCallback_t success, completionCallback_t failure);
std::string mAdapterName;
LLCore::HttpRequest::priority_t mPriority;