libtasks Documentation
1.6
|
The HTTP request implementation. More...
#include <http_request.h>
Public Member Functions | |
http_request (std::string host, std::string url="", int port=80) | |
void | set_host (std::string host) |
Set the host. More... | |
void | set_url (std::string url) |
Set the URL. More... | |
void | set_port (int port) |
Set the port. More... | |
const std::string & | host () const |
const std::string & | url () const |
int | port () const |
void | prepare_data_buffer () |
Prepare a HTTP request/response to be sent. More... | |
void | clear () |
Reset the http object. More... | |
![]() | |
http_base () | |
virtual | ~http_base () |
void | set_state (io_state state) |
io_state | state () const |
void | set_header (std::string header, std::string value) |
const std::string & | header (std::string name) const |
std::size_t | content_length () const |
const char * | content_p () const |
std::size_t | write (std::string s) |
std::size_t | write (const std::string &s) |
std::size_t | write (const char *data, std::size_t size) |
std::size_t | read (char *data, std::size_t size) |
std::istream & | content_istream () |
std::ostream & | content_ostream () |
void | write_data (socket &sock) |
Write a HTTP object to a socket. More... | |
void | print () const |
bool | done () const |
Private Member Functions | |
void | init_default_headers () |
Private Attributes | |
std::string | m_host |
std::string | m_url |
int | m_port |
Additional Inherited Members | |
![]() | |
static const std::string | NO_VAL |
![]() | |
void | write_headers (socket &sock) |
void | write_content (socket &sock) |
![]() | |
tasks::tools::buffer | m_data_buffer |
tasks::tools::buffer | m_content_buffer |
io_state | m_state = io_state::READY |
std::unordered_map < std::string, std::string > | m_headers |
std::size_t | m_content_length = 0 |
std::istream | m_content_istream |
std::ostream | m_content_ostream |
The HTTP request implementation.
Definition at line 17 of file http_request.h.
|
inline |
Constructor
host | The host |
url | The URL |
port | The port |
Definition at line 24 of file http_request.h.
|
inlinevirtual |
Reset the http object.
Reimplemented from tasks::net::http_base.
Definition at line 51 of file http_request.h.
|
inline |
Definition at line 39 of file http_request.h.
|
private |
|
inline |
Definition at line 45 of file http_request.h.
|
virtual |
Prepare a HTTP request/response to be sent.
Implements tasks::net::http_base.
Definition at line 15 of file http_request.cpp.
|
inline |
Set the host.
Definition at line 30 of file http_request.h.
|
inline |
Set the port.
Definition at line 36 of file http_request.h.
|
inline |
Set the URL.
Definition at line 33 of file http_request.h.
|
inline |
Definition at line 42 of file http_request.h.
|
private |
Definition at line 58 of file http_request.h.
|
private |
Definition at line 60 of file http_request.h.
|
private |
Definition at line 59 of file http_request.h.