summaryrefslogtreecommitdiff
path: root/indra/llmessage/llhttpclient.cpp
diff options
context:
space:
mode:
authorDave Hiller <daveh@lindenlab.com>2008-07-31 12:15:15 +0000
committerDave Hiller <daveh@lindenlab.com>2008-07-31 12:15:15 +0000
commit9a7d68cfce5f71cf9d89536431d72941dc369749 (patch)
treef7e0ce093abef0fcc7737cac63bc2a8dbf11b729 /indra/llmessage/llhttpclient.cpp
parentf0f2a416911ba8de9ac1e08cd90720c0d789bb2e (diff)
svn merge -r93014:93396 svn+ssh://svn.lindenlab.com/svn/linden/branches/mono-r93014-qar633 dataserver-is-deprecated
Diffstat (limited to 'indra/llmessage/llhttpclient.cpp')
-rw-r--r--indra/llmessage/llhttpclient.cpp29
1 files changed, 17 insertions, 12 deletions
diff --git a/indra/llmessage/llhttpclient.cpp b/indra/llmessage/llhttpclient.cpp
index 2937edd853..7a6add6282 100644
--- a/indra/llmessage/llhttpclient.cpp
+++ b/indra/llmessage/llhttpclient.cpp
@@ -122,7 +122,7 @@ namespace
{
public:
RawInjector(const U8* data, S32 size) : mData(data), mSize(size) {}
- virtual ~RawInjector() {}
+ virtual ~RawInjector() {delete mData;}
const char* contentType() { return "application/octet-stream"; }
@@ -153,16 +153,21 @@ namespace
LLBufferStream ostream(channels, buffer.get());
llifstream fstream(mFilename, std::iostream::binary | std::iostream::out);
- fstream.seekg(0, std::ios::end);
- U32 fileSize = fstream.tellg();
- fstream.seekg(0, std::ios::beg);
- char* fileBuffer;
- fileBuffer = new char [fileSize];
- fstream.read(fileBuffer, fileSize);
- ostream.write(fileBuffer, fileSize);
- fstream.close();
- eos = true;
- return STATUS_DONE;
+ if(fstream.is_open())
+ {
+ fstream.seekg(0, std::ios::end);
+ U32 fileSize = fstream.tellg();
+ fstream.seekg(0, std::ios::beg);
+ char* fileBuffer;
+ fileBuffer = new char [fileSize];
+ fstream.read(fileBuffer, fileSize);
+ ostream.write(fileBuffer, fileSize);
+ fstream.close();
+ eos = true;
+ return STATUS_DONE;
+ }
+
+ return STATUS_ERROR;
}
const std::string mFilename;
@@ -402,7 +407,7 @@ void LLHTTPClient::post(const std::string& url, const LLSD& body, ResponderPtr r
request(url, LLURLRequest::HTTP_POST, new LLSDInjector(body), responder, timeout);
}
-void LLHTTPClient::post(const std::string& url, const U8* data, S32 size, ResponderPtr responder, const F32 timeout)
+void LLHTTPClient::postRaw(const std::string& url, const U8* data, S32 size, ResponderPtr responder, const F32 timeout)
{
request(url, LLURLRequest::HTTP_POST, new RawInjector(data, size), responder, timeout);
}