16#include "ThreadPool/ThreadPool.h"
20namespace network_manager
28 : mRequest { request }
57 bool hasHeader(
const std::string& headerName)
const noexcept override
62 std::string
getHeader(
const std::string& headerName)
const override
129 : mThreadPool (
std::make_unique<ThreadPool>(
132 std::thread::hardware_concurrency ()
157 return std::make_shared<StubResponse>(request);
160 std::make_shared<CurlResponse>(verb, request,
mHandleManager.get());
163 [response, payloadStream = std::move(payloadStream)]()
166 response->setPayload(payloadStream);
176 std::unique_ptr<MultipartData> form)
179 return std::make_shared<StubResponse>(request);
181 std::shared_ptr<CurlResponse> response =
182 std::make_shared<CurlResponse>(verb, request,
mHandleManager.get());
186 [response, rawForm = form.release()]()
mutable
188 if (rawForm != nullptr && !rawForm->IsEmpty())
189 response->setForm(std::unique_ptr<MultipartData>(rawForm));
Declare an implementation of IResponse using libcurl.
Declare an implementation of IResponseFactory using libcurl.
Declare a class for constructing HTTP requests.
ResponsePtr performRequest(RequestVerb verb, const Request &request) override
std::unique_ptr< CurlHandleManager > mHandleManager
void terminate() override
void setProxy(const std::string &proxy) override
std::unique_ptr< ThreadPool > mThreadPool
Interface, that provides access to the data from the HTTP response.
std::function< void(int64_t current, int64_t expected)> ProgressCallback
std::function< void(IResponse *)> RequestCallback
std::string getHeader(const std::string &headerName) const override
std::string getErrorString() const override
unsigned getHTTPCode() const noexcept override
bool isFinished() const noexcept override
uint64_t readData(void *, uint64_t) override
void setOnDataReceivedCallback(RequestCallback) override
void setUploadProgressCallback(ProgressCallback) override
Set the upload progress callback.
std::string getURL() const override
const CookiesList & getCookies() const noexcept override
bool headersReceived() const noexcept override
uint64_t getBytesAvailable() const noexcept override
const Request & getRequest() const noexcept override
StubResponse(const Request &request)
void setDownloadProgressCallback(ProgressCallback) override
Set the download progress callback.
const HeadersList & getHeaders() const noexcept override
bool hasHeader(const std::string &headerName) const noexcept override
void abort() noexcept override
void setRequestFinishedCallback(RequestCallback callback) override
NetworkError getError() const noexcept override
std::shared_ptr< IResponse > ResponsePtr
std::shared_ptr< RequestPayloadStream > RequestPayloadStreamPtr
constexpr decltype(std::thread::hardware_concurrency()) MIN_CURL_THREADS