Skip to content

Commit 0cf2ddd

Browse files
Jeroen Habrakendeanberris
authored andcommitted
Switched to RFC 3986, path component
1 parent 0a4504d commit 0cf2ddd

File tree

1 file changed

+11
-6
lines changed

1 file changed

+11
-6
lines changed

boost/network/uri/http/detail/parse_specific.hpp

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -86,10 +86,15 @@ namespace boost { namespace network { namespace uri {
8686
parts.fragment
8787
);
8888

89-
qi::rule<iterator, string_type::value_type()> reserved = qi::char_(";/?:@&=+$,");
90-
qi::rule<iterator, string_type::value_type()> unreserved = qi::alnum | qi::char_("-_.!~*'()");
91-
qi::rule<iterator, string_type()> escaped = qi::char_("%") > qi::repeat(2)[qi::xdigit];
89+
qi::rule<iterator, string_type::value_type()> gen_delims = qi::char_(":/?#[]@");
90+
qi::rule<iterator, string_type::value_type()> sub_delims = qi::char_("!$&'()*+,;=");
9291

92+
qi::rule<iterator, string_type::value_type()> reserved = gen_delims | sub_delims;
93+
qi::rule<iterator, string_type::value_type()> unreserved = qi::alnum | qi::char_("-._~");
94+
qi::rule<iterator, string_type()> pct_encoded = qi::char_("%") > qi::repeat(2)[qi::xdigit];
95+
96+
qi::rule<iterator, string_type()> pchar = qi::raw[unreserved | pct_encoded | sub_delims | qi::char_(":@")];
97+
9398
hostname<tags::http>::parser<iterator> hostname;
9499
bool ok = qi::parse(
95100
start_, end_,
@@ -101,9 +106,9 @@ namespace boost { namespace network { namespace uri {
101106
]
102107
>> hostname
103108
>> -qi::lexeme[':' >> qi::ushort_]
104-
>> -qi::lexeme['/' >> *((qi::alnum | qi::punct) - '?')]
105-
>> -qi::lexeme['?' >> qi::raw[*(reserved | unreserved | escaped)]]
106-
>> -qi::lexeme['#' >> qi::raw[*(reserved | unreserved | escaped)]]
109+
>> qi::lexeme[qi::raw[*(qi::char_("/") > *pchar)]]
110+
>> -qi::lexeme['?' >> qi::raw[*(pchar | qi::char_("/?"))]]
111+
>> -qi::lexeme['#' >> qi::raw[*(pchar | qi::char_("/?"))]]
107112
),
108113
result
109114
);

0 commit comments

Comments
 (0)