diff options
Diffstat (limited to 'indra')
-rw-r--r-- | indra/llmessage/llcurl.cpp | 1 | ||||
-rw-r--r-- | indra/llmessage/llhttpclient.cpp | 63 | ||||
-rw-r--r-- | indra/llmessage/llhttpclient.h | 30 | ||||
-rw-r--r-- | indra/llmessage/llurlrequest.cpp | 7 | ||||
-rw-r--r-- | indra/llmessage/llurlrequest.h | 1 |
5 files changed, 78 insertions, 24 deletions
diff --git a/indra/llmessage/llcurl.cpp b/indra/llmessage/llcurl.cpp index 72fb49dd06..e282f49438 100644 --- a/indra/llmessage/llcurl.cpp +++ b/indra/llmessage/llcurl.cpp @@ -885,6 +885,7 @@ void LLCurlEasyRequest::sendRequest(const std::string& url) { llassert_always(!mRequestSent); mRequestSent = true; + lldebugs << url << llendl; if (mEasy) { mEasy->setHeaders(); diff --git a/indra/llmessage/llhttpclient.cpp b/indra/llmessage/llhttpclient.cpp index 3b892aec50..859f3c1536 100644 --- a/indra/llmessage/llhttpclient.cpp +++ b/indra/llmessage/llhttpclient.cpp @@ -199,14 +199,15 @@ namespace LLPumpIO* theClientPump = NULL; } -static void request(const std::string& url, - LLURLRequest::ERequestAction method, - Injector* body_injector, - LLCurl::ResponderPtr responder, - const LLSD& headers = LLSD(), - const F32 timeout = HTTP_REQUEST_EXPIRY_SECS, - S32 offset = 0, - S32 bytes = 0) +static void request( + const std::string& url, + LLURLRequest::ERequestAction method, + Injector* body_injector, + LLCurl::ResponderPtr responder, + const F32 timeout = HTTP_REQUEST_EXPIRY_SECS, + const LLSD& headers = LLSD(), + S32 offset = 0, + S32 bytes = 0) { if (!LLHTTPClient::hasPump()) { @@ -237,7 +238,7 @@ static void request(const std::string& url, req->useProxy(FALSE); } header << iter->first << ": " << iter->second.asString() ; - llinfos << "header = " << header.str() << llendl; + lldebugs << "header = " << header.str() << llendl; req->addHeader(header.str().c_str()); } } @@ -275,7 +276,16 @@ void LLHTTPClient::getByteRange(const std::string& url, const LLSD& headers, const F32 timeout) { - request(url, LLURLRequest::HTTP_GET, NULL, responder, LLSD(), timeout, offset, bytes); + // *FIX: Why is the headers argument ignored? Phoenix 2008-04-28 + request( + url, + LLURLRequest::HTTP_GET, + NULL, + responder, + timeout, + LLSD(), // WTF? Shouldn't this be used? + offset, + bytes); } void LLHTTPClient::head(const std::string& url, ResponderPtr responder, const F32 timeout) @@ -285,11 +295,11 @@ void LLHTTPClient::head(const std::string& url, ResponderPtr responder, const F3 void LLHTTPClient::get(const std::string& url, ResponderPtr responder, const LLSD& headers, const F32 timeout) { - request(url, LLURLRequest::HTTP_GET, NULL, responder, headers, timeout); + request(url, LLURLRequest::HTTP_GET, NULL, responder, timeout, headers); } void LLHTTPClient::getHeaderOnly(const std::string& url, ResponderPtr responder, const LLSD& headers, const F32 timeout) { - request(url, LLURLRequest::HTTP_HEAD, NULL, responder, headers, timeout); + request(url, LLURLRequest::HTTP_HEAD, NULL, responder, timeout, headers); } void LLHTTPClient::getHeaderOnly(const std::string& url, ResponderPtr responder, const F32 timeout) { @@ -406,12 +416,6 @@ void LLHTTPClient::post(const std::string& url, const U8* data, S32 size, Respon request(url, LLURLRequest::HTTP_POST, new RawInjector(data, size), responder, timeout); } -void LLHTTPClient::del(const std::string& url, ResponderPtr responder, const F32 timeout) -{ - request(url, LLURLRequest::HTTP_DELETE, NULL, responder, timeout); -} - -#if 1 void LLHTTPClient::postFile(const std::string& url, const std::string& filename, ResponderPtr responder, const F32 timeout) { request(url, LLURLRequest::HTTP_POST, new FileInjector(filename), responder, timeout); @@ -422,7 +426,28 @@ void LLHTTPClient::postFile(const std::string& url, const LLUUID& uuid, { request(url, LLURLRequest::HTTP_POST, new VFileInjector(uuid, asset_type), responder, timeout); } -#endif + +// static +void LLHTTPClient::del( + const std::string& url, + ResponderPtr responder, + const F32 timeout) +{ + request(url, LLURLRequest::HTTP_DELETE, NULL, responder, timeout); +} + +// static +void LLHTTPClient::move( + const std::string& url, + const std::string& destination, + ResponderPtr responder, + const F32 timeout) +{ + LLSD headers; + headers["Destination"] = destination; + request(url, LLURLRequest::HTTP_MOVE, NULL, responder, timeout, headers); +} + void LLHTTPClient::setPump(LLPumpIO& pump) { diff --git a/indra/llmessage/llhttpclient.h b/indra/llmessage/llhttpclient.h index 6bc838bfd1..57895aeec9 100644 --- a/indra/llmessage/llhttpclient.h +++ b/indra/llmessage/llhttpclient.h @@ -60,7 +60,8 @@ public: typedef LLCurl::Responder Responder; typedef LLCurl::ResponderPtr ResponderPtr; - // non-blocking + /** @name non-blocking API */ + //@{ static void head(const std::string& url, ResponderPtr, const F32 timeout=HTTP_REQUEST_EXPIRY_SECS); static void getByteRange(const std::string& url, S32 offset, S32 bytes, ResponderPtr, const LLSD& headers=LLSD(), const F32 timeout=HTTP_REQUEST_EXPIRY_SECS); static void get(const std::string& url, ResponderPtr, const LLSD& headers = LLSD(), const F32 timeout=HTTP_REQUEST_EXPIRY_SECS); @@ -70,13 +71,34 @@ public: static void getHeaderOnly(const std::string& url, ResponderPtr, const F32 timeout=HTTP_REQUEST_EXPIRY_SECS); static void getHeaderOnly(const std::string& url, ResponderPtr, const LLSD& headers, const F32 timeout=HTTP_REQUEST_EXPIRY_SECS); - ///< non-blocking static void post(const std::string& url, const LLSD& body, ResponderPtr, const F32 timeout=HTTP_REQUEST_EXPIRY_SECS); static void post(const std::string& url, const U8* data, S32 size, ResponderPtr responder, const F32 timeout=HTTP_REQUEST_EXPIRY_SECS); static void postFile(const std::string& url, const std::string& filename, ResponderPtr, const F32 timeout=HTTP_REQUEST_EXPIRY_SECS); static void postFile(const std::string& url, const LLUUID& uuid, LLAssetType::EType asset_type, ResponderPtr responder, const F32 timeout=HTTP_REQUEST_EXPIRY_SECS); + static void del( + const std::string& url, + ResponderPtr responder, + 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 + * + * @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 timeout The number of seconds to give the server to respond. + */ + static void move( + const std::string& url, + const std::string& destination, + ResponderPtr responder, + const F32 timeout=HTTP_REQUEST_EXPIRY_SECS); + + //@} + /** * @brief Blocking HTTP get that returns an LLSD map of status and body. * @@ -85,9 +107,7 @@ public: */ static LLSD blockingGet(const std::string& url); - static void del(const std::string& url, ResponderPtr, const F32 timeout=HTTP_REQUEST_EXPIRY_SECS); - ///< sends a DELETE method, but we can't call it delete in c++ - + static void setPump(LLPumpIO& pump); ///< must be called before any of the above calls are made diff --git a/indra/llmessage/llurlrequest.cpp b/indra/llmessage/llurlrequest.cpp index 475bd7a839..87e1d4e50f 100644 --- a/indra/llmessage/llurlrequest.cpp +++ b/indra/llmessage/llurlrequest.cpp @@ -385,6 +385,13 @@ bool LLURLRequest::configure() rv = true; break; + case HTTP_MOVE: + // Set the handle for an http post + mDetail->mCurlRequest->setoptString(CURLOPT_CUSTOMREQUEST, "MOVE"); + // *NOTE: should we check for the Destination header? + rv = true; + break; + default: llwarns << "Unhandled URLRequest action: " << mAction << llendl; break; diff --git a/indra/llmessage/llurlrequest.h b/indra/llmessage/llurlrequest.h index 288bf463f5..579706f83b 100644 --- a/indra/llmessage/llurlrequest.h +++ b/indra/llmessage/llurlrequest.h @@ -76,6 +76,7 @@ public: HTTP_PUT, HTTP_POST, HTTP_DELETE, + HTTP_MOVE, // Caller will need to set 'Destination' header REQUEST_ACTION_COUNT }; |