diff options
author | Don Kjer <don@lindenlab.com> | 2013-07-11 15:15:04 -0700 |
---|---|---|
committer | Don Kjer <don@lindenlab.com> | 2013-07-11 15:15:04 -0700 |
commit | a85fa3b10a406218cabfecc0d592e816f8dfdb53 (patch) | |
tree | 403ae646796518c876454da2d46eb08d508fc751 /indra/llmessage | |
parent | d079f0dcdc0d317813cda282496a1edae3feed64 (diff) |
Adding support for COPY methods to httpclient. Implementing viewer-side use of AISv3 COPY library folder operation. (SH-4304)
Diffstat (limited to 'indra/llmessage')
-rwxr-xr-x | indra/llmessage/llhttpclient.cpp | 13 | ||||
-rwxr-xr-x | indra/llmessage/llhttpclient.h | 18 | ||||
-rwxr-xr-x | indra/llmessage/llhttpconstants.cpp | 6 | ||||
-rwxr-xr-x | indra/llmessage/llhttpconstants.h | 1 | ||||
-rwxr-xr-x | indra/llmessage/llurlrequest.cpp | 10 |
5 files changed, 44 insertions, 4 deletions
diff --git a/indra/llmessage/llhttpclient.cpp b/indra/llmessage/llhttpclient.cpp index 53cef54559..70c890a8de 100755 --- a/indra/llmessage/llhttpclient.cpp +++ b/indra/llmessage/llhttpclient.cpp @@ -631,6 +631,19 @@ void LLHTTPClient::move( request(url, HTTP_MOVE, NULL, responder, timeout, headers); } +// static +void LLHTTPClient::copy( + const std::string& url, + const std::string& destination, + ResponderPtr responder, + const LLSD& hdrs, + const F32 timeout) +{ + LLSD headers = hdrs; + headers[HTTP_OUT_HEADER_DESTINATION] = destination; + request(url, HTTP_COPY, NULL, responder, timeout, headers); +} + void LLHTTPClient::setPump(LLPumpIO& pump) { diff --git a/indra/llmessage/llhttpclient.h b/indra/llmessage/llhttpclient.h index 4e7495495f..5ace2d74c9 100755 --- a/indra/llmessage/llhttpclient.h +++ b/indra/llmessage/llhttpclient.h @@ -119,7 +119,7 @@ public: const LLSD& headers = LLSD(), const F32 timeout=HTTP_REQUEST_EXPIRY_SECS); ///< sends a DELETE method, but we can't call it delete in c++ - + /** * @brief Send a MOVE webdav method * @@ -136,6 +136,22 @@ public: const LLSD& headers = LLSD(), const F32 timeout=HTTP_REQUEST_EXPIRY_SECS); + /** + * @brief Send a COPY webdav method + * + * @param url The complete serialized (and escaped) url to get. + * @param destination The complete serialized destination url. + * @param responder The responder that will handle the result. + * @param headers A map of key:value headers to pass to the request + * @param timeout The number of seconds to give the server to respond. + */ + static void copy( + const std::string& url, + const std::string& destination, + ResponderPtr responder, + const LLSD& headers = LLSD(), + const F32 timeout=HTTP_REQUEST_EXPIRY_SECS); + //@} /** diff --git a/indra/llmessage/llhttpconstants.cpp b/indra/llmessage/llhttpconstants.cpp index 016f1f1970..01f4a080b0 100755 --- a/indra/llmessage/llhttpconstants.cpp +++ b/indra/llmessage/llhttpconstants.cpp @@ -133,6 +133,8 @@ const std::string HTTP_VERB_POST("POST"); const std::string HTTP_VERB_DELETE("DELETE"); const std::string HTTP_VERB_MOVE("MOVE"); const std::string HTTP_VERB_OPTIONS("OPTIONS"); +const std::string HTTP_VERB_PATCH("PATCH"); +const std::string HTTP_VERB_COPY("COPY"); const std::string& httpMethodAsVerb(EHTTPMethod method) { @@ -145,7 +147,9 @@ const std::string& httpMethodAsVerb(EHTTPMethod method) HTTP_VERB_POST, HTTP_VERB_DELETE, HTTP_VERB_MOVE, - HTTP_VERB_OPTIONS + HTTP_VERB_OPTIONS, + HTTP_VERB_PATCH, + HTTP_VERB_COPY }; if(((S32)method <=0) || ((S32)method >= HTTP_METHOD_COUNT)) { diff --git a/indra/llmessage/llhttpconstants.h b/indra/llmessage/llhttpconstants.h index aa947af414..4aa3cc6394 100755 --- a/indra/llmessage/llhttpconstants.h +++ b/indra/llmessage/llhttpconstants.h @@ -112,6 +112,7 @@ enum EHTTPMethod HTTP_MOVE, // Caller will need to set 'Destination' header HTTP_OPTIONS, HTTP_PATCH, + HTTP_COPY, HTTP_METHOD_COUNT }; diff --git a/indra/llmessage/llurlrequest.cpp b/indra/llmessage/llurlrequest.cpp index cadff49cb8..7bf930aeb0 100755 --- a/indra/llmessage/llurlrequest.cpp +++ b/indra/llmessage/llurlrequest.cpp @@ -516,13 +516,19 @@ bool LLURLRequest::configure() break; case HTTP_DELETE: - // Set the handle for an http post + // Set the handle for an http delete mDetail->mCurlRequest->setoptString(CURLOPT_CUSTOMREQUEST, "DELETE"); rv = true; break; + case HTTP_COPY: + // Set the handle for an http copy + mDetail->mCurlRequest->setoptString(CURLOPT_CUSTOMREQUEST, "COPY"); + rv = true; + break; + case HTTP_MOVE: - // Set the handle for an http post + // Set the handle for an http move mDetail->mCurlRequest->setoptString(CURLOPT_CUSTOMREQUEST, "MOVE"); // *NOTE: should we check for the Destination header? rv = true; |