diff options
author | Rider Linden <rider@lindenlab.com> | 2015-08-12 16:32:49 -0700 |
---|---|---|
committer | Rider Linden <rider@lindenlab.com> | 2015-08-12 16:32:49 -0700 |
commit | 248d61fe0eadd128c7704e37922ba7fdef35d630 (patch) | |
tree | 47597f9a1d4a1a3dc774c9f10f3d6d74338c5322 /indra/llcorehttp | |
parent | 14a8c70867252926fdfc42728c1de38c8ef68706 (diff) |
MAINT-5500: Finish converting the AIS responders to the new coroutine model, Cleaned up dead an unused code.
MAINT-4952: Added COPY and MOVE methods to Core:Http adapter
Diffstat (limited to 'indra/llcorehttp')
-rwxr-xr-x | indra/llcorehttp/_httpoprequest.cpp | 18 | ||||
-rwxr-xr-x | indra/llcorehttp/_httpoprequest.h | 9 | ||||
-rwxr-xr-x | indra/llcorehttp/httprequest.cpp | 31 | ||||
-rwxr-xr-x | indra/llcorehttp/httprequest.h | 27 |
4 files changed, 80 insertions, 5 deletions
diff --git a/indra/llcorehttp/_httpoprequest.cpp b/indra/llcorehttp/_httpoprequest.cpp index e588ed8a9b..86110f5b46 100755 --- a/indra/llcorehttp/_httpoprequest.cpp +++ b/indra/llcorehttp/_httpoprequest.cpp @@ -380,6 +380,19 @@ HttpStatus HttpOpRequest::setupCopy(HttpRequest::policy_t policy_id, } +HttpStatus HttpOpRequest::setupMove(HttpRequest::policy_t policy_id, + HttpRequest::priority_t priority, + const std::string & url, + const HttpOptions::ptr_t & options, + const HttpHeaders::ptr_t &headers) +{ + setupCommon(policy_id, priority, url, NULL, options, headers); + mReqMethod = HOR_MOVE; + + return HttpStatus(); +} + + void HttpOpRequest::setupCommon(HttpRequest::policy_t policy_id, HttpRequest::priority_t priority, const std::string & url, @@ -626,6 +639,11 @@ HttpStatus HttpOpRequest::prepareRequest(HttpService * service) check_curl_easy_code(code, CURLOPT_CUSTOMREQUEST); break; + case HOR_MOVE: + code = curl_easy_setopt(mCurlHandle, CURLOPT_CUSTOMREQUEST, "MOVE"); + check_curl_easy_code(code, CURLOPT_CUSTOMREQUEST); + break; + default: LL_ERRS(LOG_CORE) << "Invalid HTTP method in request: " << int(mReqMethod) << ". Can't recover." diff --git a/indra/llcorehttp/_httpoprequest.h b/indra/llcorehttp/_httpoprequest.h index a9083be02b..1b449a5abc 100755 --- a/indra/llcorehttp/_httpoprequest.h +++ b/indra/llcorehttp/_httpoprequest.h @@ -83,7 +83,8 @@ public: HOR_PUT, HOR_DELETE, HOR_PATCH, - HOR_COPY + HOR_COPY, + HOR_MOVE }; virtual void stageFromRequest(HttpService *); @@ -148,6 +149,12 @@ public: const HttpOptions::ptr_t & options, const HttpHeaders::ptr_t & headers); + HttpStatus setupMove(HttpRequest::policy_t policy_id, + HttpRequest::priority_t priority, + const std::string & url, + const HttpOptions::ptr_t & options, + const HttpHeaders::ptr_t & headers); + // Internal method used to setup the libcurl options for a request. // Does all the libcurl handle setup in one place. // diff --git a/indra/llcorehttp/httprequest.cpp b/indra/llcorehttp/httprequest.cpp index f0dfde6153..63233259fb 100755 --- a/indra/llcorehttp/httprequest.cpp +++ b/indra/llcorehttp/httprequest.cpp @@ -419,6 +419,37 @@ HttpHandle HttpRequest::requestCopy(policy_t policy_id, return handle; } +HttpHandle HttpRequest::requestMove(policy_t policy_id, + priority_t priority, + const std::string & url, + const HttpOptions::ptr_t & options, + const HttpHeaders::ptr_t & headers, + HttpHandler * user_handler) +{ + HttpStatus status; + HttpHandle handle(LLCORE_HTTP_HANDLE_INVALID); + + HttpOpRequest * op = new HttpOpRequest(); + if (!(status = op->setupMove(policy_id, priority, url, options, headers))) + { + op->release(); + mLastReqStatus = status; + return handle; + } + op->setReplyPath(mReplyQueue, user_handler); + if (!(status = mRequestQueue->addOp(op))) // transfers refcount + { + op->release(); + mLastReqStatus = status; + return handle; + } + + mLastReqStatus = status; + handle = static_cast<HttpHandle>(op); + + return handle; +} + HttpHandle HttpRequest::requestNoOp(HttpHandler * user_handler) { diff --git a/indra/llcorehttp/httprequest.h b/indra/llcorehttp/httprequest.h index 20a223c482..6c2449266f 100755 --- a/indra/llcorehttp/httprequest.h +++ b/indra/llcorehttp/httprequest.h @@ -478,7 +478,7 @@ public: HttpHandler * handler); - /// Queue a full HTTP PUT. Query arguments and body may + /// Queue a full HTTP DELETE. Query arguments and body may /// be provided. Caller is responsible for escaping and /// encoding and communicating the content types. /// @@ -497,7 +497,7 @@ public: const HttpHeaders::ptr_t & headers, HttpHandler * user_handler); - /// Queue a full HTTP PUT. Query arguments and body may + /// Queue a full HTTP PATCH. Query arguments and body may /// be provided. Caller is responsible for escaping and /// encoding and communicating the content types. /// @@ -520,7 +520,7 @@ public: const HttpHeaders::ptr_t & headers, HttpHandler * user_handler); - /// Queue a full HTTP PUT. Query arguments and body may + /// Queue a full HTTP COPY. Query arguments and body may /// be provided. Caller is responsible for escaping and /// encoding and communicating the content types. /// @@ -538,7 +538,26 @@ public: const HttpOptions::ptr_t & options, const HttpHeaders::ptr_t & headers, HttpHandler * user_handler); - + + /// Queue a full HTTP MOVE. Query arguments and body may + /// be provided. Caller is responsible for escaping and + /// encoding and communicating the content types. + /// + /// @param policy_id @see requestGet() + /// @param priority " + /// @param url " + /// @param options @see requestGet()K(optional) + /// @param headers " + /// @param handler " + /// @return " + /// + HttpHandle requestMove(policy_t policy_id, + priority_t priority, + const std::string & url, + const HttpOptions::ptr_t & options, + const HttpHeaders::ptr_t & headers, + HttpHandler * user_handler); + /// Queue a NoOp request. /// The request is queued and serviced by the working thread which /// immediately processes it and returns the request to the reply |