svn merge -r 58913:59058 svn+ssh://svn/svn/linden/branches/rez-content-loss-1 into release

master
Don Kjer 2007-04-05 16:23:03 +00:00
parent 2ce0fc5f18
commit ae588e76f1
2 changed files with 26 additions and 24 deletions

View File

@ -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

View File

@ -19,6 +19,8 @@
#include "llassettype.h"
extern const F32 HTTP_REQUEST_EXPIRY_SECS;
class LLUUID;
class LLPumpIO;
class LLSD;
@ -50,19 +52,19 @@ public:
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++