summaryrefslogtreecommitdiff
path: root/platform/default/http_request_curl.cpp
diff options
context:
space:
mode:
authorJohn Firebaugh <john.firebaugh@gmail.com>2015-12-23 14:16:15 -0800
committerJohn Firebaugh <john.firebaugh@gmail.com>2015-12-23 14:30:20 -0800
commitc972a251da6e6bc5dadf243045181462ffb01700 (patch)
treef409b2cca1bbbd0fd825c98996d4c7879c5069e7 /platform/default/http_request_curl.cpp
parent16de579d7cfc2960793cbcb5e95741f22ab73768 (diff)
downloadqtlocation-mapboxgl-c972a251da6e6bc5dadf243045181462ffb01700.tar.gz
[core] Remove `Resource` dependency from low-level classes
These classes should not be coupled to domain-specific resource types.
Diffstat (limited to 'platform/default/http_request_curl.cpp')
-rw-r--r--platform/default/http_request_curl.cpp15
1 files changed, 7 insertions, 8 deletions
diff --git a/platform/default/http_request_curl.cpp b/platform/default/http_request_curl.cpp
index 065b90501b..e1ea931fbe 100644
--- a/platform/default/http_request_curl.cpp
+++ b/platform/default/http_request_curl.cpp
@@ -1,6 +1,5 @@
#include <mbgl/storage/http_context_base.hpp>
#include <mbgl/storage/http_request_base.hpp>
-#include <mbgl/storage/resource.hpp>
#include <mbgl/storage/response.hpp>
#include <mbgl/platform/log.hpp>
@@ -47,7 +46,7 @@ public:
HTTPCURLContext();
~HTTPCURLContext();
- HTTPRequestBase* createRequest(const Resource&,
+ HTTPRequestBase* createRequest(const std::string& url,
RequestBase::Callback,
std::shared_ptr<const Response>) final;
@@ -80,7 +79,7 @@ class HTTPCURLRequest : public HTTPRequestBase {
public:
HTTPCURLRequest(HTTPCURLContext*,
- const Resource&,
+ const std::string& url,
Callback,
std::shared_ptr<const Response>);
~HTTPCURLRequest();
@@ -139,10 +138,10 @@ HTTPCURLContext::~HTTPCURLContext() {
timeout.stop();
}
-HTTPRequestBase* HTTPCURLContext::createRequest(const Resource& resource,
+HTTPRequestBase* HTTPCURLContext::createRequest(const std::string& url,
RequestBase::Callback callback,
std::shared_ptr<const Response> response) {
- return new HTTPCURLRequest(this, resource, callback, response);
+ return new HTTPCURLRequest(this, url, callback, response);
}
CURL *HTTPCURLContext::getHandle() {
@@ -353,8 +352,8 @@ static CURLcode sslctx_function(CURL * /* curl */, void *sslctx, void * /* parm
}
#endif
-HTTPCURLRequest::HTTPCURLRequest(HTTPCURLContext* context_, const Resource& resource_, Callback callback_, std::shared_ptr<const Response> response_)
- : HTTPRequestBase(resource_, callback_),
+HTTPCURLRequest::HTTPCURLRequest(HTTPCURLContext* context_, const std::string& url_, Callback callback_, std::shared_ptr<const Response> response_)
+ : HTTPRequestBase(url_, callback_),
context(context_),
existingResponse(response_),
handle(context->getHandle()) {
@@ -387,7 +386,7 @@ HTTPCURLRequest::HTTPCURLRequest(HTTPCURLContext* context_, const Resource& reso
handleError(curl_easy_setopt(handle, CURLOPT_CAINFO, "ca-bundle.crt"));
#endif
handleError(curl_easy_setopt(handle, CURLOPT_FOLLOWLOCATION, 1));
- handleError(curl_easy_setopt(handle, CURLOPT_URL, resource.url.c_str()));
+ handleError(curl_easy_setopt(handle, CURLOPT_URL, url.c_str()));
handleError(curl_easy_setopt(handle, CURLOPT_WRITEFUNCTION, writeCallback));
handleError(curl_easy_setopt(handle, CURLOPT_WRITEDATA, this));
handleError(curl_easy_setopt(handle, CURLOPT_HEADERFUNCTION, headerCallback));