Crow  1.0
A C++ microframework for the web
crow::HTTPParser< Handler > Struct Template Reference

A wrapper for nodejs/http-parser. More...

Inheritance diagram for crow::HTTPParser< Handler >:
Collaboration diagram for crow::HTTPParser< Handler >:

Public Member Functions

 HTTPParser (Handler *handler)
 
bool feed (const char *buffer, int length)
 Parse a buffer into the different sections of an HTTP request. More...
 
bool done ()
 
void clear ()
 
void process_header ()
 
void process_message ()
 
void set_connection_parameters ()
 
request to_request () const
 Take the parsed HTTP request data and convert it to a crow::request. More...
 

Static Public Member Functions

static int on_message_begin (http_parser *self_)
 
static int on_url (http_parser *self_, const char *at, size_t length)
 
static int on_header_field (http_parser *self_, const char *at, size_t length)
 
static int on_header_value (http_parser *self_, const char *at, size_t length)
 
static int on_headers_complete (http_parser *self_)
 
static int on_body (http_parser *self_, const char *at, size_t length)
 
static int on_message_complete (http_parser *self_)
 

Public Attributes

std::string raw_url
 
std::string url
 
int header_building_state = 0
 
std::string header_field
 
std::string header_value
 
ci_map headers
 
query_string url_params
 What comes after the ? in the URL. More...
 
std::string body
 
bool keep_alive
 Whether or not the server should send a connection: Keep-Alive header to the client. More...
 
bool close_connection
 Whether or not the server should shut down the TCP connection once a response is sent. More...
 
Handler * handler_
 This is currently an HTTP connection object (crow::Connection). More...
 

Detailed Description

template<typename Handler>
struct crow::HTTPParser< Handler >

A wrapper for nodejs/http-parser.

Used to generate a crow::request from the TCP socket buffer.

Constructor & Destructor Documentation

◆ HTTPParser()

template<typename Handler >
crow::HTTPParser< Handler >::HTTPParser ( Handler *  handler)
inline

Member Function Documentation

◆ on_message_begin()

template<typename Handler >
static int crow::HTTPParser< Handler >::on_message_begin ( http_parser *  self_)
inlinestatic
Here is the caller graph for this function:

◆ on_url()

template<typename Handler >
static int crow::HTTPParser< Handler >::on_url ( http_parser *  self_,
const char *  at,
size_t  length 
)
inlinestatic
Here is the caller graph for this function:

◆ on_header_field()

template<typename Handler >
static int crow::HTTPParser< Handler >::on_header_field ( http_parser *  self_,
const char *  at,
size_t  length 
)
inlinestatic
Here is the caller graph for this function:

◆ on_header_value()

template<typename Handler >
static int crow::HTTPParser< Handler >::on_header_value ( http_parser *  self_,
const char *  at,
size_t  length 
)
inlinestatic
Here is the caller graph for this function:

◆ on_headers_complete()

template<typename Handler >
static int crow::HTTPParser< Handler >::on_headers_complete ( http_parser *  self_)
inlinestatic
Here is the caller graph for this function:

◆ on_body()

template<typename Handler >
static int crow::HTTPParser< Handler >::on_body ( http_parser *  self_,
const char *  at,
size_t  length 
)
inlinestatic
Here is the caller graph for this function:

◆ on_message_complete()

template<typename Handler >
static int crow::HTTPParser< Handler >::on_message_complete ( http_parser *  self_)
inlinestatic
Here is the caller graph for this function:

◆ feed()

template<typename Handler >
bool crow::HTTPParser< Handler >::feed ( const char *  buffer,
int  length 
)
inline

Parse a buffer into the different sections of an HTTP request.

Here is the caller graph for this function:

◆ done()

template<typename Handler >
bool crow::HTTPParser< Handler >::done ( )
inline

◆ clear()

template<typename Handler >
void crow::HTTPParser< Handler >::clear ( )
inline
Here is the caller graph for this function:

◆ process_header()

template<typename Handler >
void crow::HTTPParser< Handler >::process_header ( )
inline

◆ process_message()

template<typename Handler >
void crow::HTTPParser< Handler >::process_message ( )
inline

◆ set_connection_parameters()

template<typename Handler >
void crow::HTTPParser< Handler >::set_connection_parameters ( )
inline

◆ to_request()

template<typename Handler >
request crow::HTTPParser< Handler >::to_request ( ) const
inline

Take the parsed HTTP request data and convert it to a crow::request.

Member Data Documentation

◆ raw_url

template<typename Handler >
std::string crow::HTTPParser< Handler >::raw_url

◆ url

template<typename Handler >
std::string crow::HTTPParser< Handler >::url

◆ header_building_state

template<typename Handler >
int crow::HTTPParser< Handler >::header_building_state = 0

◆ header_field

template<typename Handler >
std::string crow::HTTPParser< Handler >::header_field

◆ header_value

template<typename Handler >
std::string crow::HTTPParser< Handler >::header_value

◆ headers

template<typename Handler >
ci_map crow::HTTPParser< Handler >::headers

◆ url_params

template<typename Handler >
query_string crow::HTTPParser< Handler >::url_params

What comes after the ? in the URL.

◆ body

template<typename Handler >
std::string crow::HTTPParser< Handler >::body

◆ keep_alive

template<typename Handler >
bool crow::HTTPParser< Handler >::keep_alive

Whether or not the server should send a connection: Keep-Alive header to the client.

◆ close_connection

template<typename Handler >
bool crow::HTTPParser< Handler >::close_connection

Whether or not the server should shut down the TCP connection once a response is sent.

◆ handler_

template<typename Handler >
Handler* crow::HTTPParser< Handler >::handler_

This is currently an HTTP connection object (crow::Connection).


The documentation for this struct was generated from the following file: