The main HTTP client connection. More...
#include <HttpClient.h>
Public Member Functions | |
HttpClient (const HttpClient &client) | |
Create a new HttpClient. | |
HttpClient (const std::string &host="localhost", const uint16_t port=80) | |
Create a new HttpClient. | |
virtual | ~HttpClient () |
Cleans up a HttpClient. | |
Static Public Attributes | |
static const unsigned int | DEFAULT_PORT = 80 |
Protected Member Functions | |
std::string | get (const std::string &url) const |
Execute a HTTP GET request to the server. | |
Private Member Functions | |
void | init () |
Initialize the cURL client. | |
Private Attributes | |
std::string | base_ |
CURL * | curl_ |
The main HTTP client connection.
The worldlib SQL HTTP can make HTTP get requests to remote web servers.
Definition at line 35 of file HttpClient.h.
HttpClient::HttpClient | ( | const HttpClient & | client | ) |
Create a new HttpClient.
Creates a new HttpClient by copying the values from the given HttpClient.
client | The HttpClient to copy. |
Definition at line 20 of file HttpClient.cpp.
rail::spatial_temporal_learning::worldlib::remote::HttpClient::HttpClient | ( | const std::string & | host = "localhost" , |
const uint16_t | port = 80 |
||
) |
Create a new HttpClient.
Creates a new HttpClient with the given connection information.
host | The host of the server (without a protocol specification; defaults to localhost). |
port | The host port of the server (defaults to port 80). |
HttpClient::~HttpClient | ( | ) | [virtual] |
Cleans up a HttpClient.
Cleans up any connections used by the HttpClient.
Definition at line 32 of file HttpClient.cpp.
string HttpClient::get | ( | const std::string & | url | ) | const [protected] |
Execute a HTTP GET request to the server.
Attempt to make an HTTP GET request to the server. The request is made to http://<host>:<port>/<url>. If the request fails, an empty string is returned.
url | The URL (minus the host information) to make the request to. |
Definition at line 57 of file HttpClient.cpp.
void HttpClient::init | ( | ) | [private] |
Initialize the cURL client.
Initialize the cURL client paramters.
Definition at line 41 of file HttpClient.cpp.
std::string rail::spatial_temporal_learning::worldlib::remote::HttpClient::base_ [private] |
The base URL.
Definition at line 83 of file HttpClient.h.
The main HTTP connection.
Definition at line 81 of file HttpClient.h.
const unsigned int rail::spatial_temporal_learning::worldlib::remote::HttpClient::DEFAULT_PORT = 80 [static] |
The default HTTP port.
Reimplemented from rail::spatial_temporal_learning::worldlib::remote::Client.
Definition at line 39 of file HttpClient.h.