diff options
Diffstat (limited to 'indra/llmessage/llcorehttputil.h')
-rw-r--r-- | indra/llmessage/llcorehttputil.h | 206 |
1 files changed, 103 insertions, 103 deletions
diff --git a/indra/llmessage/llcorehttputil.h b/indra/llmessage/llcorehttputil.h index fc561c6b0f..45b673b9d5 100644 --- a/indra/llmessage/llcorehttputil.h +++ b/indra/llmessage/llcorehttputil.h @@ -1,4 +1,4 @@ -/** +/** * @file llcorehttputil.h * @date 2014-08-25 * @brief Adapter and utility classes expanding the llcorehttp interfaces. @@ -6,21 +6,21 @@ * $LicenseInfo:firstyear=2014&license=viewerlgpl$ * Second Life Viewer Source Code * Copyright (C) 2014, Linden Research, Inc. - * + * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; * version 2.1 of the License only. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. - * + * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - * + * * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA * $/LicenseInfo$ */ @@ -75,20 +75,20 @@ extern const F32 HTTP_REQUEST_EXPIRY_SECS; /// the output LLSD object, out_llsd, is written with the /// result and true is returned. /// -/// @arg response Response object as returned in -/// in an HttpHandler onCompleted() callback. -/// @arg log If true, LLSD parser will emit errors -/// as LL_INFOS-level messages as it parses. -/// Otherwise, it *should* be a quiet parse. -/// @arg out_llsd Output LLSD object written only upon -/// successful parse of the response object. +/// @arg response Response object as returned in +/// in an HttpHandler onCompleted() callback. +/// @arg log If true, LLSD parser will emit errors +/// as LL_INFOS-level messages as it parses. +/// Otherwise, it *should* be a quiet parse. +/// @arg out_llsd Output LLSD object written only upon +/// successful parse of the response object. /// -/// @return Returns true (and writes to out_llsd) if -/// parse was successful. False otherwise. +/// @return Returns true (and writes to out_llsd) if +/// parse was successful. False otherwise. /// bool responseToLLSD(LLCore::HttpResponse * response, - bool log, - LLSD & out_llsd); + bool log, + LLSD & out_llsd); /// Create a std::string representation of a response object /// suitable for logging. Mainly intended for logging of @@ -104,15 +104,15 @@ std::string responseToString(LLCore::HttpResponse * response); /// One will not be provided by this call. You might look after /// the 'Accept:' header as well. /// -/// @return If request is successfully issued, the -/// HttpHandle representing the request. -/// On error, LLCORE_HTTP_HANDLE_INVALID -/// is returned and caller can fetch detailed -/// status with the getStatus() method on the -/// request object. In case of error, no -/// request is queued and caller may need to -/// perform additional cleanup such as freeing -/// a now-useless HttpHandler object. +/// @return If request is successfully issued, the +/// HttpHandle representing the request. +/// On error, LLCORE_HTTP_HANDLE_INVALID +/// is returned and caller can fetch detailed +/// status with the getStatus() method on the +/// request object. In case of error, no +/// request is queued and caller may need to +/// perform additional cleanup such as freeing +/// a now-useless HttpHandler object. /// LLCore::HttpHandle requestPostWithLLSD(LLCore::HttpRequest * request, LLCore::HttpRequest::policy_t policy_id, @@ -123,11 +123,11 @@ LLCore::HttpHandle requestPostWithLLSD(LLCore::HttpRequest * request, const LLCore::HttpHandler::ptr_t &handler); inline LLCore::HttpHandle requestPostWithLLSD(LLCore::HttpRequest::ptr_t & request, - LLCore::HttpRequest::policy_t policy_id, - const std::string & url, - const LLSD & body, - const LLCore::HttpOptions::ptr_t & options, - const LLCore::HttpHeaders::ptr_t & headers, + LLCore::HttpRequest::policy_t policy_id, + const std::string & url, + const LLSD & body, + const LLCore::HttpOptions::ptr_t & options, + const LLCore::HttpHeaders::ptr_t & headers, const LLCore::HttpHandler::ptr_t & handler) { return requestPostWithLLSD(request.get(), policy_id, @@ -154,30 +154,30 @@ inline LLCore::HttpHandle requestPostWithLLSD(LLCore::HttpRequest::ptr_t & reque /// an HttpHeaders object with a correct 'Content-Type:' header. /// One will not be provided by this call. /// -/// @return If request is successfully issued, the -/// HttpHandle representing the request. -/// On error, LLCORE_HTTP_HANDLE_INVALID -/// is returned and caller can fetch detailed -/// status with the getStatus() method on the -/// request object. In case of error, no -/// request is queued and caller may need to -/// perform additional cleanup such as freeing -/// a now-useless HttpHandler object. +/// @return If request is successfully issued, the +/// HttpHandle representing the request. +/// On error, LLCORE_HTTP_HANDLE_INVALID +/// is returned and caller can fetch detailed +/// status with the getStatus() method on the +/// request object. In case of error, no +/// request is queued and caller may need to +/// perform additional cleanup such as freeing +/// a now-useless HttpHandler object. /// LLCore::HttpHandle requestPutWithLLSD(LLCore::HttpRequest * request, - LLCore::HttpRequest::policy_t policy_id, - const std::string & url, - const LLSD & body, - const LLCore::HttpOptions::ptr_t &options, - const LLCore::HttpHeaders::ptr_t &headers, + LLCore::HttpRequest::policy_t policy_id, + const std::string & url, + const LLSD & body, + const LLCore::HttpOptions::ptr_t &options, + const LLCore::HttpHeaders::ptr_t &headers, const LLCore::HttpHandler::ptr_t &handler); inline LLCore::HttpHandle requestPutWithLLSD(LLCore::HttpRequest::ptr_t & request, - LLCore::HttpRequest::policy_t policy_id, - const std::string & url, - const LLSD & body, - const LLCore::HttpOptions::ptr_t & options, - const LLCore::HttpHeaders::ptr_t & headers, + LLCore::HttpRequest::policy_t policy_id, + const std::string & url, + const LLSD & body, + const LLCore::HttpOptions::ptr_t & options, + const LLCore::HttpHeaders::ptr_t & headers, LLCore::HttpHandler::ptr_t handler) { return requestPutWithLLSD(request.get(), policy_id, @@ -203,15 +203,15 @@ inline LLCore::HttpHandle requestPutWithLLSD(LLCore::HttpRequest::ptr_t & reques /// an HttpHeaders object with a correct 'Content-Type:' header. /// One will not be provided by this call. /// -/// @return If request is successfully issued, the -/// HttpHandle representing the request. -/// On error, LLCORE_HTTP_HANDLE_INVALID -/// is returned and caller can fetch detailed -/// status with the getStatus() method on the -/// request object. In case of error, no -/// request is queued and caller may need to -/// perform additional cleanup such as freeing -/// a now-useless HttpHandler object. +/// @return If request is successfully issued, the +/// HttpHandle representing the request. +/// On error, LLCORE_HTTP_HANDLE_INVALID +/// is returned and caller can fetch detailed +/// status with the getStatus() method on the +/// request object. In case of error, no +/// request is queued and caller may need to +/// perform additional cleanup such as freeing +/// a now-useless HttpHandler object. /// LLCore::HttpHandle requestPatchWithLLSD(LLCore::HttpRequest * request, LLCore::HttpRequest::policy_t policy_id, @@ -247,10 +247,10 @@ inline LLCore::HttpHandle requestPatchWithLLSD(LLCore::HttpRequest::ptr_t & requ } //========================================================================= -/// The HttpCoroHandler is a specialization of the LLCore::HttpHandler for -/// interacting with coroutines. When the request is completed the response +/// The HttpCoroHandler is a specialization of the LLCore::HttpHandler for +/// interacting with coroutines. When the request is completed the response /// will be posted onto the supplied Event Pump. -/// +/// /// The LLSD posted back to the coroutine will have the following additions: /// llsd["http_result"] -+- ["message"] - An error message returned from the HTTP status /// +- ["status"] - The status code associated with the HTTP call @@ -258,7 +258,7 @@ inline LLCore::HttpHandle requestPatchWithLLSD(LLCore::HttpRequest::ptr_t & requ /// +- ["type"] - The LLCore::HttpStatus type associted with the HTTP call /// +- ["url"] - The URL used to make the call. /// +- ["headers"] - A map of name name value pairs with the HTTP headers. -/// +/// class HttpCoroHandler : public LLCore::HttpHandler { public: @@ -289,21 +289,21 @@ private: }; //========================================================================= -/// An adapter to handle some of the boilerplate code surrounding HTTP and coroutine +/// An adapter to handle some of the boilerplate code surrounding HTTP and coroutine /// interaction. -/// -/// Construct an HttpCoroutineAdapter giving it a name and policy Id. After -/// any application specific setup call the post, put or get method. The request +/// +/// Construct an HttpCoroutineAdapter giving it a name and policy Id. After +/// any application specific setup call the post, put or get method. The request /// will be automatically pumped and the method will return with an LLSD describing -/// the result of the operation. See HttpCoroHandler for a description of the +/// the result of the operation. See HttpCoroHandler for a description of the /// decoration done to the returned LLSD. -/// -/// Posting through the adapter will automatically add the following headers to -/// the request if they have not been previously specified in a supplied +/// +/// Posting through the adapter will automatically add the following headers to +/// the request if they have not been previously specified in a supplied /// HttpHeaders object: /// "Accept=application/llsd+xml" /// "X-SecondLife-UDP-Listen-Port=###" -/// +/// class HttpCoroutineAdapter { public: @@ -323,9 +323,9 @@ public: HttpCoroutineAdapter(const std::string &name, LLCore::HttpRequest::policy_t policyId); ~HttpCoroutineAdapter(); - /// Execute a Post transaction on the supplied URL and yield execution of - /// the coroutine until a result is available. - /// + /// Execute a Post transaction on the supplied URL and yield execution of + /// the coroutine until a result is available. + /// /// @Note: the request's smart pointer is passed by value so that it will /// not be deallocated during the yield. LLSD postAndSuspend(LLCore::HttpRequest::ptr_t request, @@ -407,9 +407,9 @@ public: - /// Execute a Put transaction on the supplied URL and yield execution of + /// Execute a Put transaction on the supplied URL and yield execution of /// the coroutine until a result is available. - /// + /// /// @Note: the request's smart pointer is passed by value so that it will /// not be deallocated during the yield. LLSD putAndSuspend(LLCore::HttpRequest::ptr_t request, @@ -437,12 +437,12 @@ public: LLCore::HttpOptions::ptr_t(new LLCore::HttpOptions()), headers); } - /// Execute a Get transaction on the supplied URL and yield execution of + /// Execute a Get transaction on the supplied URL and yield execution of /// the coroutine until a result is available. - /// + /// /// @Note: the request's smart pointer is passed by value so that it will /// not be deallocated during the yield. - /// + /// LLSD getAndSuspend(LLCore::HttpRequest::ptr_t request, const std::string & url, LLCore::HttpOptions::ptr_t options = LLCore::HttpOptions::ptr_t(new LLCore::HttpOptions()), @@ -467,9 +467,9 @@ public: headers); } - /// These methods have the same behavior as @getAndSuspend() however they are - /// expecting the server to return the results formatted in a JSON string. - /// On a successful GET call the JSON results will be converted into LLSD + /// These methods have the same behavior as @getAndSuspend() however they are + /// expecting the server to return the results formatted in a JSON string. + /// On a successful GET call the JSON results will be converted into LLSD /// before being returned to the caller. LLSD getJsonAndSuspend(LLCore::HttpRequest::ptr_t request, const std::string & url, @@ -484,9 +484,9 @@ public: } - /// Execute a DELETE transaction on the supplied URL and yield execution of + /// Execute a DELETE transaction on the supplied URL and yield execution of /// the coroutine until a result is available. - /// + /// /// @Note: the request's smart pointer is passed by value so that it will /// not be deallocated during the yield. LLSD deleteAndSuspend(LLCore::HttpRequest::ptr_t request, @@ -501,9 +501,9 @@ public: headers); } - /// These methods have the same behavior as @deleteAndSuspend() however they are - /// expecting the server to return any results formatted in a JSON string. - /// On a successful DELETE call the JSON results will be converted into LLSD + /// These methods have the same behavior as @deleteAndSuspend() however they are + /// expecting the server to return any results formatted in a JSON string. + /// On a successful DELETE call the JSON results will be converted into LLSD /// before being returned to the caller. LLSD deleteJsonAndSuspend(LLCore::HttpRequest::ptr_t request, const std::string & url, @@ -518,9 +518,9 @@ public: } - /// Execute a PATCH transaction on the supplied URL and yield execution of - /// the coroutine until a result is available. - /// + /// Execute a PATCH transaction on the supplied URL and yield execution of + /// the coroutine until a result is available. + /// /// @Note: the request's smart pointer is passed by value so that it will /// not be deallocated during the yield. LLSD patchAndSuspend(LLCore::HttpRequest::ptr_t request, @@ -535,12 +535,12 @@ public: LLCore::HttpOptions::ptr_t(new LLCore::HttpOptions()), headers); } - /// Execute a COPY transaction on the supplied URL and yield execution of - /// the coroutine until a result is available. - /// + /// Execute a COPY transaction on the supplied URL and yield execution of + /// the coroutine until a result is available. + /// /// @Note: The destination is passed through the HTTP pipe as a header /// The header used is defined as: HTTP_OUT_HEADER_DESTINATION("Destination"); - /// + /// /// @Note: the request's smart pointer is passed by value so that it will /// not be deallocated during the yield. LLSD copyAndSuspend(LLCore::HttpRequest::ptr_t request, @@ -555,12 +555,12 @@ public: LLCore::HttpOptions::ptr_t(new LLCore::HttpOptions()), headers); } - /// Execute a MOVE transaction on the supplied URL and yield execution of - /// the coroutine until a result is available. - /// + /// Execute a MOVE transaction on the supplied URL and yield execution of + /// the coroutine until a result is available. + /// /// @Note: The destination is passed through the HTTP pipe in the headers. /// The header used is defined as: HTTP_OUT_HEADER_DESTINATION("Destination"); - /// + /// /// @Note: the request's smart pointer is passed by value so that it will /// not be deallocated during the yield. LLSD moveAndSuspend(LLCore::HttpRequest::ptr_t request, @@ -580,7 +580,7 @@ public: static LLCore::HttpStatus getStatusFromLLSD(const LLSD &httpResults); - /// The convenience routines below can be provided with callback functors + /// 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 @@ -603,9 +603,9 @@ public: /// 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, + /// 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 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); @@ -638,7 +638,7 @@ private: HttpCoroHandler::ptr_t &handler); LLSD getAndSuspend_(LLCore::HttpRequest::ptr_t &request, - const std::string & url, LLCore::HttpOptions::ptr_t &options, + const std::string & url, LLCore::HttpOptions::ptr_t &options, LLCore::HttpHeaders::ptr_t &headers, HttpCoroHandler::ptr_t &handler); LLSD deleteAndSuspend_(LLCore::HttpRequest::ptr_t &request, @@ -651,7 +651,7 @@ private: HttpCoroHandler::ptr_t &handler); LLSD copyAndSuspend_(LLCore::HttpRequest::ptr_t &request, - const std::string & url, + const std::string & url, LLCore::HttpOptions::ptr_t &options, LLCore::HttpHeaders::ptr_t &headers, HttpCoroHandler::ptr_t &handler); |