Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- bool http_parser::parse_http_version(header::version &version)
- {
- // HTTP-Version = "HTTP" "/" 1*DIGIT "." 1*DIGIT
- save();
- if (parse_static_string("HTTP/")
- && parse_decimal_number_unsigned(version.major)
- && parse_static_string(".")
- && parse_decimal_number_unsigned(version.minor))
- return commit();
- return restore();
- }
- bool http_parser::parse_decimal_number_unsigned(uint &number)
- {
- save();
- next_char();
- if (!is_digit_nonzero())
- return restore();
- number = 0;
- do {
- number *= 10;
- number += current_seek_next() - '0';
- } while (is_digit());
- return commit();
- }
- bool http_parser::parse_comment(std::string &comment)
- {
- // comment = "(" *( ctext | quoted-pair | comment ) ")"
- save();
- current_seek_next();
- if (current() != '(')
- return restore();
- std::string text;
- while (parse_ctext(text) || parse_quoted_pair(text) || parse_comment(text))
- comment += text;
- if (current() != '(')
- return restore();
- return commit();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement