From ae588e76f1c61bf489dfb2cdcab371f0b34118f2 Mon Sep 17 00:00:00 2001
From: Don Kjer <don@lindenlab.com>
Date: Thu, 5 Apr 2007 16:23:03 +0000
Subject: [PATCH] svn merge -r 58913:59058
 svn+ssh://svn/svn/linden/branches/rez-content-loss-1 into release

---
 indra/llmessage/llhttpclient.cpp | 34 ++++++++++++++++----------------
 indra/llmessage/llhttpclient.h   | 16 ++++++++-------
 2 files changed, 26 insertions(+), 24 deletions(-)

diff --git a/indra/llmessage/llhttpclient.cpp b/indra/llmessage/llhttpclient.cpp
index 0929f93dc12..121cbd2e686 100644
--- a/indra/llmessage/llhttpclient.cpp
+++ b/indra/llmessage/llhttpclient.cpp
@@ -20,7 +20,7 @@
 
 #include <curl/curl.h>
 
-static const F32 HTTP_REQUEST_EXPIRY_SECS = 60.0f;
+const F32 HTTP_REQUEST_EXPIRY_SECS = 60.0f;
 
 static std::string gCABundle;
 
@@ -214,7 +214,7 @@ namespace
 }
 
 static void request(const std::string& url, LLURLRequest::ERequestAction method,
-	Injector* body_injector, LLHTTPClient::ResponderPtr responder)
+	Injector* body_injector, LLHTTPClient::ResponderPtr responder, const F32 timeout=HTTP_REQUEST_EXPIRY_SECS)
 {
 	if (!LLHTTPClient::hasPump())
 	{
@@ -239,12 +239,12 @@ static void request(const std::string& url, LLURLRequest::ERequestAction method,
 	}
 	chain.push_back(LLIOPipe::ptr_t(req));
 
-	theClientPump->addChain(chain, HTTP_REQUEST_EXPIRY_SECS);
+	theClientPump->addChain(chain, timeout);
 }
 
-void LLHTTPClient::get(const std::string& url, ResponderPtr responder)
+void LLHTTPClient::get(const std::string& url, ResponderPtr responder, const F32 timeout)
 {
-	request(url, LLURLRequest::HTTP_GET, NULL, responder);
+	request(url, LLURLRequest::HTTP_GET, NULL, responder, timeout);
 }
 
 // A simple class for managing data returned from a curl http request.
@@ -325,36 +325,36 @@ LLSD LLHTTPClient::blockingGet(const std::string& url)
 	return response;
 }
 
-void LLHTTPClient::put(const std::string& url, const LLSD& body, ResponderPtr responder)
+void LLHTTPClient::put(const std::string& url, const LLSD& body, ResponderPtr responder, const F32 timeout)
 {
-	request(url, LLURLRequest::HTTP_PUT, new LLSDInjector(body), responder);
+	request(url, LLURLRequest::HTTP_PUT, new LLSDInjector(body), responder, timeout);
 }
 
-void LLHTTPClient::post(const std::string& url, const LLSD& body, ResponderPtr responder)
+void LLHTTPClient::post(const std::string& url, const LLSD& body, ResponderPtr responder, const F32 timeout)
 {
-	request(url, LLURLRequest::HTTP_POST, new LLSDInjector(body), responder);
+	request(url, LLURLRequest::HTTP_POST, new LLSDInjector(body), responder, timeout);
 }
 
-void LLHTTPClient::post(const std::string& url, const U8* data, S32 size, ResponderPtr responder)
+void LLHTTPClient::post(const std::string& url, const U8* data, S32 size, ResponderPtr responder, const F32 timeout)
 {
-	request(url, LLURLRequest::HTTP_POST, new RawInjector(data, size), responder);
+	request(url, LLURLRequest::HTTP_POST, new RawInjector(data, size), responder, timeout);
 }
 
-void LLHTTPClient::del(const std::string& url, ResponderPtr responder)
+void LLHTTPClient::del(const std::string& url, ResponderPtr responder, const F32 timeout)
 {
-	request(url, LLURLRequest::HTTP_DELETE, NULL, responder);
+	request(url, LLURLRequest::HTTP_DELETE, NULL, responder, timeout);
 }
 
 #if 1
-void LLHTTPClient::postFile(const std::string& url, const std::string& filename, ResponderPtr responder)
+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);
+	request(url, LLURLRequest::HTTP_POST, new FileInjector(filename), responder, timeout);
 }
 
 void LLHTTPClient::postFile(const std::string& url, const LLUUID& uuid,
-							LLAssetType::EType asset_type, ResponderPtr responder)
+							LLAssetType::EType asset_type, ResponderPtr responder, const F32 timeout)
 {
-	request(url, LLURLRequest::HTTP_POST, new VFileInjector(uuid, asset_type), responder);
+	request(url, LLURLRequest::HTTP_POST, new VFileInjector(uuid, asset_type), responder, timeout);
 }
 #endif
 
diff --git a/indra/llmessage/llhttpclient.h b/indra/llmessage/llhttpclient.h
index a8afea312d3..060293c9306 100644
--- a/indra/llmessage/llhttpclient.h
+++ b/indra/llmessage/llhttpclient.h
@@ -19,6 +19,8 @@
 
 #include "llassettype.h"
 
+extern const F32 HTTP_REQUEST_EXPIRY_SECS;
+
 class LLUUID;
 class LLPumpIO;
 class LLSD;
@@ -50,19 +52,19 @@ class LLHTTPClient
 
 	typedef boost::intrusive_ptr<Responder>	ResponderPtr;
 	
-	static void get(const std::string& url, ResponderPtr);
-	static void put(const std::string& url, const LLSD& body, ResponderPtr);
+	static void get(const std::string& url, ResponderPtr, const F32 timeout=HTTP_REQUEST_EXPIRY_SECS);
+	static void put(const std::string& url, const LLSD& body, ResponderPtr, const F32 timeout=HTTP_REQUEST_EXPIRY_SECS);
 		///< non-blocking
-	static void post(const std::string& url, const LLSD& body, ResponderPtr);
-	static void post(const std::string& url, const U8* data, S32 size, ResponderPtr responder);
-	static void postFile(const std::string& url, const std::string& filename, ResponderPtr);
+	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);
+		LLAssetType::EType asset_type, ResponderPtr responder, const F32 timeout=HTTP_REQUEST_EXPIRY_SECS);
 
 	// Blocking HTTP get that returns an LLSD map of status and body.
 	static LLSD blockingGet(const std::string& url);
 
-	static void del(const std::string& url, ResponderPtr);
+	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++
 	
 	
-- 
GitLab