Public Member Functions | Private Types | Private Member Functions | Static Private Member Functions | Private Attributes | List of all members
async_web_server_cpp::HttpRequestParser Class Reference

#include <http_request_parser.hpp>

Public Member Functions

 HttpRequestParser ()
 Construct ready to parse the request method. More...
 
template<typename InputIterator >
boost::tuple< boost::tribool, InputIterator > parse (HttpRequest &req, InputIterator begin, InputIterator end)
 
void reset ()
 Reset to initial parser state. More...
 

Private Types

enum  state {
  method_start, method, uri, http_version_h,
  http_version_t_1, http_version_t_2, http_version_p, http_version_slash,
  http_version_major_start, http_version_major, http_version_minor_start, http_version_minor,
  expecting_newline_1, header_line_start, header_lws, header_name,
  space_before_header_value, header_value, expecting_newline_2, expecting_newline_3
}
 The current state of the parser. More...
 

Private Member Functions

boost::tribool consume (HttpRequest &req, char input)
 Handle the next character of input. More...
 

Static Private Member Functions

static bool is_char (int c)
 Check if a byte is an HTTP character. More...
 
static bool is_ctl (int c)
 Check if a byte is an HTTP control character. More...
 
static bool is_digit (int c)
 Check if a byte is a digit. More...
 
static bool is_tspecial (int c)
 Check if a byte is defined as an HTTP tspecial character. More...
 

Private Attributes

enum async_web_server_cpp::HttpRequestParser::state state_
 

Detailed Description

Definition at line 22 of file http_request_parser.hpp.

Member Enumeration Documentation

◆ state

The current state of the parser.

Enumerator
method_start 
method 
uri 
http_version_h 
http_version_t_1 
http_version_t_2 
http_version_p 
http_version_slash 
http_version_major_start 
http_version_major 
http_version_minor_start 
http_version_minor 
expecting_newline_1 
header_line_start 
header_lws 
header_name 
space_before_header_value 
header_value 
expecting_newline_2 
expecting_newline_3 

Definition at line 66 of file http_request_parser.hpp.

Constructor & Destructor Documentation

◆ HttpRequestParser()

async_web_server_cpp::HttpRequestParser::HttpRequestParser ( )

Construct ready to parse the request method.

Definition at line 15 of file http_request_parser.cpp.

Member Function Documentation

◆ consume()

boost::tribool async_web_server_cpp::HttpRequestParser::consume ( HttpRequest req,
char  input 
)
private

Handle the next character of input.

Definition at line 22 of file http_request_parser.cpp.

◆ is_char()

bool async_web_server_cpp::HttpRequestParser::is_char ( int  c)
staticprivate

Check if a byte is an HTTP character.

Definition at line 284 of file http_request_parser.cpp.

◆ is_ctl()

bool async_web_server_cpp::HttpRequestParser::is_ctl ( int  c)
staticprivate

Check if a byte is an HTTP control character.

Definition at line 289 of file http_request_parser.cpp.

◆ is_digit()

bool async_web_server_cpp::HttpRequestParser::is_digit ( int  c)
staticprivate

Check if a byte is a digit.

Definition at line 323 of file http_request_parser.cpp.

◆ is_tspecial()

bool async_web_server_cpp::HttpRequestParser::is_tspecial ( int  c)
staticprivate

Check if a byte is defined as an HTTP tspecial character.

Definition at line 294 of file http_request_parser.cpp.

◆ parse()

template<typename InputIterator >
boost::tuple<boost::tribool, InputIterator> async_web_server_cpp::HttpRequestParser::parse ( HttpRequest req,
InputIterator  begin,
InputIterator  end 
)
inline

Parse some data. The tribool return value is true when a complete request has been parsed, false if the data is invalid, indeterminate when more data is required. The InputIterator return value indicates how much of the input has been consumed.

Definition at line 37 of file http_request_parser.hpp.

◆ reset()

void async_web_server_cpp::HttpRequestParser::reset ( )

Reset to initial parser state.

Definition at line 17 of file http_request_parser.cpp.

Member Data Documentation

◆ state_

enum async_web_server_cpp::HttpRequestParser::state async_web_server_cpp::HttpRequestParser::state_
private

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


async_web_server_cpp
Author(s): Mitchell Wills , Russel Toris
autogenerated on Tue Mar 1 2022 23:49:07