| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556 |
- #include "HttpRequestTaskS3E.h"
- namespace oxygine
- {
- static HttpRequestTask* createS3E()
- {
- return new HttpRequestTaskS3E;
- }
-
- void HttpRequestTask::init()
- {
- setCustomRequests(createS3E);
- }
- void HttpRequestTask::release()
- {
- }
- }
- HttpRequestTaskS3E::HttpRequestTaskS3E()
- {
- }
- void HttpRequestTaskS3E::_run()
- {
- _http._cbDone = CLOSURE(this, &HttpRequestTaskS3E::onDone);
- _http._cbError = CLOSURE(this, &HttpRequestTaskS3E::onError);
- if (_fname.empty())
- {
- if (_postData.empty())
- _http.get(_url);
- else
- _http.post(_url, (const char*)&_postData.front(), _postData.size());
- }
- else
- _http.getFile(_url, _fname);
- addRef();
- }
- void HttpRequestTaskS3E::onDone(MyHttp*)
- {
- std::swap(_response, _http.getBuffer());
- onComplete();
- releaseRef();
- }
- void HttpRequestTaskS3E::onError(MyHttp*)
- {
- AsyncTask::onError();
- releaseRef();
- }
|