diff options
author | Jacek Antonelli | 2008-08-15 23:45:34 -0500 |
---|---|---|
committer | Jacek Antonelli | 2008-08-15 23:45:34 -0500 |
commit | cd17687f01420952712a500107e0f93e7ab8d5f8 (patch) | |
tree | ce48c2b706f2c1176290e39fb555fbdf6648ce01 /linden/indra/llmessage/llhttpclient.h | |
parent | Second Life viewer sources 1.19.0.5 (diff) | |
download | meta-impy-cd17687f01420952712a500107e0f93e7ab8d5f8.zip meta-impy-cd17687f01420952712a500107e0f93e7ab8d5f8.tar.gz meta-impy-cd17687f01420952712a500107e0f93e7ab8d5f8.tar.bz2 meta-impy-cd17687f01420952712a500107e0f93e7ab8d5f8.tar.xz |
Second Life viewer sources 1.19.1.0
Diffstat (limited to '')
-rw-r--r-- | linden/indra/llmessage/llhttpclient.h | 71 |
1 files changed, 16 insertions, 55 deletions
diff --git a/linden/indra/llmessage/llhttpclient.h b/linden/indra/llmessage/llhttpclient.h index 703ee61..1587268 100644 --- a/linden/indra/llmessage/llhttpclient.h +++ b/linden/indra/llmessage/llhttpclient.h | |||
@@ -41,7 +41,7 @@ | |||
41 | #include <boost/intrusive_ptr.hpp> | 41 | #include <boost/intrusive_ptr.hpp> |
42 | 42 | ||
43 | #include "llassettype.h" | 43 | #include "llassettype.h" |
44 | #include "llbuffer.h" | 44 | #include "llcurl.h" |
45 | #include "lliopipe.h" | 45 | #include "lliopipe.h" |
46 | 46 | ||
47 | extern const F32 HTTP_REQUEST_EXPIRY_SECS; | 47 | extern const F32 HTTP_REQUEST_EXPIRY_SECS; |
@@ -54,48 +54,23 @@ class LLSD; | |||
54 | class LLHTTPClient | 54 | class LLHTTPClient |
55 | { | 55 | { |
56 | public: | 56 | public: |
57 | class Responder | 57 | // class Responder moved to LLCurl |
58 | { | 58 | |
59 | public: | 59 | // For convenience |
60 | Responder(); | 60 | typedef LLCurl::Responder Responder; |
61 | virtual ~Responder(); | 61 | typedef LLCurl::ResponderPtr ResponderPtr; |
62 | 62 | ||
63 | /** | 63 | // non-blocking |
64 | * @brief return true if the status code indicates success. | ||
65 | */ | ||
66 | static bool isGoodStatus(U32 status) | ||
67 | { | ||
68 | return((200 <= status) && (status < 300)); | ||
69 | } | ||
70 | |||
71 | virtual void error(U32 status, const std::string& reason); // called with bad status codes | ||
72 | |||
73 | virtual void result(const LLSD& content); | ||
74 | |||
75 | // Override point for clients that may want to use this class when the response is some other format besides LLSD | ||
76 | virtual void completedRaw(U32 status, const std::string& reason, const LLChannelDescriptors& channels, | ||
77 | const LLIOPipe::buffer_ptr_t& buffer); | ||
78 | |||
79 | virtual void completed(U32 status, const std::string& reason, const LLSD& content); | ||
80 | /**< The default implemetnation calls | ||
81 | either: | ||
82 | * result(), or | ||
83 | * error() | ||
84 | */ | ||
85 | |||
86 | public: /* but not really -- don't touch this */ | ||
87 | U32 mReferenceCount; | ||
88 | }; | ||
89 | |||
90 | typedef boost::intrusive_ptr<Responder> ResponderPtr; | ||
91 | |||
92 | static void head(const std::string& url, ResponderPtr, const F32 timeout=HTTP_REQUEST_EXPIRY_SECS); | 64 | static void head(const std::string& url, ResponderPtr, const F32 timeout=HTTP_REQUEST_EXPIRY_SECS); |
93 | static void get(const std::string& url, ResponderPtr, const F32 timeout=HTTP_REQUEST_EXPIRY_SECS); | 65 | static void getByteRange(const std::string& url, S32 offset, S32 bytes, ResponderPtr, const LLSD& headers=LLSD(), const F32 timeout=HTTP_REQUEST_EXPIRY_SECS); |
94 | static void get(const std::string& url, ResponderPtr, const LLSD& headers, const F32 timeout=HTTP_REQUEST_EXPIRY_SECS); | 66 | static void get(const std::string& url, ResponderPtr, const LLSD& headers = LLSD(), const F32 timeout=HTTP_REQUEST_EXPIRY_SECS); |
95 | static void get(const std::string& url, const LLSD& query, ResponderPtr, const F32 timeout=HTTP_REQUEST_EXPIRY_SECS); | 67 | static void get(const std::string& url, const LLSD& query, ResponderPtr, const LLSD& headers = LLSD(), const F32 timeout=HTTP_REQUEST_EXPIRY_SECS); |
96 | static void get(const std::string& url, const LLSD& query, ResponderPtr, const LLSD& headers, const F32 timeout=HTTP_REQUEST_EXPIRY_SECS); | 68 | |
97 | static void put(const std::string& url, const LLSD& body, ResponderPtr, const F32 timeout=HTTP_REQUEST_EXPIRY_SECS); | 69 | static void put(const std::string& url, const LLSD& body, ResponderPtr, const F32 timeout=HTTP_REQUEST_EXPIRY_SECS); |
98 | ///< non-blocking | 70 | static void getHeaderOnly(const std::string& url, ResponderPtr, const F32 timeout=HTTP_REQUEST_EXPIRY_SECS); |
71 | static void getHeaderOnly(const std::string& url, ResponderPtr, const LLSD& headers, const F32 timeout=HTTP_REQUEST_EXPIRY_SECS); | ||
72 | |||
73 | ///< non-blocking | ||
99 | static void post(const std::string& url, const LLSD& body, ResponderPtr, const F32 timeout=HTTP_REQUEST_EXPIRY_SECS); | 74 | static void post(const std::string& url, const LLSD& body, ResponderPtr, const F32 timeout=HTTP_REQUEST_EXPIRY_SECS); |
100 | static void post(const std::string& url, const U8* data, S32 size, ResponderPtr responder, const F32 timeout=HTTP_REQUEST_EXPIRY_SECS); | 75 | static void post(const std::string& url, const U8* data, S32 size, ResponderPtr responder, const F32 timeout=HTTP_REQUEST_EXPIRY_SECS); |
101 | static void postFile(const std::string& url, const std::string& filename, ResponderPtr, const F32 timeout=HTTP_REQUEST_EXPIRY_SECS); | 76 | static void postFile(const std::string& url, const std::string& filename, ResponderPtr, const F32 timeout=HTTP_REQUEST_EXPIRY_SECS); |
@@ -113,20 +88,6 @@ public: | |||
113 | ///< must be called before any of the above calls are made | 88 | ///< must be called before any of the above calls are made |
114 | static bool hasPump(); | 89 | static bool hasPump(); |
115 | ///< for testing | 90 | ///< for testing |
116 | |||
117 | static void setCABundle(const std::string& caBundle); | ||
118 | ///< use this root CA bundle when checking SSL connections | ||
119 | ///< defaults to the standard system root CA bundle | ||
120 | ///< @see LLURLRequest::checkRootCertificate() | ||
121 | }; | 91 | }; |
122 | 92 | ||
123 | |||
124 | |||
125 | namespace boost | ||
126 | { | ||
127 | void intrusive_ptr_add_ref(LLHTTPClient::Responder* p); | ||
128 | void intrusive_ptr_release(LLHTTPClient::Responder* p); | ||
129 | }; | ||
130 | |||
131 | |||
132 | #endif // LL_LLHTTPCLIENT_H | 93 | #endif // LL_LLHTTPCLIENT_H |