File tree Expand file tree Collapse file tree 2 files changed +19
-2
lines changed
boost/network/protocol/http/parser Expand file tree Collapse file tree 2 files changed +19
-2
lines changed Original file line number Diff line number Diff line change @@ -34,10 +34,12 @@ namespace boost { namespace network { namespace http {
34
34
typedef typename string<Tag>::type::const_iterator iterator_type;
35
35
typedef iterator_range<iterator_type> range_type;
36
36
37
- response_parser ()
38
- : state_(http_response_begin) {}
37
+ explicit response_parser (state_t state=http_response_begin)
38
+ : state_(state) {}
39
+
39
40
response_parser (response_parser const & other)
40
41
: state_(other.state_) {}
42
+
41
43
~response_parser () {}
42
44
43
45
void swap (response_parser & other) {
Original file line number Diff line number Diff line change @@ -95,3 +95,18 @@ BOOST_AUTO_TEST_CASE(incremental_parser_parse_http_version) {
95
95
parsed = std::string (boost::begin (result_range), boost::end (result_range));
96
96
std::cout << " PARSED: " << parsed << " state=" << p.state () << std::endl;
97
97
}
98
+
99
+ /* * In this test we then want to check that we can parse a status
100
+ * string right after the version string. We should expect that
101
+ * the parser doesn't do any conversions from string to integer
102
+ * and outsource that part to the user of the parser.
103
+ */
104
+ BOOST_AUTO_TEST_CASE (incremental_parser_parse_status) {
105
+ typedef response_parser<tags::default_string> response_parser_type;
106
+ // We want to create a parser that has been initialized to a specific
107
+ // state. In this case we assume that the parser has already parsed
108
+ // the version part of the HTTP Response.
109
+ response_parser_type p (response_parser_type::http_version_done);
110
+
111
+ }
112
+
You can’t perform that action at this time.
0 commit comments