36 : state_ ( method_start )
54 req->data.method.push_back ( input );
55 return boost::indeterminate;
62 return boost::indeterminate;
66 req->data.method.push_back ( input );
67 return boost::indeterminate;
74 return boost::indeterminate;
75 }
else if (
is_ctl ( input ) ) {
78 req->data.uri.push_back ( input );
79 return boost::indeterminate;
86 return boost::indeterminate;
95 return boost::indeterminate;
102 if ( input ==
'T' ) {
104 return boost::indeterminate;
111 if ( input ==
'P' ) {
113 return boost::indeterminate;
120 if ( input ==
'/' ) {
121 req->data.http_version_major = 0;
122 req->data.http_version_minor = 0;
124 return boost::indeterminate;
132 req->data.http_version_major = req->data.http_version_major * 10 + input -
'0';
134 return boost::indeterminate;
141 if ( input ==
'.' ) {
143 return boost::indeterminate;
145 req->data.http_version_major = req->data.http_version_major * 10 + input -
'0';
146 return boost::indeterminate;
154 req->data.http_version_minor = req->data.http_version_minor * 10 + input -
'0';
156 return boost::indeterminate;
163 if ( input ==
'\r' ) {
165 return boost::indeterminate;
167 req->data.http_version_minor = req->data.http_version_minor * 10 + input -
'0';
168 return boost::indeterminate;
175 if ( input ==
'\n' ) {
177 return boost::indeterminate;
184 if ( input ==
'\r' ) {
186 return boost::indeterminate;
187 }
else if ( !req->data.headers.empty() && ( input ==
' ' || input ==
'\t' ) ) {
189 return boost::indeterminate;
194 req->data.headers.back().name.push_back ( input );
196 return boost::indeterminate;
201 if ( input ==
'\r' ) {
203 return boost::indeterminate;
204 }
else if ( input ==
' ' || input ==
'\t' ) {
205 return boost::indeterminate;
206 }
else if (
is_ctl ( input ) ) {
210 req->data.headers.back().value.push_back ( input );
211 return boost::indeterminate;
216 if ( input ==
':' ) {
218 return boost::indeterminate;
222 req->data.headers.back().name.push_back ( input );
223 return boost::indeterminate;
228 if ( input ==
' ' ) {
230 return boost::indeterminate;
237 if ( input ==
'\r' ) {
239 return boost::indeterminate;
240 }
else if (
is_ctl ( input ) ) {
243 req->data.headers.back().value.push_back ( input );
244 return boost::indeterminate;
249 if ( input ==
'\n' ) {
251 return boost::indeterminate;
257 return ( input ==
'\n' );
265 return c >= 0 && c <= 127;
270 return ( c >= 0 && c <= 31 ) || ( c == 127 );
303 return c >=
'0' && c <=
'9';
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.