Skip to content

Commit 03b34d6

Browse files
committed
Merge pull request #448 from glynos/0.11-devel-uri-ipv6
Added better IPv6 parsing to the URI, and cleaned up some warnings.
2 parents d4070db + bdbd612 commit 03b34d6

File tree

7 files changed

+41
-21
lines changed

7 files changed

+41
-21
lines changed

boost/network/message/directives/header.hpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,6 @@ struct header_directive {
5555

5656
template <class Message>
5757
void operator()(Message const& msg) const {
58-
typedef typename Message::headers_container_type::value_type value_type;
5958
directive_impl<Message>::eval(msg, _header_name, _header_value);
6059
}
6160

boost/network/message/message_concept.hpp

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,6 @@ struct Message : DefaultConstructible<M>, CopyConstructible<M>, Assignable<M> {
3434
typedef typename traits::source<M>::type source_type;
3535
typedef typename traits::destination<M>::type destination_type;
3636

37-
typedef typename traits::header_key<M>::type header_key_type;
38-
typedef typename traits::header_value<M>::type header_value_type;
39-
4037
headers_container_type headers_ = headers(message);
4138
string_type body_ = body(message);
4239
string_type source_ = source(message);

boost/network/message/modifiers/remove_header.hpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,6 @@ struct iequals_pred {
4646
template <class Message, class KeyType, class Tag>
4747
inline typename enable_if<is_pod<Tag>, void>::type remove_header(
4848
Message& message, KeyType const& key, Tag) {
49-
typedef typename Message::headers_container_type headers;
5049
message.headers.erase(
5150
boost::remove_if(message.headers, iequals_pred<KeyType>(key)),
5251
message.headers.end());

boost/network/protocol/http/server/async_connection.hpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -222,7 +222,6 @@ struct async_connection
222222
<< consts::space() << status << consts::space()
223223
<< status_message(status) << consts::crlf();
224224
if (!boost::empty(headers)) {
225-
typedef typename Range::const_iterator iterator;
226225
typedef typename string<Tag>::type string_type;
227226
boost::transform(headers, std::ostream_iterator<string_type>(stream),
228227
linearize_header<Tag>());

boost/network/uri/encode.hpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -126,8 +126,6 @@ template <class InputIterator, class OutputIterator>
126126
OutputIterator encode(const InputIterator &in_begin,
127127
const InputIterator &in_end,
128128
const OutputIterator &out_begin) {
129-
typedef typename boost::iterator_value<InputIterator>::type value_type;
130-
131129
InputIterator it = in_begin;
132130
OutputIterator out = out_begin;
133131
while (it != in_end) {

boost/network/uri/uri.ipp

Lines changed: 36 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -84,19 +84,42 @@ struct uri_grammar
8484
ipvfuture %=
8585
qi::lit('v') >> +qi::xdigit >> '.' >> +(unreserved | sub_delims | ':');
8686

87-
ipv6address %=
88-
qi::raw[qi::repeat(6)[h16 >> ':'] >> ls32 |
89-
"::" >> qi::repeat(5)[h16 >> ':'] >> ls32 |
90-
qi::raw[h16] >> "::" >> qi::repeat(4)[h16 >> ':'] >> ls32 |
91-
qi::raw[+(*(h16 >> ':')) >> h16] >> "::" >>
92-
qi::repeat(3)[h16 >> ':'] >> ls32 |
93-
qi::raw[qi::repeat(2)[*(h16 >> ':')] >> h16] >> "::" >>
94-
qi::repeat(2)[h16 >> ':'] >> ls32 |
95-
qi::raw[qi::repeat(3)[*(h16 >> ':')] >> h16] >> "::" >> h16 >>
96-
':' >> ls32 |
97-
qi::raw[qi::repeat(4)[*(h16 >> ':')] >> h16] >> "::" >> ls32 |
98-
qi::raw[qi::repeat(5)[*(h16 >> ':')] >> h16] >> "::" >> h16 |
99-
qi::raw[qi::repeat(6)[*(h16 >> ':')] >> h16] >> "::"];
87+
ipv6address %= qi::raw
88+
[qi::repeat(6)[h16 >> ':'] >> ls32 |
89+
"::" >> qi::repeat(5)[h16 >> ':'] >> ls32 |
90+
-qi::raw[h16] >> "::" >> qi::repeat(4)[h16 >> ':'] >> ls32 |
91+
-qi::raw[h16] >> "::" >> qi::repeat(3)[h16 >> ':'] >> ls32 |
92+
-qi::raw[h16] >> "::" >> qi::repeat(2)[h16 >> ':'] >> ls32 |
93+
-qi::raw[h16] >> "::" >> h16 >> ':' >> ls32 |
94+
-qi::raw[h16] >> "::" >> ls32 | -qi::raw[h16] >> "::" >> h16 |
95+
-qi::raw[h16] >> "::" |
96+
-qi::raw[qi::repeat(1)[(h16 >> ':')] >> h16] >> "::" >>
97+
qi::repeat(3)[h16 >> ':'] >> ls32 |
98+
-qi::raw[qi::repeat(1)[(h16 >> ':')] >> h16] >> "::" >>
99+
qi::repeat(2)[h16 >> ':'] >> ls32 |
100+
-qi::raw[qi::repeat(1)[(h16 >> ':')] >> h16] >> "::" >> h16 >>
101+
':' >> ls32 |
102+
-qi::raw[qi::repeat(1)[(h16 >> ':')] >> h16] >> "::" >> ls32 |
103+
-qi::raw[qi::repeat(1)[(h16 >> ':')] >> h16] >> "::" >> h16 |
104+
-qi::raw[qi::repeat(1)[(h16 >> ':')] >> h16] >> "::" |
105+
-qi::raw[qi::repeat(2)[(h16 >> ':')] >> h16] >> "::" >>
106+
qi::repeat(2)[h16 >> ':'] >> ls32 |
107+
-qi::raw[qi::repeat(2)[(h16 >> ':')] >> h16] >> "::" >> h16 >>
108+
':' >> ls32 |
109+
-qi::raw[qi::repeat(2)[(h16 >> ':')] >> h16] >> "::" >> ls32 |
110+
-qi::raw[qi::repeat(2)[(h16 >> ':')] >> h16] >> "::" >> h16 |
111+
-qi::raw[qi::repeat(2)[(h16 >> ':')] >> h16] >> "::" |
112+
-qi::raw[qi::repeat(3)[(h16 >> ':')] >> h16] >> "::" >> h16 >>
113+
':' >> ls32 |
114+
-qi::raw[qi::repeat(3)[(h16 >> ':')] >> h16] >> "::" >> ls32 |
115+
-qi::raw[qi::repeat(3)[(h16 >> ':')] >> h16] >> "::" >> h16 |
116+
-qi::raw[qi::repeat(3)[(h16 >> ':')] >> h16] >> "::" |
117+
-qi::raw[qi::repeat(4)[(h16 >> ':')] >> h16] >> "::" >> ls32 |
118+
-qi::raw[qi::repeat(4)[(h16 >> ':')] >> h16] >> "::" >> h16 |
119+
-qi::raw[qi::repeat(4)[(h16 >> ':')] >> h16] >> "::" |
120+
-qi::raw[qi::repeat(5)[(h16 >> ':')] >> h16] >> "::" >> h16 |
121+
-qi::raw[qi::repeat(5)[(h16 >> ':')] >> h16] >> "::" |
122+
-qi::raw[qi::repeat(6)[(h16 >> ':')] >> h16] >> "::"];
100123

101124
// ls32 = ( h16 ":" h16 ) / IPv4address
102125
ls32 %= (h16 >> ':' >> h16) | ipv4address;

libs/network/test/uri/uri_test.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -561,3 +561,8 @@ BOOST_AUTO_TEST_CASE(issue_364_test) {
561561
uri::schemes::http(instance) << uri::host("my.awesome.server.com");
562562
BOOST_CHECK_EQUAL("my.awesome.server.com", uri::authority(instance));
563563
}
564+
565+
BOOST_AUTO_TEST_CASE(issue_447_test) {
566+
uri::uri instance("http://[www.foo.com/");
567+
BOOST_REQUIRE(!uri::valid(instance));
568+
}

0 commit comments

Comments
 (0)