Audacity 3.2.0
|
#include <CurlResponse.h>
Public Member Functions | |
CurlResponse (RequestVerb verb, const Request &request, CurlHandleManager *handleManager) noexcept | |
bool | isFinished () const noexcept override |
unsigned | getHTTPCode () const noexcept override |
NetworkError | getError () const noexcept override |
std::string | getErrorString () const override |
bool | headersReceived () const noexcept override |
bool | hasHeader (const std::string &headerName) const noexcept override |
std::string | getHeader (const std::string &headerName) const override |
const HeadersList & | getHeaders () const noexcept override |
const CookiesList & | getCookies () const noexcept override |
const Request & | getRequest () const noexcept override |
std::string | getURL () const override |
void | abort () noexcept override |
void | setOnDataReceivedCallback (RequestCallback callback) override |
void | setRequestFinishedCallback (RequestCallback callback) override |
virtual void | setDownloadProgressCallback (ProgressCallback callback) override |
Set the download progress callback. More... | |
virtual void | setUploadProgressCallback (ProgressCallback callback) override |
Set the upload progress callback. More... | |
uint64_t | getBytesAvailable () const noexcept override |
uint64_t | readData (void *buffer, uint64_t maxBytesCount) override |
void | setPayload (RequestPayloadStreamPtr payload) |
void | setForm (std::unique_ptr< MultipartData > form) |
void | perform () |
Public Member Functions inherited from audacity::network_manager::IResponse | |
virtual | ~IResponse ()=default |
virtual bool | isFinished () const noexcept=0 |
virtual unsigned | getHTTPCode () const noexcept=0 |
virtual NetworkError | getError () const noexcept=0 |
virtual std::string | getErrorString () const =0 |
virtual bool | headersReceived () const noexcept=0 |
virtual bool | hasHeader (const std::string &headerName) const noexcept=0 |
virtual std::string | getHeader (const std::string &headerName) const =0 |
virtual const HeadersList & | getHeaders () const noexcept=0 |
virtual const CookiesList & | getCookies () const noexcept=0 |
virtual const Request & | getRequest () const noexcept=0 |
virtual std::string | getURL () const =0 |
virtual void | abort () noexcept=0 |
virtual void | setOnDataReceivedCallback (RequestCallback callback)=0 |
virtual void | setRequestFinishedCallback (RequestCallback callback)=0 |
virtual void | setDownloadProgressCallback (ProgressCallback callback)=0 |
Set the download progress callback. More... | |
virtual void | setUploadProgressCallback (ProgressCallback callback)=0 |
Set the upload progress callback. More... | |
virtual uint64_t | getBytesAvailable () const noexcept=0 |
virtual uint64_t | readData (void *buffer, uint64_t maxBytesCount)=0 |
template<typename RetVal = std::vector<uint8_t>> | |
RetVal | readAll () |
void | Cancel () override |
Public Member Functions inherited from audacity::concurrency::ICancellable | |
virtual | ~ICancellable ()=default |
virtual void | Cancel ()=0 |
Static Private Member Functions | |
static size_t | WriteCallback (const uint8_t *ptr, size_t size, size_t nmemb, CurlResponse *userdata) noexcept |
static size_t | HeaderCallback (const char *buffer, size_t size, size_t nitems, CurlResponse *userdata) noexcept |
static int | CurlProgressCallback (CurlResponse *clientp, curl_off_t dltotal, curl_off_t dlnow, curl_off_t ultotal, curl_off_t ulnow) noexcept |
Private Attributes | |
RequestVerb | mVerb |
Request | mRequest |
CurlHandleManager * | mHandleManager |
CurlHandleManager::Handle * | mCurrentHandle { nullptr } |
std::mutex | mCallbackMutex |
RequestCallback | mOnDataReceivedCallback |
RequestCallback | mRequestFinishedCallback |
ProgressCallback | mDownloadProgressCallback |
ProgressCallback | mUploadProgressCallback |
std::mutex | mHeadersMutex |
HeadersList | mResponseHeaders |
CookiesList | mResponseCookies |
std::mutex | mDataBufferMutex |
std::deque< uint8_t > | mDataBuffer |
std::recursive_mutex | mStatusMutex |
NetworkError | mNetworkError { NetworkError::NoError } |
std::string | mErrorString |
unsigned | mHttpCode { 0 } |
RequestPayloadStreamPtr | mPayload |
std::unique_ptr< MultipartData > | mForm |
bool | mHeadersReceived { false } |
bool | mRequestFinished { false } |
bool | mAbortRequested { false } |
Additional Inherited Members | |
Public Types inherited from audacity::network_manager::IResponse | |
using | RequestCallback = std::function< void(IResponse *)> |
using | ProgressCallback = std::function< void(int64_t current, int64_t expected)> |
Definition at line 35 of file CurlResponse.h.
|
noexcept |
Definition at line 94 of file CurlResponse.cpp.
|
overridevirtualnoexcept |
Implements audacity::network_manager::IResponse.
Definition at line 165 of file CurlResponse.cpp.
References mAbortRequested, and mStatusMutex.
|
staticprivatenoexcept |
Definition at line 446 of file CurlResponse.cpp.
Referenced by perform().
|
overridevirtualnoexcept |
Implements audacity::network_manager::IResponse.
Definition at line 205 of file CurlResponse.cpp.
References mDataBuffer, and mDataBufferMutex.
Referenced by setOnDataReceivedCallback().
|
overridevirtualnoexcept |
Implements audacity::network_manager::IResponse.
Definition at line 149 of file CurlResponse.cpp.
References mHeadersMutex, and mResponseCookies.
|
overridevirtualnoexcept |
Implements audacity::network_manager::IResponse.
Definition at line 113 of file CurlResponse.cpp.
References mNetworkError, and mStatusMutex.
|
overridevirtual |
Implements audacity::network_manager::IResponse.
Definition at line 119 of file CurlResponse.cpp.
References mErrorString, and mStatusMutex.
|
overridevirtual |
Implements audacity::network_manager::IResponse.
Definition at line 137 of file CurlResponse.cpp.
References audacity::network_manager::HeadersList::getHeaderValue(), mHeadersMutex, and mResponseHeaders.
|
overridevirtualnoexcept |
Implements audacity::network_manager::IResponse.
Definition at line 143 of file CurlResponse.cpp.
References mHeadersMutex, and mResponseHeaders.
|
overridevirtualnoexcept |
Implements audacity::network_manager::IResponse.
Definition at line 107 of file CurlResponse.cpp.
References mHttpCode, and mStatusMutex.
|
overridevirtualnoexcept |
Implements audacity::network_manager::IResponse.
Definition at line 155 of file CurlResponse.cpp.
References mRequest.
|
overridevirtual |
Implements audacity::network_manager::IResponse.
Definition at line 160 of file CurlResponse.cpp.
References audacity::network_manager::Request::getURL(), and mRequest.
|
overridevirtualnoexcept |
Implements audacity::network_manager::IResponse.
Definition at line 131 of file CurlResponse.cpp.
|
staticprivatenoexcept |
Definition at line 407 of file CurlResponse.cpp.
References audacity::network_manager::Header::hasSameName(), audacity::network_manager::Cookie::Parse(), audacity::network_manager::Header::Parse(), size, and audacity::network_manager::Header::Value.
Referenced by perform().
|
overridevirtualnoexcept |
Implements audacity::network_manager::IResponse.
Definition at line 125 of file CurlResponse.cpp.
References mHeadersReceived, and mStatusMutex.
|
overridevirtualnoexcept |
Implements audacity::network_manager::IResponse.
Definition at line 101 of file CurlResponse.cpp.
References mRequestFinished, and mStatusMutex.
void audacity::network_manager::CurlResponse::perform | ( | ) |
Definition at line 243 of file CurlResponse.cpp.
References audacity::network_manager::CurlHandleManager::Handle::appendCookies(), audacity::network_manager::CurlHandleManager::Handle::appendHeader(), audacity::network_manager::CurlHandleManager::Handle::appendHeaders(), CurlProgressCallback(), audacity::network_manager::anonymous_namespace{CurlResponse.cpp}::DataStreamRead(), audacity::network_manager::anonymous_namespace{CurlResponse.cpp}::DataStreamSeek(), audacity::network_manager::anonymous_namespace{CurlResponse.cpp}::errorsMap, audacity::network_manager::Request::getCookies(), audacity::network_manager::CurlHandleManager::Handle::getCurlHandle(), audacity::network_manager::CurlHandleManager::getHandle(), audacity::network_manager::Request::getHeaders(), audacity::network_manager::CurlHandleManager::Handle::getHTTPCode(), audacity::network_manager::Request::getMaxRedirects(), audacity::network_manager::Request::getTimeout(), audacity::network_manager::Request::getURL(), HeaderCallback(), audacity::network_manager::HTTPError, mCallbackMutex, mCurrentHandle, mDownloadProgressCallback, mErrorString, mForm, mHandleManager, mHttpCode, audacity::network_manager::anonymous_namespace{CurlResponse.cpp}::MimePartRead(), audacity::network_manager::anonymous_namespace{CurlResponse.cpp}::MimePartSeek(), mNetworkError, mOnDataReceivedCallback, mPayload, mRequest, mRequestFinished, mRequestFinishedCallback, mStatusMutex, mUploadProgressCallback, mVerb, audacity::network_manager::Patch, audacity::network_manager::CurlHandleManager::Handle::perform(), audacity::network_manager::Post, audacity::network_manager::Put, audacity::network_manager::CurlHandleManager::Handle::setOption(), audacity::network_manager::UnknownError, and WriteCallback().
|
overridevirtual |
Implements audacity::network_manager::IResponse.
Definition at line 211 of file CurlResponse.cpp.
References details::begin(), staffpad::vo::copy(), details::end(), mDataBuffer, and mDataBufferMutex.
|
overridevirtual |
Set the download progress callback.
Implements audacity::network_manager::IResponse.
Definition at line 193 of file CurlResponse.cpp.
References mCallbackMutex, and mDownloadProgressCallback.
void audacity::network_manager::CurlResponse::setForm | ( | std::unique_ptr< MultipartData > | form | ) |
Definition at line 238 of file CurlResponse.cpp.
References mForm.
|
overridevirtual |
Implements audacity::network_manager::IResponse.
Definition at line 171 of file CurlResponse.cpp.
References getBytesAvailable(), mCallbackMutex, and mOnDataReceivedCallback.
void audacity::network_manager::CurlResponse::setPayload | ( | RequestPayloadStreamPtr | payload | ) |
Definition at line 233 of file CurlResponse.cpp.
References mPayload.
|
overridevirtual |
Implements audacity::network_manager::IResponse.
Definition at line 181 of file CurlResponse.cpp.
References mCallbackMutex, mRequestFinished, mRequestFinishedCallback, and mStatusMutex.
|
overridevirtual |
Set the upload progress callback.
Implements audacity::network_manager::IResponse.
Definition at line 199 of file CurlResponse.cpp.
References mCallbackMutex, and mUploadProgressCallback.
|
staticprivatenoexcept |
Definition at line 372 of file CurlResponse.cpp.
Referenced by perform().
|
private |
Definition at line 112 of file CurlResponse.h.
Referenced by abort().
|
mutableprivate |
Definition at line 87 of file CurlResponse.h.
Referenced by perform(), setDownloadProgressCallback(), setOnDataReceivedCallback(), setRequestFinishedCallback(), and setUploadProgressCallback().
|
private |
Definition at line 85 of file CurlResponse.h.
Referenced by perform().
|
private |
Definition at line 98 of file CurlResponse.h.
Referenced by getBytesAvailable(), and readData().
|
mutableprivate |
Definition at line 97 of file CurlResponse.h.
Referenced by getBytesAvailable(), and readData().
|
private |
Definition at line 90 of file CurlResponse.h.
Referenced by perform(), and setDownloadProgressCallback().
|
private |
Definition at line 103 of file CurlResponse.h.
Referenced by getErrorString(), and perform().
|
private |
Definition at line 108 of file CurlResponse.h.
|
private |
Definition at line 83 of file CurlResponse.h.
Referenced by perform().
|
mutableprivate |
Definition at line 93 of file CurlResponse.h.
Referenced by getCookies(), getHeader(), and getHeaders().
|
private |
Definition at line 110 of file CurlResponse.h.
Referenced by headersReceived().
|
private |
Definition at line 105 of file CurlResponse.h.
Referenced by getHTTPCode(), and perform().
|
private |
Definition at line 102 of file CurlResponse.h.
Referenced by getError(), and perform().
|
private |
Definition at line 88 of file CurlResponse.h.
Referenced by perform(), and setOnDataReceivedCallback().
|
private |
Definition at line 107 of file CurlResponse.h.
Referenced by perform(), and setPayload().
|
private |
Definition at line 82 of file CurlResponse.h.
Referenced by getRequest(), getURL(), and perform().
|
private |
Definition at line 111 of file CurlResponse.h.
Referenced by isFinished(), perform(), and setRequestFinishedCallback().
|
private |
Definition at line 89 of file CurlResponse.h.
Referenced by perform(), and setRequestFinishedCallback().
|
private |
Definition at line 95 of file CurlResponse.h.
Referenced by getCookies().
|
private |
Definition at line 94 of file CurlResponse.h.
Referenced by getHeader(), and getHeaders().
|
mutableprivate |
Definition at line 100 of file CurlResponse.h.
Referenced by abort(), getError(), getErrorString(), getHTTPCode(), headersReceived(), isFinished(), perform(), and setRequestFinishedCallback().
|
private |
Definition at line 91 of file CurlResponse.h.
Referenced by perform(), and setUploadProgressCallback().
|
private |
Definition at line 80 of file CurlResponse.h.
Referenced by perform().