1 #ifndef __GPUDB__HTTP_HPP__
2 #define __GPUDB__HTTP_HPP__
5 #include <boost/asio/ssl.hpp>
17 static const std::string
HTTP;
22 HttpUrl(
const std::string& url);
23 HttpUrl(
const std::string& protocol,
24 const std::string& host,
26 const std::string& path,
27 const std::string& query = std::string());
29 const std::string& path,
30 const std::string& query = std::string());
32 const std::string&
getUrl()
const;
35 const std::string&
getHost()
const;
37 const std::string&
getPath()
const;
46 operator std::string()
const;
59 void init(
const std::string& url);
75 static const std::string
GET;
76 static const std::string
HEAD;
77 static const std::string
POST;
82 #ifndef GPUDB_NO_HTTPS
92 #ifndef GPUDB_NO_HTTPS
104 virtual void read(
const void*& data,
size_t& length)
const;
110 #ifndef GPUDB_NO_HTTPS
111 boost::asio::ssl::context* m_sslContext;
115 std::string m_requestMethod;
116 std::map<std::string, std::string> m_requestHeaders;
131 virtual void read(
const void*& data,
size_t& length)
const;
134 const std::vector<uint8_t>* m_requestBody;
148 virtual void read(
const void*& data,
size_t& length)
const;
151 const std::string* m_requestBody;
167 virtual void write(
const void* data,
const size_t length);
173 std::string m_responseVersion;
174 unsigned int m_responseCode;
175 std::string m_responseMessage;
176 std::map<std::string, std::string> m_responseHeaders;
185 virtual void write(
const void* data,
const size_t length);
188 std::vector<uint8_t> m_responseBody;
197 virtual void write(
const void* data,
const size_t length);
200 std::string m_responseBody;
const std::string & getPath() const
const std::map< std::string, std::string > & getResponseHeaders() const
const std::vector< uint8_t > * getRequestBody()
const std::string & getProtocol() const
virtual void write(const void *data, const size_t length)
friend bool operator==(const HttpUrl &lhs, const HttpUrl &rhs)
std::map< std::string, std::string > & getRequestHeaders()
void setRequestBody(const std::string *requestBody)
const std::string & getResponseHeader(const std::string &key) const
const std::string & getResponseMessage() const
boost::asio::ssl::context * getSslContext()
virtual void read(const void *&data, size_t &length) const
virtual void read(const void *&data, size_t &length) const
void setRequestMethod(const std::string &method)
std::string getAppendedUrl(const std::string &endpoint) const
Returns a string with the passed in endpoint appended to this URL.
static const std::string POST
unsigned int getResponseCode() const
virtual void write(const void *data, const size_t length)
const std::string & getUrl() const
const std::vector< uint8_t > & getResponseBody() const
void setRequestBody(const std::vector< uint8_t > *requestBody)
const std::string & getRequestMethod() const
std::ostream & operator<<(std::ostream &stream, const HttpUrl &value)
void setTimeout(const size_t timeout)
void send(HttpResponse &response)
void setUrl(const HttpUrl &url)
friend bool operator!=(const HttpUrl &lhs, const HttpUrl &rhs)
static const std::string HTTPS
static const std::string GET
size_t getTimeout() const
const std::string & getResponseBody() const
static const std::string HTTP
const std::string * getRequestBody()
virtual void write(const void *data, const size_t length)
void setSslContext(boost::asio::ssl::context *sslContext)
void addRequestHeader(const std::string &key, const std::string &value)
const std::string & getHost() const
const std::string & getQuery() const
const std::string & getRequestHeader(const std::string &key) const
const std::string & getResponseVersion() const
static const std::string HEAD
const HttpUrl & getUrl() const
virtual void read(const void *&data, size_t &length) const