libtasks Documentation  1.6
tasks::net::http_response Class Reference

The HTTP response implementation. More...

#include <http_response.h>

Inheritance diagram for tasks::net::http_response:
Collaboration diagram for tasks::net::http_response:

Public Member Functions

 http_response ()
 
void set_status (std::string status)
 
const std::string & status () const
 
int status_code () const
 
void prepare_data_buffer ()
 Prepare a HTTP request/response to be sent. More...
 
void read_data (net::socket &sock)
 Read an HTTP response from a socket. More...
 
void clear ()
 Reset the http object. More...
 
- Public Member Functions inherited from tasks::net::http_base
 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 parse_data ()
 
void parse_line ()
 
void parse_status ()
 
void parse_header ()
 

Private Attributes

std::string m_status
 
int m_status_code
 
int m_line_number = 0
 
std::size_t m_last_line_start = 0
 
std::size_t m_content_start = 0
 
bool m_content_length_exists = false
 
bool m_chunked_enc = false
 

Additional Inherited Members

- Static Public Attributes inherited from tasks::net::http_base
static const std::string NO_VAL
 
- Protected Member Functions inherited from tasks::net::http_base
void write_headers (socket &sock)
 
void write_content (socket &sock)
 
- Protected Attributes inherited from tasks::net::http_base
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
 

Detailed Description

The HTTP response implementation.

Definition at line 19 of file http_response.h.

Constructor & Destructor Documentation

tasks::net::http_response::http_response ( )
inline

Definition at line 21 of file http_response.h.

Member Function Documentation

void tasks::net::http_response::clear ( )
inlinevirtual

Reset the http object.

Reimplemented from tasks::net::http_base.

Definition at line 41 of file http_response.h.

Here is the call graph for this function:

Here is the caller graph for this function:

void tasks::net::http_response::parse_data ( )
private

Definition at line 73 of file http_response.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

void tasks::net::http_response::parse_header ( )
private

Definition at line 129 of file http_response.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

void tasks::net::http_response::parse_line ( )
private

Definition at line 107 of file http_response.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

void tasks::net::http_response::parse_status ( )
private

Definition at line 116 of file http_response.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

void tasks::net::http_response::prepare_data_buffer ( )
virtual

Prepare a HTTP request/response to be sent.

Implements tasks::net::http_base.

Definition at line 21 of file http_response.cpp.

Here is the call graph for this function:

void tasks::net::http_response::read_data ( net::socket sock)

Read an HTTP response from a socket.

Definition at line 40 of file http_response.cpp.

Here is the call graph for this function:

void tasks::net::http_response::set_status ( std::string  status)
inline

Definition at line 23 of file http_response.h.

Here is the call graph for this function:

Here is the caller graph for this function:

const std::string& tasks::net::http_response::status ( ) const
inline
Returns
The HTTP status string.

Definition at line 29 of file http_response.h.

Here is the caller graph for this function:

int tasks::net::http_response::status_code ( ) const
inline
Returns
The HTTP status code.

Definition at line 32 of file http_response.h.

Member Data Documentation

bool tasks::net::http_response::m_chunked_enc = false
private

Definition at line 58 of file http_response.h.

bool tasks::net::http_response::m_content_length_exists = false
private

Definition at line 57 of file http_response.h.

std::size_t tasks::net::http_response::m_content_start = 0
private

Definition at line 56 of file http_response.h.

std::size_t tasks::net::http_response::m_last_line_start = 0
private

Definition at line 55 of file http_response.h.

int tasks::net::http_response::m_line_number = 0
private

Definition at line 54 of file http_response.h.

std::string tasks::net::http_response::m_status
private

Definition at line 52 of file http_response.h.

int tasks::net::http_response::m_status_code
private

Definition at line 53 of file http_response.h.


The documentation for this class was generated from the following files: