alaCarte Maps
Renderer for OpenStreetMap tiles
HttpRequestParser Class Reference

Parser for incoming requests. More...

#include <request_parser.hpp>

Public Member Functions

 HttpRequestParser ()
 Construct ready to parse the request method. More...
 
void reset ()
 Reset to initial parser state. More...
 
template<typename InputIterator >
boost::tuple< boost::tribool, InputIterator > parse (shared_ptr< HttpRequest > req, InputIterator begin, InputIterator end)
 Parse some data. 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 (shared_ptr< 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_tspecial (int c)
 Check if a byte is defined as an HTTP tspecial character. More...
 
static bool is_digit (int c)
 Check if a byte is a digit. More...
 

Private Attributes

enum HttpRequestParser::state state_
 

Detailed Description

Parser for incoming requests.

Definition at line 41 of file request_parser.hpp.

Member Enumeration Documentation

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 85 of file request_parser.hpp.

Constructor & Destructor Documentation

HttpRequestParser::HttpRequestParser ( )

Construct ready to parse the request method.

This file is part of alaCarte.

alaCarte is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

alaCarte is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details.

You should have received a copy of the GNU Affero General Public License along with alaCarte. If not, see http://www.gnu.org/licenses/.

Copyright alaCarte 2012-2013 Simon Dreher, Florian Jacob, Tobias Kahlert, Patrick Niklaus, Bernhard Scheirle, Lisa Winter Maintainer: Bernhard Scheirle

Definition at line 35 of file request_parser.cpp.

Member Function Documentation

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

Handle the next character of input.

Definition at line 45 of file request_parser.cpp.

bool HttpRequestParser::is_char ( int  c)
staticprivate

Check if a byte is an HTTP character.

Definition at line 263 of file request_parser.cpp.

bool HttpRequestParser::is_ctl ( int  c)
staticprivate

Check if a byte is an HTTP control character.

Definition at line 268 of file request_parser.cpp.

bool HttpRequestParser::is_digit ( int  c)
staticprivate

Check if a byte is a digit.

Definition at line 301 of file request_parser.cpp.

bool HttpRequestParser::is_tspecial ( int  c)
staticprivate

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

Definition at line 273 of file request_parser.cpp.

template<typename InputIterator >
boost::tuple<boost::tribool, InputIterator> HttpRequestParser::parse ( shared_ptr< 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 55 of file request_parser.hpp.

void HttpRequestParser::reset ( )

Reset to initial parser state.

Definition at line 40 of file request_parser.cpp.

Member Data Documentation

enum HttpRequestParser::state HttpRequestParser::state_
private

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