uvco 0.1
|
#include <curl.h>
Public Member Functions | |
Curl (const Loop &loop) | |
Curl (const Curl &)=delete | |
Curl (Curl &&other)=delete | |
Curl & | operator= (const Curl &)=delete |
Curl & | operator= (Curl &&other)=delete |
~Curl () | |
CurlRequest | get (std::string url) |
CurlRequest | post (std::string url, std::span< const std::pair< std::string, std::string > > fields) |
Promise< void > | close () |
Close the curl handle in order to free all associated resources. | |
Private Attributes | |
std::shared_ptr< UvCurlContext_ > | context_ |
A simple Curl client that can download files from the internet. Errors are currently handled for HTTP; other protocols have status codes that this class doesn't yet know about.
The download()
method is a generator yielding received chunks of the remote resource. Make sure to always co_await
the download generator until receiving a std::nullopt
, and call close()
after you're done with the Curl handle.
Downloads can be started and progressing concurrently.
|
delete |
|
default |
Close the curl handle in order to free all associated resources.
CurlRequest uvco::Curl::get | ( | std::string | url | ) |
Prepare a GET request.
Important: don't drop the returned object until the request has finished.
|
delete |
|
delete |
CurlRequest uvco::Curl::post | ( | std::string | url, |
std::span< const std::pair< std::string, std::string > > | fields | ||
) |
Prepare a POST request.
Important: don't drop the returned object until the request has finished.
|
private |