aboutsummaryrefslogtreecommitdiff
path: root/backends/networking/curl
diff options
context:
space:
mode:
Diffstat (limited to 'backends/networking/curl')
-rw-r--r--backends/networking/curl/curljsonrequest.cpp4
-rw-r--r--backends/networking/curl/curljsonrequest.h2
-rw-r--r--backends/networking/curl/curlrequest.cpp10
-rw-r--r--backends/networking/curl/curlrequest.h11
4 files changed, 14 insertions, 13 deletions
diff --git a/backends/networking/curl/curljsonrequest.cpp b/backends/networking/curl/curljsonrequest.cpp
index 1231f9e7e8..326d8e27a0 100644
--- a/backends/networking/curl/curljsonrequest.cpp
+++ b/backends/networking/curl/curljsonrequest.cpp
@@ -31,7 +31,7 @@
namespace Networking {
-CurlJsonRequest::CurlJsonRequest(JsonCallback cb, const char *url):
+CurlJsonRequest::CurlJsonRequest(JsonCallback cb, Common::String url):
CurlRequest(0, url), _jsonCallback(cb), _contentsStream(DisposeAfterUse::YES) {}
CurlJsonRequest::~CurlJsonRequest() {}
@@ -55,7 +55,7 @@ char *CurlJsonRequest::getPreparedContents() {
}
void CurlJsonRequest::handle() {
- if (!_stream) _stream = new NetworkReadStream(_url, _headersList, _postFields);
+ if (!_stream) _stream = new NetworkReadStream(_url.c_str(), _headersList, _postFields);
if (_stream) {
const int kBufSize = 16*1024;
diff --git a/backends/networking/curl/curljsonrequest.h b/backends/networking/curl/curljsonrequest.h
index af19ec3596..5e78bd1965 100644
--- a/backends/networking/curl/curljsonrequest.h
+++ b/backends/networking/curl/curljsonrequest.h
@@ -42,7 +42,7 @@ class CurlJsonRequest: public CurlRequest {
char *getPreparedContents();
public:
- CurlJsonRequest(JsonCallback cb, const char *url);
+ CurlJsonRequest(JsonCallback cb, Common::String url);
virtual ~CurlJsonRequest();
virtual void handle();
diff --git a/backends/networking/curl/curlrequest.cpp b/backends/networking/curl/curlrequest.cpp
index 1b42ac5931..f01a430b87 100644
--- a/backends/networking/curl/curlrequest.cpp
+++ b/backends/networking/curl/curlrequest.cpp
@@ -30,7 +30,7 @@
namespace Networking {
-CurlRequest::CurlRequest(DataCallback cb, const char *url):
+CurlRequest::CurlRequest(DataCallback cb, Common::String url):
Request(cb), _url(url), _stream(0), _headersList(0) {}
CurlRequest::~CurlRequest() {
@@ -38,7 +38,7 @@ CurlRequest::~CurlRequest() {
}
void CurlRequest::handle() {
- if (!_stream) _stream = new NetworkReadStream(_url, _headersList, _postFields);
+ if (!_stream) _stream = new NetworkReadStream(_url.c_str(), _headersList, _postFields);
if (_stream && _stream->eos()) {
if (_stream->httpResponseCode() != 200)
@@ -71,13 +71,13 @@ void CurlRequest::addPostField(Common::String keyValuePair) {
_postFields += "&" + keyValuePair;
}
-NetworkReadStream *CurlRequest::execute() {
+Cloud::Storage::RequestReadStreamPair CurlRequest::execute() {
if (!_stream) {
- _stream = new NetworkReadStream(_url, _headersList, _postFields);
+ _stream = new NetworkReadStream(_url.c_str(), _headersList, _postFields);
ConnMan.addRequest(this);
}
- return _stream;
+ return Cloud::Storage::RequestReadStreamPair(_id, _stream);
}
} //end of namespace Networking
diff --git a/backends/networking/curl/curlrequest.h b/backends/networking/curl/curlrequest.h
index c624194142..18a41a1c06 100644
--- a/backends/networking/curl/curlrequest.h
+++ b/backends/networking/curl/curlrequest.h
@@ -24,8 +24,9 @@
#define BACKENDS_NETWORKING_CURL_CURLREQUEST_H
#include "backends/networking/curl/request.h"
+#include "backends/cloud/storage.h"
#include "common/str.h"
-#include <common/array.h>
+#include "common/array.h"
struct curl_slist;
@@ -35,13 +36,13 @@ class NetworkReadStream;
class CurlRequest: public Request {
protected:
- const char *_url;
+ Common::String _url;
NetworkReadStream *_stream;
curl_slist *_headersList;
Common::String _postFields;
public:
- CurlRequest(DataCallback cb, const char *url);
+ CurlRequest(DataCallback cb, Common::String url);
virtual ~CurlRequest();
virtual void handle();
@@ -51,8 +52,8 @@ public:
virtual void addHeader(Common::String header);
virtual void addPostField(Common::String field);
- /** Start this Request with ConnMan. Returns its ReadStream. */
- virtual NetworkReadStream *execute();
+ /** Start this Request with ConnMan. Returns its ReadStream and request id. */
+ virtual Cloud::Storage::RequestReadStreamPair execute();
};
} //end of namespace Networking