http_request_parser.hpp
Go to the documentation of this file.
1 //
2 // http_request_parser.hpp
3 // ~~~~~~~~~~~~~~~~~~
4 //
5 // Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com)
6 //
7 // Distributed under the Boost Software License, Version 1.0. (See accompanying
8 // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
9 //
10 
11 #ifndef CPP_WEB_SERVER_HTTP_REQUEST_PARSER_HPP
12 #define CPP_WEB_SERVER_HTTP_REQUEST_PARSER_HPP
13 
15 
16 #include <boost/logic/tribool.hpp>
17 #include <boost/tuple/tuple.hpp>
18 
19 namespace async_web_server_cpp
20 {
21 
23 {
24 public:
27 
29  void reset();
30 
35  template<typename InputIterator>
36  boost::tuple<boost::tribool, InputIterator>
37  parse(HttpRequest& req, InputIterator begin, InputIterator end)
38  {
39  while (begin != end)
40  {
41  boost::tribool result = consume(req, *begin++);
42  if (result || !result)
43  return boost::make_tuple(result, begin);
44  }
45  boost::tribool result = boost::indeterminate;
46  return boost::make_tuple(result, begin);
47  }
48 
49 private:
51  boost::tribool consume(HttpRequest& req, char input);
52 
54  static bool is_char(int c);
55 
57  static bool is_ctl(int c);
58 
60  static bool is_tspecial(int c);
61 
63  static bool is_digit(int c);
64 
66  enum state
67  {
70  uri,
88  } state_;
89 };
90 
91 } // namespace async_web_server_cpp
92 
93 #endif
static bool is_digit(int c)
Check if a byte is a digit.
static bool is_tspecial(int c)
Check if a byte is defined as an HTTP tspecial character.
void reset()
Reset to initial parser state.
static bool is_char(int c)
Check if a byte is an HTTP character.
HttpRequestParser()
Construct ready to parse the request method.
enum async_web_server_cpp::HttpRequestParser::state state_
static bool is_ctl(int c)
Check if a byte is an HTTP control character.
state
The current state of the parser.
boost::tribool consume(HttpRequest &req, char input)
Handle the next character of input.
boost::tuple< boost::tribool, InputIterator > parse(HttpRequest &req, InputIterator begin, InputIterator end)


async_web_server_cpp
Author(s): Mitchell Wills , Russel Toris
autogenerated on Mon Feb 28 2022 21:54:08