diff options
Diffstat (limited to 'indra/llmessage')
-rw-r--r-- | indra/llmessage/llhttpclient.cpp | 26 | ||||
-rw-r--r-- | indra/llmessage/llhttpclient.h | 1 |
2 files changed, 27 insertions, 0 deletions
diff --git a/indra/llmessage/llhttpclient.cpp b/indra/llmessage/llhttpclient.cpp index d83308d082..f93a12b274 100644 --- a/indra/llmessage/llhttpclient.cpp +++ b/indra/llmessage/llhttpclient.cpp @@ -131,6 +131,27 @@ namespace const LLSD mSD; }; + + class RawInjector : public Injector + { + public: + RawInjector(const U8* data, S32 size) : mData(data), mSize(size) {} + virtual ~RawInjector() {} + + const char* contentType() { return "application/octet-stream"; } + + virtual EStatus process_impl(const LLChannelDescriptors& channels, + buffer_ptr_t& buffer, bool& eos, LLSD& context, LLPumpIO* pump) + { + LLBufferStream ostream(channels, buffer.get()); + ostream.write((const char *)mData, mSize); // hopefully chars are always U8s + eos = true; + return STATUS_DONE; + } + + const U8* mData; + S32 mSize; + }; class FileInjector : public Injector { @@ -301,6 +322,11 @@ void LLHTTPClient::post(const std::string& url, const LLSD& body, ResponderPtr r request(url, LLURLRequest::HTTP_POST, new LLSDInjector(body), responder); } +void LLHTTPClient::post(const std::string& url, const U8* data, S32 size, ResponderPtr responder) +{ + request(url, LLURLRequest::HTTP_POST, new RawInjector(data, size), responder); +} + void LLHTTPClient::del(const std::string& url, ResponderPtr responder) { request(url, LLURLRequest::HTTP_DELETE, NULL, responder); diff --git a/indra/llmessage/llhttpclient.h b/indra/llmessage/llhttpclient.h index d64662e41d..a8afea312d 100644 --- a/indra/llmessage/llhttpclient.h +++ b/indra/llmessage/llhttpclient.h @@ -54,6 +54,7 @@ public: static void put(const std::string& url, const LLSD& body, ResponderPtr); ///< 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 postFile(const std::string& url, const LLUUID& uuid, LLAssetType::EType asset_type, ResponderPtr responder); |