From 41e1ed5b4153019b07d97f54751db53fa248d8d4 Mon Sep 17 00:00:00 2001
From: Josh Bell <josh@lindenlab.com>
Date: Tue, 13 May 2008 23:04:17 +0000
Subject: [PATCH] svn merge -r 87164:87466
 svn+ssh://svn.lindenlab.com/svn/linden/branches/Branch_1-21-Server -->
 release

Land store (already deployed to agni as 1.21 patches)
* Increased the available purchase area in the land store.
* Modified select pool query to take a simulator status. Now generating a new uuid for each insert into the fulfill lock table.
* Checking to make sure put-simstate returns a uuid region_id.

Other stuff (going out soon or already out)
* svn merge -r87339 svn/linden/branches/havok4/havok4-6 (Block creation of mega prims.)
* Fix for the mega prim fix to also block 0 scale prims.
* svn merge -r 84565:86084 svn+ssh://svn.lindenlab.com/svn/linden/branches/single-ref-attach-again --> Branch_1-21-Server (Slipstream QAR-518 single ref attachments)
* Switched off indra.known_address in favor of indra_aux.known_address
* DEV-15151 check_group_land.py kills the database
* DEV-14662 - Change the current model of PREPARE/EXECUTE to directly execute the SQL (QAR-580)
* DEV-15167 Random failure with set-classified-stats

The secret word is: dataserver-is-deprecated
---
 indra/llmessage/llcurl.cpp       |  1 +
 indra/llmessage/llhttpclient.cpp | 63 ++++++++++++++++++++++----------
 indra/llmessage/llhttpclient.h   | 30 ++++++++++++---
 indra/llmessage/llurlrequest.cpp |  7 ++++
 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 72fb49dd066..e282f494383 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 3b892aec503..859f3c15367 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 6bc838bfd16..57895aeec95 100644
--- a/indra/llmessage/llhttpclient.h
+++ b/indra/llmessage/llhttpclient.h
@@ -60,7 +60,8 @@ class LLHTTPClient
 	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 @@ class LLHTTPClient
 	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 @@ class LLHTTPClient
 	 */
 	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 475bd7a839b..87e1d4e50fb 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 288bf463f55..579706f83b5 100644
--- a/indra/llmessage/llurlrequest.h
+++ b/indra/llmessage/llurlrequest.h
@@ -76,6 +76,7 @@ class LLURLRequest : public LLIOPipe
 		HTTP_PUT,
 		HTTP_POST,
 		HTTP_DELETE,
+		HTTP_MOVE, // Caller will need to set 'Destination' header
 		REQUEST_ACTION_COUNT
 	};
 
-- 
GitLab