Class CurlContext

Class Documentation

class CurlContext

Basic context wrapper for curl.

Wraps the init/fini functions. Takes care of setting the common options.

Public Functions

explicit CurlContext(const struct ConnectionInfo &connection_info, const struct ProtocolInfo &protocol_info, const bool curl_verbose)

Constructor.

Parameters:
  • connection_info – the connection information

  • protocol_info – the protocol information

  • curl_verbose – the curl verbose status

~CurlContext()
bool init()

Initialize context.

Returns:

true if successful, false otherwise

void fini()

Finalize context.

bool execute()

Execute command.

The right command/params must have been set using the handle beforehand.

Returns:

true if successful, false otherwise

CURL *get_handle() const

Get the curl handle.

To be used for setting params before executing a command.

Returns:

the curl handle

const std::string &get_full_url() const

Get the full URL.

Returns:

the full URL

const struct ConnectionInfo &get_connection_info() const

Get the connection info.

Returns:

the connection info