31 #ifndef HTTP_REQUEST_PARSER_HPP 32 #define HTTP_REQUEST_PARSER_HPP 35 #include <boost/logic/tribool.hpp> 36 #include <boost/tuple/tuple.hpp> 54 template <
typename InputIterator>
55 boost::tuple<boost::tribool, InputIterator>
parse ( shared_ptr<HttpRequest> req,
56 InputIterator begin, InputIterator end ) {
57 while ( begin != end ) {
58 boost::tribool result =
consume ( req, *begin++ );
60 if ( result || !result )
61 return boost::make_tuple ( result, begin );
64 boost::tribool result = boost::indeterminate;
65 return boost::make_tuple ( result, begin );
70 boost::tribool
consume ( shared_ptr<HttpRequest> req,
char input );
76 static bool is_ctl (
int c );
110 #endif // HTTP_REQUEST_PARSER_HPP
state
The current state of the parser.
Parser for incoming requests.
static bool is_tspecial(int c)
Check if a byte is defined as an HTTP tspecial character.
HttpRequestParser()
Construct ready to parse the request method.
static bool is_ctl(int c)
Check if a byte is an HTTP control character.
static bool is_digit(int c)
Check if a byte is a digit.
static bool is_char(int c)
Check if a byte is an HTTP character.
enum HttpRequestParser::state state_
boost::tribool consume(shared_ptr< HttpRequest > req, char input)
Handle the next character of input.
void reset()
Reset to initial parser state.
boost::tuple< boost::tribool, InputIterator > parse(shared_ptr< HttpRequest > req, InputIterator begin, InputIterator end)
Parse some data.