00001
00032 #ifndef LL_LLHTTPCLIENT_H
00033 #define LL_LLHTTPCLIENT_H
00034
00039 #include <string>
00040
00041 #include <boost/intrusive_ptr.hpp>
00042
00043 #include "llassettype.h"
00044 #include "llcurl.h"
00045 #include "lliopipe.h"
00046
00047 extern const F32 HTTP_REQUEST_EXPIRY_SECS;
00048
00049 class LLUUID;
00050 class LLPumpIO;
00051 class LLSD;
00052
00053
00054 class LLHTTPClient
00055 {
00056 public:
00057
00058
00059
00060 typedef LLCurl::Responder Responder;
00061 typedef LLCurl::ResponderPtr ResponderPtr;
00062
00065 static void head(const std::string& url, ResponderPtr, const F32 timeout=HTTP_REQUEST_EXPIRY_SECS);
00066 static void getByteRange(const std::string& url, S32 offset, S32 bytes, ResponderPtr, const LLSD& headers=LLSD(), const F32 timeout=HTTP_REQUEST_EXPIRY_SECS);
00067 static void get(const std::string& url, ResponderPtr, const LLSD& headers = LLSD(), const F32 timeout=HTTP_REQUEST_EXPIRY_SECS);
00068 static void get(const std::string& url, const LLSD& query, ResponderPtr, const LLSD& headers = LLSD(), const F32 timeout=HTTP_REQUEST_EXPIRY_SECS);
00069
00070 static void put(const std::string& url, const LLSD& body, ResponderPtr, const F32 timeout=HTTP_REQUEST_EXPIRY_SECS);
00071 static void getHeaderOnly(const std::string& url, ResponderPtr, const F32 timeout=HTTP_REQUEST_EXPIRY_SECS);
00072 static void getHeaderOnly(const std::string& url, ResponderPtr, const LLSD& headers, const F32 timeout=HTTP_REQUEST_EXPIRY_SECS);
00073
00074 static void post(const std::string& url, const LLSD& body, ResponderPtr, const F32 timeout=HTTP_REQUEST_EXPIRY_SECS);
00075 static void post(const std::string& url, const U8* data, S32 size, ResponderPtr responder, const F32 timeout=HTTP_REQUEST_EXPIRY_SECS);
00076 static void postFile(const std::string& url, const std::string& filename, ResponderPtr, const F32 timeout=HTTP_REQUEST_EXPIRY_SECS);
00077 static void postFile(const std::string& url, const LLUUID& uuid,
00078 LLAssetType::EType asset_type, ResponderPtr responder, const F32 timeout=HTTP_REQUEST_EXPIRY_SECS);
00079
00080 static void del(
00081 const std::string& url,
00082 ResponderPtr responder,
00083 const F32 timeout=HTTP_REQUEST_EXPIRY_SECS);
00085
00094 static void move(
00095 const std::string& url,
00096 const std::string& destination,
00097 ResponderPtr responder,
00098 const F32 timeout=HTTP_REQUEST_EXPIRY_SECS);
00099
00101
00108 static LLSD blockingGet(const std::string& url);
00109
00110
00111
00112 static void setPump(LLPumpIO& pump);
00114 static bool hasPump();
00116 };
00117
00118 #endif // LL_LLHTTPCLIENT_H