Convenience class for talking basic HTTP, implemented using CURL.
More...
#include <ipfs/http/transport-curl.h>
|
| TransportCurl (bool curlVerbose) |
| Constructor.
|
|
| TransportCurl (const TransportCurl &other) |
| Copy Constructor.
|
|
| TransportCurl (TransportCurl &&other) noexcept |
| Move-constructor.
|
|
TransportCurl & | operator= (const TransportCurl &) |
| Copy assignment operator.
|
|
TransportCurl & | operator= (TransportCurl &&) noexcept |
| Move assignment operator.
|
|
std::unique_ptr< Transport > | Clone () const override |
| Return a deep copy of this object.
|
|
| ~TransportCurl () |
| Destructor.
|
|
void | Fetch (const std::string &url, const std::vector< FileUpload > &files, std::iostream *response) override |
| Fetch the contents of a given URL.
|
|
void | StopFetch () override |
| Stop the fetch method abruptly, useful whenever the Fetch method is used within a thead, but you want to stop the thread (without using pthread_cancel).
|
|
void | ResetFetch () override |
| Reset the internal state, after StopFetch() is called.
|
|
void | UrlEncode (const std::string &raw, std::string *encoded) override |
| URL encode a string.
|
|
void | Test () |
| Test the internals that are hard to execute from the public API, like error handling of some exceptional cases.
|
|
virtual std::unique_ptr< Transport > | Clone () const =0 |
| Return a deep copy of this object.
|
|
virtual | ~Transport () |
| Destructor.
|
|
virtual void | Fetch (const std::string &url, const std::vector< FileUpload > &files, std::iostream *response)=0 |
| Fetch the contents of a given URL.
|
|
virtual void | StopFetch ()=0 |
| Stop the Fetch method abruptly.
|
|
virtual void | ResetFetch ()=0 |
| Reset the internal state, after StopFetch() is called.
|
|
virtual void | UrlEncode (const std::string &raw, std::string *encoded)=0 |
| URL encode a string.
|
|
Convenience class for talking basic HTTP, implemented using CURL.
◆ TransportCurl() [1/3]
ipfs::http::TransportCurl::TransportCurl |
( |
bool |
curlVerbose | ) |
|
Constructor.
- Parameters
-
[in] | curlVerbose | Enable cURL verbose mode, useful for debugging. |
◆ TransportCurl() [2/3]
ipfs::http::TransportCurl::TransportCurl |
( |
const TransportCurl & |
other | ) |
|
Copy Constructor.
- Parameters
-
◆ TransportCurl() [3/3]
ipfs::http::TransportCurl::TransportCurl |
( |
TransportCurl && |
other | ) |
|
|
noexcept |
Move-constructor.
- Parameters
-
◆ Clone()
std::unique_ptr< Transport > ipfs::http::TransportCurl::Clone |
( |
| ) |
const |
|
overridevirtual |
◆ Fetch()
void ipfs::http::TransportCurl::Fetch |
( |
const std::string & |
url, |
|
|
const std::vector< FileUpload > & |
files, |
|
|
std::iostream * |
response |
|
) |
| |
|
overridevirtual |
Fetch the contents of a given URL.
If any files are provided in files
, they are submitted using "Content-Type: multipart/form-data".
Fetch method is thread-safe. Therefor, can be used within a thread.
- Exceptions
-
std::exception | if any error occurs including erroneous HTTP status code |
- Parameters
-
[in] | url | URL to get. |
[in] | files | List of files to upload. |
[out] | response | Output to save the response body to. |
Implements ipfs::http::Transport.
◆ operator=() [1/2]
Copy assignment operator.
- Returns
- *this
- Parameters
-
◆ operator=() [2/2]
Move assignment operator.
- Returns
- *this
- Parameters
-
◆ ResetFetch()
void ipfs::http::TransportCurl::ResetFetch |
( |
| ) |
|
|
overridevirtual |
Reset the internal state, after StopFetch() is called.
This method needs to be called once the thread is fully finished. Ideally after client.abort() and thread.join() methods.
Call this method out-side of the running thread, eg. the main thread.
Implements ipfs::http::Transport.
◆ StopFetch()
void ipfs::http::TransportCurl::StopFetch |
( |
| ) |
|
|
overridevirtual |
Stop the fetch method abruptly, useful whenever the Fetch method is used within a thead, but you want to stop the thread (without using pthread_cancel).
Call this method out-side of the running thread, eg. the main thread.
Implements ipfs::http::Transport.
◆ UrlEncode()
void ipfs::http::TransportCurl::UrlEncode |
( |
const std::string & |
raw, |
|
|
std::string * |
encoded |
|
) |
| |
|
overridevirtual |
URL encode a string.
URLEcode method is thread-safe.
- Parameters
-
[in] | raw | Input string to encode. |
[out] | encoded | URL encoded result. |
Implements ipfs::http::Transport.
The documentation for this class was generated from the following files:
- /media/melroy/Data/Projects/cpp-ipfs-http-client/include/ipfs/http/transport-curl.h
- /media/melroy/Data/Projects/cpp-ipfs-http-client/src/http/transport-curl.cc