Skip to content

Added better IPv6 parsing to the URI, and cleaned up some warnings. #448

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Sep 19, 2014
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
1 change: 0 additions & 1 deletion boost/network/message/directives/header.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,6 @@ struct header_directive {

template <class Message>
void operator()(Message const& msg) const {
typedef typename Message::headers_container_type::value_type value_type;
directive_impl<Message>::eval(msg, _header_name, _header_value);
}

Expand Down
3 changes: 0 additions & 3 deletions boost/network/message/message_concept.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,6 @@ struct Message : DefaultConstructible<M>, CopyConstructible<M>, Assignable<M> {
typedef typename traits::source<M>::type source_type;
typedef typename traits::destination<M>::type destination_type;

typedef typename traits::header_key<M>::type header_key_type;
typedef typename traits::header_value<M>::type header_value_type;

headers_container_type headers_ = headers(message);
string_type body_ = body(message);
string_type source_ = source(message);
Expand Down
1 change: 0 additions & 1 deletion boost/network/message/modifiers/remove_header.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@ struct iequals_pred {
template <class Message, class KeyType, class Tag>
inline typename enable_if<is_pod<Tag>, void>::type remove_header(
Message& message, KeyType const& key, Tag) {
typedef typename Message::headers_container_type headers;
message.headers.erase(
boost::remove_if(message.headers, iequals_pred<KeyType>(key)),
message.headers.end());
Expand Down
1 change: 0 additions & 1 deletion boost/network/protocol/http/server/async_connection.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,6 @@ struct async_connection
<< consts::space() << status << consts::space()
<< status_message(status) << consts::crlf();
if (!boost::empty(headers)) {
typedef typename Range::const_iterator iterator;
typedef typename string<Tag>::type string_type;
boost::transform(headers, std::ostream_iterator<string_type>(stream),
linearize_header<Tag>());
Expand Down
2 changes: 0 additions & 2 deletions boost/network/uri/encode.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -126,8 +126,6 @@ template <class InputIterator, class OutputIterator>
OutputIterator encode(const InputIterator &in_begin,
const InputIterator &in_end,
const OutputIterator &out_begin) {
typedef typename boost::iterator_value<InputIterator>::type value_type;

InputIterator it = in_begin;
OutputIterator out = out_begin;
while (it != in_end) {
Expand Down
49 changes: 36 additions & 13 deletions boost/network/uri/uri.ipp
Original file line number Diff line number Diff line change
Expand Up @@ -84,19 +84,42 @@ struct uri_grammar
ipvfuture %=
qi::lit('v') >> +qi::xdigit >> '.' >> +(unreserved | sub_delims | ':');

ipv6address %=
qi::raw[qi::repeat(6)[h16 >> ':'] >> ls32 |
"::" >> qi::repeat(5)[h16 >> ':'] >> ls32 |
qi::raw[h16] >> "::" >> qi::repeat(4)[h16 >> ':'] >> ls32 |
qi::raw[+(*(h16 >> ':')) >> h16] >> "::" >>
qi::repeat(3)[h16 >> ':'] >> ls32 |
qi::raw[qi::repeat(2)[*(h16 >> ':')] >> h16] >> "::" >>
qi::repeat(2)[h16 >> ':'] >> ls32 |
qi::raw[qi::repeat(3)[*(h16 >> ':')] >> h16] >> "::" >> h16 >>
':' >> ls32 |
qi::raw[qi::repeat(4)[*(h16 >> ':')] >> h16] >> "::" >> ls32 |
qi::raw[qi::repeat(5)[*(h16 >> ':')] >> h16] >> "::" >> h16 |
qi::raw[qi::repeat(6)[*(h16 >> ':')] >> h16] >> "::"];
ipv6address %= qi::raw
[qi::repeat(6)[h16 >> ':'] >> ls32 |
"::" >> qi::repeat(5)[h16 >> ':'] >> ls32 |
-qi::raw[h16] >> "::" >> qi::repeat(4)[h16 >> ':'] >> ls32 |
-qi::raw[h16] >> "::" >> qi::repeat(3)[h16 >> ':'] >> ls32 |
-qi::raw[h16] >> "::" >> qi::repeat(2)[h16 >> ':'] >> ls32 |
-qi::raw[h16] >> "::" >> h16 >> ':' >> ls32 |
-qi::raw[h16] >> "::" >> ls32 | -qi::raw[h16] >> "::" >> h16 |
-qi::raw[h16] >> "::" |
-qi::raw[qi::repeat(1)[(h16 >> ':')] >> h16] >> "::" >>
qi::repeat(3)[h16 >> ':'] >> ls32 |
-qi::raw[qi::repeat(1)[(h16 >> ':')] >> h16] >> "::" >>
qi::repeat(2)[h16 >> ':'] >> ls32 |
-qi::raw[qi::repeat(1)[(h16 >> ':')] >> h16] >> "::" >> h16 >>
':' >> ls32 |
-qi::raw[qi::repeat(1)[(h16 >> ':')] >> h16] >> "::" >> ls32 |
-qi::raw[qi::repeat(1)[(h16 >> ':')] >> h16] >> "::" >> h16 |
-qi::raw[qi::repeat(1)[(h16 >> ':')] >> h16] >> "::" |
-qi::raw[qi::repeat(2)[(h16 >> ':')] >> h16] >> "::" >>
qi::repeat(2)[h16 >> ':'] >> ls32 |
-qi::raw[qi::repeat(2)[(h16 >> ':')] >> h16] >> "::" >> h16 >>
':' >> ls32 |
-qi::raw[qi::repeat(2)[(h16 >> ':')] >> h16] >> "::" >> ls32 |
-qi::raw[qi::repeat(2)[(h16 >> ':')] >> h16] >> "::" >> h16 |
-qi::raw[qi::repeat(2)[(h16 >> ':')] >> h16] >> "::" |
-qi::raw[qi::repeat(3)[(h16 >> ':')] >> h16] >> "::" >> h16 >>
':' >> ls32 |
-qi::raw[qi::repeat(3)[(h16 >> ':')] >> h16] >> "::" >> ls32 |
-qi::raw[qi::repeat(3)[(h16 >> ':')] >> h16] >> "::" >> h16 |
-qi::raw[qi::repeat(3)[(h16 >> ':')] >> h16] >> "::" |
-qi::raw[qi::repeat(4)[(h16 >> ':')] >> h16] >> "::" >> ls32 |
-qi::raw[qi::repeat(4)[(h16 >> ':')] >> h16] >> "::" >> h16 |
-qi::raw[qi::repeat(4)[(h16 >> ':')] >> h16] >> "::" |
-qi::raw[qi::repeat(5)[(h16 >> ':')] >> h16] >> "::" >> h16 |
-qi::raw[qi::repeat(5)[(h16 >> ':')] >> h16] >> "::" |
-qi::raw[qi::repeat(6)[(h16 >> ':')] >> h16] >> "::"];

// ls32 = ( h16 ":" h16 ) / IPv4address
ls32 %= (h16 >> ':' >> h16) | ipv4address;
Expand Down
5 changes: 5 additions & 0 deletions libs/network/test/uri/uri_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -561,3 +561,8 @@ BOOST_AUTO_TEST_CASE(issue_364_test) {
uri::schemes::http(instance) << uri::host("my.awesome.server.com");
BOOST_CHECK_EQUAL("my.awesome.server.com", uri::authority(instance));
}

BOOST_AUTO_TEST_CASE(issue_447_test) {
uri::uri instance("http://[www.foo.com/");
BOOST_REQUIRE(!uri::valid(instance));
}