File tree Expand file tree Collapse file tree 4 files changed +24
-2
lines changed Expand file tree Collapse file tree 4 files changed +24
-2
lines changed Original file line number Diff line number Diff line change @@ -24,6 +24,7 @@ namespace network {
24
24
namespace http {
25
25
26
26
struct request_header {
27
+ typedef std::string string_type;
27
28
std::string name, value;
28
29
};
29
30
@@ -33,6 +34,7 @@ inline void swap(request_header & l, request_header & r) {
33
34
}
34
35
35
36
struct response_header {
37
+ typedef std::string string_type;
36
38
std::string name, value;
37
39
};
38
40
Original file line number Diff line number Diff line change @@ -32,8 +32,8 @@ struct key_value_sequence
32
32
{
33
33
query = pair >> *((boost::spirit::qi::lit (' ;' ) | ' &' ) >> pair);
34
34
pair = key >> -(' =' >> value);
35
- key = boost::spirit::qi::char_ (" a-zA-Z_" ) >> *boost::spirit::qi::char_ (" a-zA-Z_0-9/%" );
36
- value = + boost::spirit::qi::char_ (" a-zA-Z_0-9/%" );
35
+ key = boost::spirit::qi::char_ (" a-zA-Z_" ) >> *boost::spirit::qi::char_ (" -+.~ a-zA-Z_0-9/%" );
36
+ value = * boost::spirit::qi::char_ (" -+.~ a-zA-Z_0-9/%" );
37
37
}
38
38
39
39
boost::spirit::qi::rule<uri::const_iterator, Map()> query;
Original file line number Diff line number Diff line change @@ -74,6 +74,12 @@ OutputIterator decode(const InputIterator &in_begin,
74
74
*out++ = 0x10 * v0 + v1;
75
75
}
76
76
else
77
+ if (*it == ' +' )
78
+ {
79
+ *out++ = ' ' ;
80
+ ++ it;
81
+ }
82
+ else
77
83
{
78
84
*out++ = *it++;
79
85
}
Original file line number Diff line number Diff line change @@ -694,3 +694,17 @@ BOOST_AUTO_TEST_CASE(uri_unordered_set_test) {
694
694
BOOST_REQUIRE (!uri_set.empty ());
695
695
BOOST_CHECK_EQUAL ((*uri_set.begin ()), network::uri (" http://www.example.com/" ));
696
696
}
697
+
698
+ BOOST_AUTO_TEST_CASE (issue_161_test) {
699
+ network::uri instance (" http://www.example.com/path?param1=-¶m2=some+plus+encoded+text¶m3=~" );
700
+ BOOST_REQUIRE (network::valid (instance));
701
+
702
+ std::map<std::string, std::string> queries;
703
+ network::query_map (instance, queries);
704
+ BOOST_REQUIRE_EQUAL (queries.size (), std::size_t (3 ));
705
+ BOOST_CHECK_EQUAL (queries[" param1" ], " -" );
706
+ BOOST_CHECK_EQUAL (queries[" param2" ], " some+plus+encoded+text" );
707
+ BOOST_CHECK_EQUAL (queries[" param3" ], " ~" );
708
+ BOOST_CHECK_EQUAL (network::decoded (queries[" param2" ]), " some plus encoded text" );
709
+ }
710
+
You can’t perform that action at this time.
0 commit comments