Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions include/network/protocol/http/message/header.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ namespace network {
namespace http {

struct request_header {
typedef std::string string_type;
std::string name, value;
};

Expand All @@ -33,6 +34,7 @@ inline void swap(request_header & l, request_header & r) {
}

struct response_header {
typedef std::string string_type;
std::string name, value;
};

Expand Down
4 changes: 2 additions & 2 deletions include/network/uri/accessors.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@ struct key_value_sequence
{
query = pair >> *((boost::spirit::qi::lit(';') | '&') >> pair);
pair = key >> -('=' >> value);
key = boost::spirit::qi::char_("a-zA-Z_") >> *boost::spirit::qi::char_("a-zA-Z_0-9/%");
value = +boost::spirit::qi::char_("a-zA-Z_0-9/%");
key = boost::spirit::qi::char_("a-zA-Z_") >> *boost::spirit::qi::char_("-+.~a-zA-Z_0-9/%");
value = *boost::spirit::qi::char_("-+.~a-zA-Z_0-9/%");
}

boost::spirit::qi::rule<uri::const_iterator, Map()> query;
Expand Down
6 changes: 6 additions & 0 deletions include/network/uri/decode.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,12 @@ OutputIterator decode(const InputIterator &in_begin,
*out++ = 0x10 * v0 + v1;
}
else
if (*it == '+')
{
*out++ = ' ';
++ it;
}
else
{
*out++ = *it++;
}
Expand Down
14 changes: 14 additions & 0 deletions libs/network/test/uri/uri_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -691,3 +691,17 @@ BOOST_AUTO_TEST_CASE(uri_unordered_set_test) {
BOOST_REQUIRE(!uri_set.empty());
BOOST_CHECK_EQUAL((*uri_set.begin()), network::uri("http://www.example.com/"));
}

BOOST_AUTO_TEST_CASE(issue_161_test) {
network::uri instance("http://www.example.com/path?param1=-&param2=some+plus+encoded+text&param3=~");
BOOST_REQUIRE(network::valid(instance));

std::map<std::string, std::string> queries;
network::query_map(instance, queries);
BOOST_REQUIRE_EQUAL(queries.size(), std::size_t(3));
BOOST_CHECK_EQUAL(queries["param1"], "-");
BOOST_CHECK_EQUAL(queries["param2"], "some+plus+encoded+text");
BOOST_CHECK_EQUAL(queries["param3"], "~");
BOOST_CHECK_EQUAL(network::decoded(queries["param2"]), "some plus encoded text");
}