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

The uwsgi protocol implementation for a request. The response is a HTTP/1.1 response. More...

#include <uwsgi_request.h>

Collaboration diagram for tasks::net::uwsgi_request:

Public Types

using uwsgi_vars_t = std::unordered_map< std::string, std::string >
 

Public Member Functions

 uwsgi_request ()
 
const std::string & var (std::string key) const
 
const uwsgi_vars_tvars () const
 
void print_header () const
 
void print_vars () const
 
void write (const char *data, std::size_t size)
 
std::streamsize read (char *data, std::size_t size)
 
void read_data (socket &sock)
 Read request data from a socket. More...
 
bool done () const
 
uwsgi_packet_header & header ()
 
void clear ()
 Reset an object. More...
 

Static Public Attributes

static std::string NO_VAL
 

Private Member Functions

void read_header (socket &sock)
 Read the header from a socket. More...
 
void read_vars (socket &sock)
 Read the uwsgi parameters from a socket. More...
 
void read_content (socket &sock)
 Read POST data into the content buffer. More...
 
void parse_vars ()
 Parse the uswgi parameters into a hash map. More...
 

Private Attributes

uwsgi_packet_header m_header
 
tasks::tools::buffer m_data_buffer
 
tasks::tools::buffer m_content_buffer
 
io_state m_state = io_state::READY
 
uwsgi_vars_t m_vars
 

Detailed Description

The uwsgi protocol implementation for a request. The response is a HTTP/1.1 response.

Definition at line 27 of file uwsgi_request.h.

Member Typedef Documentation

using tasks::net::uwsgi_request::uwsgi_vars_t = std::unordered_map<std::string, std::string>

Definition at line 29 of file uwsgi_request.h.

Constructor & Destructor Documentation

tasks::net::uwsgi_request::uwsgi_request ( )
inline

Definition at line 33 of file uwsgi_request.h.

Member Function Documentation

void tasks::net::uwsgi_request::clear ( )
inline

Reset an object.

Definition at line 86 of file uwsgi_request.h.

Here is the call graph for this function:

Here is the caller graph for this function:

bool tasks::net::uwsgi_request::done ( ) const
inline
Returns
True if a request has been read from a socket successfully or a response has been written to a socket successfully.

Definition at line 80 of file uwsgi_request.h.

Here is the caller graph for this function:

uwsgi_packet_header& tasks::net::uwsgi_request::header ( )
inline
Returns
The uwsgi header struct.

Definition at line 83 of file uwsgi_request.h.

Here is the caller graph for this function:

void tasks::net::uwsgi_request::parse_vars ( )
private

Parse the uswgi parameters into a hash map.

Definition at line 76 of file uwsgi_request.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

void tasks::net::uwsgi_request::print_header ( ) const
inline

Definition at line 50 of file uwsgi_request.h.

void tasks::net::uwsgi_request::print_vars ( ) const
inline

Definition at line 56 of file uwsgi_request.h.

std::streamsize tasks::net::uwsgi_request::read ( char *  data,
std::size_t  size 
)
inline

Read data from the content buffer.

Parameters
dataA pointer to the destination.
sizeThe max number of bytes to copy.
Returns
The number of bytes copied.

Definition at line 73 of file uwsgi_request.h.

Here is the call graph for this function:

void tasks::net::uwsgi_request::read_content ( socket sock)
private

Read POST data into the content buffer.

Definition at line 50 of file uwsgi_request.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

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

Read request data from a socket.

Definition at line 61 of file uwsgi_request.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

void tasks::net::uwsgi_request::read_header ( socket sock)
private

Read the header from a socket.

Definition at line 20 of file uwsgi_request.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

void tasks::net::uwsgi_request::read_vars ( socket sock)
private

Read the uwsgi parameters from a socket.

Definition at line 28 of file uwsgi_request.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

const std::string& tasks::net::uwsgi_request::var ( std::string  key) const
inline

Provide access to uwsgi parameters.

Parameters
keyThe parameter name.
Returns
The parameter value.

Definition at line 39 of file uwsgi_request.h.

Here is the caller graph for this function:

const uwsgi_vars_t& tasks::net::uwsgi_request::vars ( ) const
inline
Returns
The parameter map.

Definition at line 48 of file uwsgi_request.h.

void tasks::net::uwsgi_request::write ( const char *  data,
std::size_t  size 
)
inline

Copy data into the content buffer.

Parameters
dataA pointer to the data.
sizeThe number of bytes to copy.

Definition at line 66 of file uwsgi_request.h.

Here is the call graph for this function:

Member Data Documentation

tasks::tools::buffer tasks::net::uwsgi_request::m_content_buffer
private

Definition at line 99 of file uwsgi_request.h.

tasks::tools::buffer tasks::net::uwsgi_request::m_data_buffer
private

Definition at line 98 of file uwsgi_request.h.

uwsgi_packet_header tasks::net::uwsgi_request::m_header
private

Definition at line 97 of file uwsgi_request.h.

io_state tasks::net::uwsgi_request::m_state = io_state::READY
private

Definition at line 100 of file uwsgi_request.h.

uwsgi_vars_t tasks::net::uwsgi_request::m_vars
private

Definition at line 101 of file uwsgi_request.h.

std::string tasks::net::uwsgi_request::NO_VAL
static

Definition at line 31 of file uwsgi_request.h.


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