summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVegard Storheil Eriksen <zyp@jvnv.net>2011-01-02 13:41:29 +0100
committerVegard Storheil Eriksen <zyp@jvnv.net>2011-01-02 13:41:29 +0100
commit3a4010028fc7d310c841c3d96d69008ce7d6c288 (patch)
tree91091cfed67e138804bf4c317cb4fbec3995228e
parent77b0a5908e0871b1d3b8aae7b5a8cd241dff9d63 (diff)
Urldecode path.
-rw-r--r--http_connection.cpp4
1 files changed, 3 insertions, 1 deletions
diff --git a/http_connection.cpp b/http_connection.cpp
index 0873985..79556e7 100644
--- a/http_connection.cpp
+++ b/http_connection.cpp
@@ -71,7 +71,9 @@ bool HTTP::Connection::parse_request(boost::asio::streambuf& buf) {
qi::rule<Iterator, std::string()> word_p = +(qi::char_ - ' ' - '\r');
- qi::rule<Iterator, std::vector<std::string>()> path_p = '/' >> +(qi::char_ - '/' - '?' - ' ') % '/';
+ qi::rule<Iterator, char()> urlchar_p = (qi::char_ - '%') | ('%' >> qi::uint_parser<char, 16, 2, 2>());
+
+ qi::rule<Iterator, std::vector<std::string>()> path_p = '/' >> +(urlchar_p - '/' - '?' - ' ') % '/';
qi::rule<Iterator, std::pair<std::string, std::string>()> pair_p = +(qi::char_ - '=') >> '=' >> +(qi::char_ - '&' - ' ');
qi::rule<Iterator, std::map<std::string, std::string>()> args_p = '?' >> pair_p >> *('&' >> pair_p);