Skip to content

Commit 0faa40c

Browse files
author
Dean Michael Berris
committed
Beginnings of a status parsing implementation.
1 parent e802354 commit 0faa40c

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

libs/network/test/http_incremental_parser.cpp

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,10 +103,20 @@ BOOST_AUTO_TEST_CASE(incremental_parser_parse_http_version) {
103103
*/
104104
BOOST_AUTO_TEST_CASE(incremental_parser_parse_status) {
105105
typedef response_parser<tags::default_string> response_parser_type;
106+
typedef response_parser_type::range_type range_type;
106107
// We want to create a parser that has been initialized to a specific
107108
// state. In this case we assume that the parser has already parsed
108109
// the version part of the HTTP Response.
109110
response_parser_type p(response_parser_type::http_version_done);
110111

112+
std::string valid_status = "200 ";
113+
logic::tribool parsed_ok;
114+
range_type result_range;
115+
fusion::tie(parsed_ok, result_range) = p.parse_until(
116+
response_parser_type::http_status_done,
117+
valid_status);
118+
BOOST_CHECK_EQUAL(parsed_ok, true);
119+
parsed = std::string(boost::begin(result_range), boost::end(result_range));
120+
std::cout << "PARSED: " << parsed << " state=" << p.state() << std::endl;
111121
}
112122

0 commit comments

Comments
 (0)