Audacity  3.0.3
CurlResponse.cpp
Go to the documentation of this file.
1 /*!********************************************************************
2 
3  Audacity: A Digital Audio Editor
4 
5  @file CurlResponse.cpp
6  @brief Define an implementation of IResponse using libcurl.
7 
8  Dmitry Vedenko
9  **********************************************************************/
10 
11 #include "CurlResponse.h"
12 
13 #include <cassert>
14 #include <map>
15 #include <algorithm>
16 
17 namespace audacity
18 {
19 namespace network_manager
20 {
21 namespace
22 {
23 
24 static const std::map<CURLcode, NetworkError> errorsMap = {
25  { CURLE_OK, NetworkError::NoError },
26  { CURLE_URL_MALFORMAT, NetworkError::BadURL },
27  { CURLE_COULDNT_RESOLVE_PROXY, NetworkError::ProxyNotFound },
28  { CURLE_COULDNT_RESOLVE_HOST, NetworkError::HostNotFound },
29  { CURLE_COULDNT_CONNECT, NetworkError::ConnectionRefused },
30  { CURLE_HTTP_RETURNED_ERROR, NetworkError::HTTPError },
31  { CURLE_WRITE_ERROR, NetworkError::OperationCancelled },
32  { CURLE_READ_ERROR, NetworkError::OperationCancelled },
33  { CURLE_OPERATION_TIMEDOUT, NetworkError::Timeout },
34  { CURLE_RANGE_ERROR, NetworkError::HTTPError },
35  { CURLE_HTTP_POST_ERROR, NetworkError::HTTPError },
36  { CURLE_SSL_CONNECT_ERROR, NetworkError::SSLHandshakeFailed },
37  { CURLE_ABORTED_BY_CALLBACK, NetworkError::OperationCancelled },
38  { CURLE_TOO_MANY_REDIRECTS, NetworkError::OperationCancelled },
39  { CURLE_PEER_FAILED_VERIFICATION, NetworkError::SSLHandshakeFailed },
40  { CURLE_GOT_NOTHING, NetworkError::RemoteHostClosed },
41  { CURLE_SSL_ENGINE_NOTFOUND, NetworkError::SSLHandshakeFailed },
42  { CURLE_SSL_ENGINE_SETFAILED, NetworkError::SSLHandshakeFailed },
43  { CURLE_SEND_ERROR, NetworkError::RemoteHostClosed },
44  { CURLE_RECV_ERROR, NetworkError::RemoteHostClosed },
45  { CURLE_SSL_CERTPROBLEM, NetworkError::SSLHandshakeFailed },
46  { CURLE_SSL_CIPHER, NetworkError::SSLHandshakeFailed },
47  { CURLE_SSL_CACERT, NetworkError::SSLHandshakeFailed },
48  { CURLE_USE_SSL_FAILED, NetworkError::SSLHandshakeFailed },
49  { CURLE_SSL_ENGINE_INITFAILED, NetworkError::SSLHandshakeFailed },
50  { CURLE_SSL_CACERT_BADFILE, NetworkError::SSLHandshakeFailed },
51  { CURLE_SSL_SHUTDOWN_FAILED, NetworkError::SSLHandshakeFailed },
52  { CURLE_SSL_CRL_BADFILE, NetworkError::SSLHandshakeFailed },
53  { CURLE_SSL_ISSUER_ERROR, NetworkError::SSLHandshakeFailed },
54  { CURLE_CHUNK_FAILED, NetworkError::HTTPError },
55  { CURLE_NO_CONNECTION_AVAILABLE, NetworkError::ConnectionFailed },
56  { CURLE_SSL_PINNEDPUBKEYNOTMATCH, NetworkError::SSLHandshakeFailed },
57  { CURLE_SSL_INVALIDCERTSTATUS, NetworkError::SSLHandshakeFailed },
58  { CURLE_PARTIAL_FILE, NetworkError::RemoteHostClosed }
59 };
60 
61 struct DataStream final
62 {
63  const char* Buffer;
64  size_t Size;
65 
66  size_t Offset { 0 };
67 };
68 
69 size_t DataStreamRead (char* ptr, size_t size, size_t nmemb, DataStream* stream) noexcept
70 {
71  size = std::min (size * nmemb, stream->Size - stream->Offset);
72 
73  const char* start = stream->Buffer + stream->Offset;
74  const char* end = start + size;
75 
76  std::copy (start, end, ptr);
77 
78  stream->Offset += size;
79 
80  return size;
81 }
82 
83 int DataStreamSeek (DataStream* stream, curl_off_t offs, int origin) noexcept
84 {
85  int64_t offset = offs;
86 
87  switch (origin)
88  {
89  case SEEK_CUR:
90  offset += stream->Offset;
91  break;
92  case SEEK_END:
93  offset += stream->Size;
94  break;
95  }
96 
97  if (offset < 0 || offset >= stream->Size)
98  return CURL_SEEKFUNC_FAIL;
99 
100  stream->Offset = offset;
101 
102  return CURL_SEEKFUNC_OK;
103 }
104 
105 }
106 
107 CurlResponse::CurlResponse (RequestVerb verb, const Request& request, CurlHandleManager* handleManager) noexcept
108  : mVerb(verb),
109  mRequest(request),
110  mHandleManager (handleManager)
111 {
112 }
113 
114 bool CurlResponse::isFinished () const noexcept
115 {
116  std::lock_guard<std::mutex> lock (mStatusMutex);
117  return mRequestFinished;
118 }
119 
120 unsigned CurlResponse::getHTTPCode () const noexcept
121 {
122  std::lock_guard<std::mutex> lock (mStatusMutex);
123  return mHttpCode;
124 }
125 
127 {
128  std::lock_guard<std::mutex> lock (mStatusMutex);
129  return mNetworkError;
130 }
131 
132 std::string CurlResponse::getErrorString () const
133 {
134  std::lock_guard<std::mutex> lock (mStatusMutex);
135  return mErrorString;
136 }
137 
138 bool CurlResponse::headersReceived () const noexcept
139 {
140  std::lock_guard<std::mutex> lock (mStatusMutex);
141  return mHeadersReceived;
142 }
143 
144 bool CurlResponse::hasHeader (const std::string& headerName) const noexcept
145 {
146  std::lock_guard<std::mutex> lock (mHeadersMutex);
147  return mResponseHeaders.hasHeader (headerName);
148 }
149 
150 std::string CurlResponse::getHeader (const std::string& headerName) const
151 {
152  std::lock_guard<std::mutex> lock (mHeadersMutex);
153  return mResponseHeaders.getHeaderValue (headerName);
154 }
155 
156 const HeadersList& CurlResponse::getHeaders () const noexcept
157 {
158  std::lock_guard<std::mutex> lock (mHeadersMutex);
159  return mResponseHeaders;
160 }
161 
162 const CookiesList& CurlResponse::getCookies () const noexcept
163 {
164  std::lock_guard<std::mutex> lock (mHeadersMutex);
165  return mResponseCookies;
166 }
167 
168 const Request& CurlResponse::getRequest () const noexcept
169 {
170  return mRequest;
171 }
172 
173 std::string CurlResponse::getURL () const
174 {
175  return mRequest.getURL ();
176 }
177 
178 void CurlResponse::abort () noexcept
179 {
180  std::lock_guard<std::mutex> lock (mStatusMutex);
181  mAbortRequested = true;
182 }
183 
184 void CurlResponse::setOnDataReceivedCallback (RequestCallback callback)
185 {
186  std::lock_guard<std::mutex> lock (mCallbackMutex);
187 
188  mOnDataReceivedCallback = std::move (callback);
189 
192 }
193 
194 void CurlResponse::setRequestFinishedCallback (RequestCallback callback)
195 {
196  std::lock_guard<std::mutex> callbackLock (mCallbackMutex);
197 
198  mRequestFinishedCallback = std::move (callback);
199 
200  std::lock_guard<std::mutex> statusLock (mStatusMutex);
201 
204 }
205 
207 {
208  std::lock_guard<std::mutex> callbackLock(mCallbackMutex);
209  mDownloadProgressCallback = std::move(callback);
210 }
211 
213 {
214  std::lock_guard<std::mutex> callbackLock(mCallbackMutex);
215  mUploadProgressCallback = std::move(callback);
216 }
217 
218 uint64_t CurlResponse::getBytesAvailable () const noexcept
219 {
220  std::lock_guard<std::mutex> lock (mDataBufferMutex);
221  return mDataBuffer.size ();
222 }
223 
224 uint64_t CurlResponse::readData (void* buffer, uint64_t maxBytesCount)
225 {
226  if (buffer == nullptr || maxBytesCount == 0)
227  return 0;
228 
229  std::lock_guard<std::mutex> lock (mDataBufferMutex);
230 
231  if (mDataBuffer.empty ())
232  return 0;
233 
234  maxBytesCount = std::min<uint64_t> (maxBytesCount, mDataBuffer.size ());
235 
236  const auto begin = mDataBuffer.begin ();
237  const auto end = begin + maxBytesCount;
238 
239  std::copy (begin, end, static_cast<uint8_t*> (buffer));
240 
241  mDataBuffer.erase (begin, end);
242 
243  return maxBytesCount;
244 }
245 
246 void CurlResponse::perform (const void* ptr, size_t size)
247 {
249 
250  handle.setOption (CURLOPT_WRITEFUNCTION, WriteCallback);
251  handle.setOption (CURLOPT_WRITEDATA, this);
252 
253  handle.setOption (CURLOPT_HEADERFUNCTION, HeaderCallback);
254  handle.setOption (CURLOPT_HEADERDATA, this);
255 
256  handle.setOption (CURLOPT_XFERINFOFUNCTION, CurlProgressCallback);
257  handle.setOption (CURLOPT_XFERINFODATA, this);
258 
259  handle.setOption (CURLOPT_FOLLOWLOCATION, mRequest.getMaxRedirects () == 0 ? 0 : 1);
260  handle.setOption (CURLOPT_MAXREDIRS, mRequest.getMaxRedirects ());
261 
262  handle.setOption (CURLOPT_NOPROGRESS, 0L);
263 
264  handle.setOption (CURLOPT_CONNECTTIMEOUT_MS,
265  std::chrono::duration_cast<std::chrono::milliseconds> (mRequest.getTimeout()).count ()
266  );
267 
268  handle.appendCookies (mRequest.getCookies ());
269 
270  DataStream ds { reinterpret_cast<const char*>(ptr), size };
271 
272  if (ptr != nullptr && size != 0)
273  {
274  handle.appendHeader ({ "Transfer-Encoding", std::string () });
275  handle.appendHeader ({ "Content-Length", std::to_string (size) });
276 
277  if (mVerb == RequestVerb::Post)
278  handle.setOption (CURLOPT_POSTFIELDSIZE_LARGE, size);
279  else
280  handle.setOption (CURLOPT_INFILESIZE_LARGE, size);
281 
282  handle.setOption (CURLOPT_READFUNCTION, DataStreamRead);
283  handle.setOption (CURLOPT_READDATA, &ds);
284 
285  handle.setOption (CURLOPT_SEEKFUNCTION, DataStreamSeek);
286  handle.setOption (CURLOPT_SEEKDATA, &ds);
287  }
288 
289  handle.appendHeaders (mRequest.getHeaders ());
290 
291  mCurrentHandle = &handle;
292  const auto result = handle.perform ();
293  mCurrentHandle = nullptr;
294 
295  {
296  std::lock_guard<std::mutex> lock (mStatusMutex);
297 
298  if (result.Code != CURLE_OK)
299  {
300  const auto it = errorsMap.find (result.Code);
301 
302  mNetworkError = it != errorsMap.end () ? it->second : NetworkError::UnknownError;
303  mErrorString = result.Message;
304  }
305  else
306  {
307  if (mHttpCode == 0)
308  mHttpCode = handle.getHTTPCode ();
309  }
310 
311  mRequestFinished = true;
312  }
313 
314  std::lock_guard<std::mutex> lock (mCallbackMutex);
315 
318 
323 }
324 
325 
326 size_t CurlResponse::WriteCallback (const uint8_t* ptr, size_t size, size_t nmemb, CurlResponse* request) noexcept
327 {
328  {
329  std::lock_guard<std::mutex> lock (request->mStatusMutex);
330 
331  if (request->mAbortRequested)
332  return 0;
333 
334  if (!request->mHeadersReceived)
335  {
336  request->mHeadersReceived = true;
337 
338  // WriteCallback is called by the handle
339  assert (request->mCurrentHandle != nullptr);
340 
341  if (request->mCurrentHandle != nullptr && request->mHttpCode == 0)
342  request->mHttpCode = request->mCurrentHandle->getHTTPCode ();
343  }
344  }
345 
346  size *= nmemb;
347 
348  {
349  std::lock_guard<std::mutex> lock (request->mDataBufferMutex);
350  request->mDataBuffer.insert (request->mDataBuffer.end (), ptr, ptr + size);
351  }
352 
353  std::lock_guard<std::mutex> lock (request->mCallbackMutex);
354 
355  if (request->mOnDataReceivedCallback)
356  request->mOnDataReceivedCallback (request);
357 
358  return size;
359 }
360 
361 size_t CurlResponse::HeaderCallback (const char* buffer, size_t size, size_t nitems, CurlResponse* request) noexcept
362 {
363  {
364  std::lock_guard<std::mutex> lock (request->mStatusMutex);
365 
366  if (request->mAbortRequested)
367  return 0;
368 
369  // HeaderCallback is called by the handle
370  assert (request->mCurrentHandle != nullptr);
371 
372  if (request->mCurrentHandle != nullptr && request->mHttpCode == 0)
373  request->mHttpCode = request->mCurrentHandle->getHTTPCode ();
374  }
375 
376  size = size * nitems;
377 
378  if (size < 2)
379  return 0;
380 
381  const Header header = Header::Parse (std::string (buffer, size - 2));
382 
383  std::lock_guard<std::mutex> lock (request->mHeadersMutex);
384 
385  if (header.hasSameName ("Set-Cookie"))
386  {
387  request->mResponseCookies.addCookie (Cookie::Parse (header.Value));
388  }
389  else
390  {
391  if (header.hasSameName ("Keep-Alive"))
392  request->mCurrentHandle->markKeepAlive ();
393 
394  request->mResponseHeaders.addHeader (header);
395  }
396 
397  return size;
398 }
399 
401  CurlResponse* clientp, curl_off_t dltotal, curl_off_t dlnow,
402  curl_off_t ultotal, curl_off_t ulnow) noexcept
403 {
404  std::lock_guard<std::mutex> callbackLock(clientp->mCallbackMutex);
405 
406  if (dltotal > 0 && clientp->mDownloadProgressCallback)
407  clientp->mDownloadProgressCallback(dlnow, dltotal);
408 
409  if (ultotal > 0 && clientp->mUploadProgressCallback)
410  clientp->mUploadProgressCallback(ulnow, ultotal);
411 
412  return CURLE_OK;
413 }
414 
415 }
416 }
size
size_t size
Definition: ffmpeg-2.3.6-single-header.h:412
audacity::network_manager::CurlHandleManager::Handle::appendCookies
CURLcode appendCookies(const CookiesList &cookie) noexcept
Definition: CurlHandleManager.cpp:148
audacity::network_manager::CurlResponse::mCallbackMutex
std::mutex mCallbackMutex
Definition: CurlResponse.h:76
audacity::network_manager::Request::getTimeout
Timeout getTimeout() const noexcept
Definition: Request.cpp:98
audacity::network_manager::CurlResponse::readData
uint64_t readData(void *buffer, uint64_t maxBytesCount) override
Definition: CurlResponse.cpp:224
audacity::network_manager::CurlResponse::getBytesAvailable
uint64_t getBytesAvailable() const noexcept override
Definition: CurlResponse.cpp:218
audacity::network_manager::anonymous_namespace{CurlResponse.cpp}::DataStream::Buffer
const char * Buffer
Definition: CurlResponse.cpp:63
audacity::network_manager::CurlResponse::WriteCallback
static size_t WriteCallback(const uint8_t *ptr, size_t size, size_t nmemb, CurlResponse *userdata) noexcept
Definition: CurlResponse.cpp:326
audacity::network_manager::RequestVerb::Post
@ Post
CurlResponse.h
Declare an implementation of IResponse using libcurl.
audacity::network_manager::NetworkError::HTTPError
@ HTTPError
audacity::network_manager::CurlHandleManager::Handle
Definition: CurlHandleManager.h:35
audacity::network_manager::CurlResponse::getHeader
std::string getHeader(const std::string &headerName) const override
Definition: CurlResponse.cpp:150
audacity::network_manager::CurlResponse::CurlProgressCallback
static int CurlProgressCallback(CurlResponse *clientp, curl_off_t dltotal, curl_off_t dlnow, curl_off_t ultotal, curl_off_t ulnow) noexcept
Definition: CurlResponse.cpp:400
audacity::network_manager::CurlResponse::mHeadersReceived
bool mHeadersReceived
Definition: CurlResponse.h:96
audacity::network_manager::CurlResponse::getCookies
const CookiesList & getCookies() const noexcept override
Definition: CurlResponse.cpp:162
audacity::network_manager::NetworkError::BadURL
@ BadURL
audacity::network_manager::CurlResponse::mHeadersMutex
std::mutex mHeadersMutex
Definition: CurlResponse.h:82
audacity::network_manager::NetworkError::Timeout
@ Timeout
audacity::network_manager::CurlHandleManager::Handle::getHTTPCode
unsigned getHTTPCode() const noexcept
Definition: CurlHandleManager.cpp:205
audacity::network_manager::anonymous_namespace{CurlResponse.cpp}::DataStreamRead
size_t DataStreamRead(char *ptr, size_t size, size_t nmemb, DataStream *stream) noexcept
Definition: CurlResponse.cpp:69
audacity::network_manager::NetworkError::SSLHandshakeFailed
@ SSLHandshakeFailed
audacity::network_manager::CurlResponse::mVerb
RequestVerb mVerb
Definition: CurlResponse.h:69
audacity
Definition: ErrorReportDialog.h:22
audacity::network_manager::Request
Definition: Request.h:28
audacity::network_manager::anonymous_namespace{CurlResponse.cpp}::DataStreamSeek
int DataStreamSeek(DataStream *stream, curl_off_t offs, int origin) noexcept
Definition: CurlResponse.cpp:83
audacity::network_manager::CurlResponse::headersReceived
bool headersReceived() const noexcept override
Definition: CurlResponse.cpp:138
audacity::network_manager::CurlResponse::isFinished
bool isFinished() const noexcept override
Definition: CurlResponse.cpp:114
audacity::network_manager::CurlResponse::mDataBuffer
std::deque< uint8_t > mDataBuffer
Definition: CurlResponse.h:87
audacity::network_manager::NetworkError::RemoteHostClosed
@ RemoteHostClosed
audacity::network_manager::CurlHandleManager::Handle::appendHeaders
void appendHeaders(const HeadersList &headers)
Definition: CurlHandleManager.cpp:169
audacity::network_manager::CurlResponse::mRequestFinishedCallback
RequestCallback mRequestFinishedCallback
Definition: CurlResponse.h:78
audacity::network_manager::Request::getMaxRedirects
size_t getMaxRedirects() const noexcept
Definition: Request.cpp:87
audacity::network_manager::Header
Definition: HeadersList.h:24
audacity::network_manager::NetworkError::ConnectionRefused
@ ConnectionRefused
audacity::network_manager::CurlResponse::mResponseHeaders
HeadersList mResponseHeaders
Definition: CurlResponse.h:83
audacity::network_manager::CookiesList
Definition: CookiesList.h:42
audacity::network_manager::HeadersList
Definition: HeadersList.h:35
audacity::network_manager::Header::Value
std::string Value
Definition: HeadersList.h:26
audacity::network_manager::CurlResponse::HeaderCallback
static size_t HeaderCallback(const char *buffer, size_t size, size_t nitems, CurlResponse *userdata) noexcept
Definition: CurlResponse.cpp:361
audacity::network_manager::CurlResponse::mHttpCode
unsigned mHttpCode
Definition: CurlResponse.h:94
audacity::network_manager::CurlResponse::mCurrentHandle
CurlHandleManager::Handle * mCurrentHandle
Definition: CurlResponse.h:74
audacity::network_manager::CurlResponse::setUploadProgressCallback
virtual void setUploadProgressCallback(ProgressCallback callback) override
Set the upload progress callback.
Definition: CurlResponse.cpp:212
audacity::network_manager::Request::getCookies
const CookiesList & getCookies() noexcept
Definition: Request.cpp:75
audacity::network_manager::CurlResponse::mNetworkError
NetworkError mNetworkError
Definition: CurlResponse.h:91
audacity::network_manager::CurlResponse::setRequestFinishedCallback
void setRequestFinishedCallback(RequestCallback callback) override
Definition: CurlResponse.cpp:194
audacity::network_manager::HeadersList::getHeaderValue
std::string getHeaderValue(const std::string &headerName) const
Definition: HeadersList.cpp:93
audacity::network_manager::Request::getURL
const std::string & getURL() const noexcept
Definition: Request.cpp:41
audacity::network_manager::CurlResponse::CurlResponse
CurlResponse(RequestVerb verb, const Request &request, CurlHandleManager *handleManager) noexcept
Definition: CurlResponse.cpp:107
audacity::network_manager::anonymous_namespace{CurlResponse.cpp}::DataStream
Definition: CurlResponse.cpp:62
audacity::network_manager::CurlResponse::mRequest
Request mRequest
Definition: CurlResponse.h:71
nmemb
size_t nmemb
Definition: ffmpeg-2.3.6-single-header.h:424
audacity::network_manager::CurlResponse::mResponseCookies
CookiesList mResponseCookies
Definition: CurlResponse.h:84
audacity::network_manager::CurlHandleManager::Handle::setOption
CURLcode setOption(CURLoption option, Args... value) noexcept
Definition: CurlHandleManager.h:45
audacity::network_manager::CurlResponse::setOnDataReceivedCallback
void setOnDataReceivedCallback(RequestCallback callback) override
Definition: CurlResponse.cpp:184
audacity::network_manager::CurlResponse::mRequestFinished
bool mRequestFinished
Definition: CurlResponse.h:97
audacity::network_manager::NetworkError
NetworkError
Definition: IResponse.h:30
audacity::network_manager::CurlResponse::getHTTPCode
unsigned getHTTPCode() const noexcept override
Definition: CurlResponse.cpp:120
audacity::network_manager::NetworkError::NoError
@ NoError
audacity::network_manager::NetworkError::ProxyNotFound
@ ProxyNotFound
audacity::network_manager::CurlResponse::getHeaders
const HeadersList & getHeaders() const noexcept override
Definition: CurlResponse.cpp:156
min
int min(int a, int b)
Definition: CompareAudioCommand.cpp:106
audacity::network_manager::NetworkError::OperationCancelled
@ OperationCancelled
audacity::network_manager::CurlResponse::mErrorString
std::string mErrorString
Definition: CurlResponse.h:92
audacity::network_manager::RequestVerb
RequestVerb
Definition: IResponseFactory.h:27
audacity::network_manager::CurlResponse::getRequest
const Request & getRequest() const noexcept override
Definition: CurlResponse.cpp:168
audacity::network_manager::NetworkError::UnknownError
@ UnknownError
audacity::network_manager::CurlHandleManager::Handle::perform
Result perform()
Definition: CurlHandleManager.cpp:175
audacity::network_manager::CurlResponse
Definition: CurlResponse.h:31
audacity::network_manager::CurlResponse::setDownloadProgressCallback
virtual void setDownloadProgressCallback(ProgressCallback callback) override
Set the download progress callback.
Definition: CurlResponse.cpp:206
audacity::network_manager::CurlHandleManager::Handle::appendHeader
void appendHeader(const Header &header)
Definition: CurlHandleManager.cpp:161
audacity::network_manager::CurlResponse::getError
NetworkError getError() const noexcept override
Definition: CurlResponse.cpp:126
audacity::network_manager::CurlResponse::perform
void perform(const void *ptr, size_t size)
Definition: CurlResponse.cpp:246
audacity::network_manager::CurlResponse::mOnDataReceivedCallback
RequestCallback mOnDataReceivedCallback
Definition: CurlResponse.h:77
audacity::network_manager::CurlResponse::mAbortRequested
bool mAbortRequested
Definition: CurlResponse.h:98
audacity::network_manager::anonymous_namespace{CurlResponse.cpp}::DataStream::Size
size_t Size
Definition: CurlResponse.cpp:64
audacity::network_manager::CurlResponse::getErrorString
std::string getErrorString() const override
Definition: CurlResponse.cpp:132
audacity::network_manager::CurlResponse::mHandleManager
CurlHandleManager * mHandleManager
Definition: CurlResponse.h:72
audacity::network_manager::IResponse::ProgressCallback
std::function< void(int64_t current, int64_t expected)> ProgressCallback
Definition: IResponse.h:55
audacity::network_manager::CurlResponse::hasHeader
bool hasHeader(const std::string &headerName) const noexcept override
Definition: CurlResponse.cpp:144
audacity::network_manager::CurlResponse::mDownloadProgressCallback
ProgressCallback mDownloadProgressCallback
Definition: CurlResponse.h:79
audacity::network_manager::CurlResponse::mUploadProgressCallback
ProgressCallback mUploadProgressCallback
Definition: CurlResponse.h:80
audacity::network_manager::CurlHandleManager
Definition: CurlHandleManager.h:32
audacity::network_manager::CurlResponse::mStatusMutex
std::mutex mStatusMutex
Definition: CurlResponse.h:89
audacity::network_manager::Request::getHeaders
const HeadersList & getHeaders() const noexcept
Definition: Request.cpp:58
audacity::network_manager::CurlResponse::abort
void abort() noexcept override
Definition: CurlResponse.cpp:178
audacity::network_manager::Header::Parse
static Header Parse(const std::string &header)
Definition: HeadersList.cpp:50
audacity::network_manager::Header::hasSameName
bool hasSameName(const Header &header) const
Definition: HeadersList.cpp:35
audacity::network_manager::NetworkError::HostNotFound
@ HostNotFound
audacity::network_manager::NetworkError::ConnectionFailed
@ ConnectionFailed
audacity::network_manager::CurlResponse::getURL
std::string getURL() const override
Definition: CurlResponse.cpp:173
audacity::network_manager::CurlResponse::mDataBufferMutex
std::mutex mDataBufferMutex
Definition: CurlResponse.h:86
audacity::network_manager::CurlHandleManager::getHandle
Handle getHandle(RequestVerb verb, const std::string &url)
Definition: CurlHandleManager.cpp:254
audacity::network_manager::anonymous_namespace{CurlResponse.cpp}::errorsMap
static const std::map< CURLcode, NetworkError > errorsMap
Definition: CurlResponse.cpp:24