Skip to content

Commit e92fe04

Browse files
committed
Revert "Merge branch '0.9-devel' of github.com:deanberris/cpp-netlib into canonical-0.9-devel"
This reverts commit 9ab0cac, reversing changes made to 79d3fd6.
1 parent b8c28a5 commit e92fe04

36 files changed

+1540
-812
lines changed

boost/network/protocol/http/impl/request.hpp

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
#include <boost/fusion/sequence/intrinsic/at_key.hpp>
1616
#include <boost/fusion/sequence/intrinsic/value_at_key.hpp>
1717

18-
#include <boost/network/uri/uri.hpp>
18+
#include <boost/network/uri/http/uri.hpp>
1919
#include <boost/network/traits/vector.hpp>
2020

2121
#include <boost/network/protocol/http/message/async_message.hpp>
@@ -50,7 +50,7 @@ namespace http {
5050
struct basic_request : public basic_message<Tag>
5151
{
5252

53-
mutable boost::network::uri::basic_uri<typename string<Tag>::type> uri_;
53+
mutable boost::network::uri::http::basic_uri<Tag> uri_;
5454
typedef basic_message<Tag> base_type;
5555

5656
public:
@@ -80,25 +80,19 @@ namespace http {
8080
}
8181

8282
void swap(basic_request & other) {
83+
using boost::network::uri::swap;
8384
base_type & base_ref(other);
8485
basic_request<Tag> & this_ref(*this);
8586
base_ref.swap(this_ref);
86-
boost::swap(other.uri_, this->uri_);
87+
swap(other.uri_, this->uri_);
8788
}
8889

8990
string_type const host() const {
9091
return uri_.host();
9192
}
9293

9394
port_type port() const {
94-
boost::optional<port_type> port = uri::port_us(uri_);
95-
if (!port)
96-
{
97-
typedef constants<Tag> consts;
98-
return boost::iequals(uri_.scheme_range(),
99-
string_type(consts::https()))? 443 : 80;
100-
}
101-
return *port;
95+
return uri::port_us(uri_);
10296
}
10397

10498
string_type const path() const {
@@ -121,7 +115,7 @@ namespace http {
121115
uri_ = new_uri;
122116
}
123117

124-
boost::network::uri::basic_uri<typename string<Tag>::type> const & uri() const {
118+
boost::network::uri::http::basic_uri<Tag> const & uri() const {
125119
return uri_;
126120
}
127121

boost/network/protocol/http/message/wrappers/port.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ namespace boost { namespace network { namespace http {
3030
}
3131

3232
operator boost::optional<boost::uint16_t> () {
33-
return uri::port_us(message_.uri());
33+
return port_us(message_.uri());
3434
}
3535
};
3636

boost/network/protocol/http/message/wrappers/uri.hpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
// (See accompanying file LICENSE_1_0.txt or copy at
88
// http://www.boost.org/LICENSE_1_0.txt)
99

10-
#include <boost/network/uri/uri.hpp>
10+
#include <boost/network/uri/http/uri.hpp>
1111

1212
namespace boost { namespace network { namespace http {
1313

@@ -24,7 +24,7 @@ namespace boost { namespace network { namespace http {
2424
operator string_type() {
2525
return message_.uri().raw();
2626
}
27-
operator boost::network::uri::basic_uri<typename string<Tag>::type> () {
27+
operator boost::network::uri::basic_uri<tags::http_default_8bit_tcp_resolve> () {
2828
return message_.uri();
2929
}
3030
};
@@ -40,6 +40,6 @@ namespace boost { namespace network { namespace http {
4040

4141
} // namespace network
4242

43-
} // namespace boost
43+
} // nmaespace boost
4444

4545
#endif // BOOST_NETWORK_PROTOCOL_HTTP_MESSAGE_WRAPPERS_URI_HPP_20100620

boost/network/uri.hpp

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,24 @@
66
// (See accompanying file LICENSE_1_0.txt or copy at
77
// http://www.boost.org/LICENSE_1_0.txt)
88

9+
#include <boost/network/traits/string.hpp>
910
#include <boost/network/uri/uri.hpp>
11+
#include <boost/network/protocol/http/tags.hpp>
12+
#include <boost/network/uri/http/uri.hpp>
13+
14+
15+
namespace boost { namespace network { namespace uri {
16+
17+
typedef basic_uri<boost::network::tags::default_string> uri;
18+
typedef basic_uri<boost::network::tags::default_wstring> wuri;
19+
20+
namespace http {
21+
typedef basic_uri<boost::network::http::tags::http_default_8bit_udp_resolve> uri;
22+
}
23+
24+
} // namespace uri
25+
} // namespace network
26+
} // namespace boost
1027

1128
#endif
1229

boost/network/uri/accessors.hpp

Lines changed: 43 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -12,19 +12,21 @@
1212
# include <boost/network/uri/encode.hpp>
1313
# include <boost/network/uri/decode.hpp>
1414
# include <boost/spirit/include/qi.hpp>
15-
# include <boost/fusion/include/std_pair.hpp>
1615

1716

1817
namespace boost {
1918
namespace network {
2019
namespace uri {
2120
namespace details {
2221
template <
22+
typename Uri,
2323
typename Map
2424
>
2525
struct key_value_sequence
26-
: spirit::qi::grammar<uri::const_iterator, Map()>
26+
: spirit::qi::grammar<typename Uri::const_iterator_type, Map()>
2727
{
28+
typedef typename Uri::const_iterator_type const_iterator_type;
29+
2830
key_value_sequence()
2931
: key_value_sequence::base_type(query)
3032
{
@@ -34,63 +36,79 @@ struct key_value_sequence
3436
value = +spirit::qi::char_("a-zA-Z_0-9/%");
3537
}
3638

37-
spirit::qi::rule<uri::const_iterator, Map()> query;
38-
spirit::qi::rule<uri::const_iterator, std::pair<std::string, std::string>()> pair;
39-
spirit::qi::rule<uri::const_iterator, typename std::string()> key, value;
39+
spirit::qi::rule<const_iterator_type, Map()> query;
40+
spirit::qi::rule<const_iterator_type, std::pair<typename Uri::string_type, typename Uri::string_type>()> pair;
41+
spirit::qi::rule<const_iterator_type, typename Uri::string_type()> key, value;
4042
};
4143
} // namespace details
4244

4345
template <
46+
class Tag,
4447
class Map
4548
>
4649
inline
47-
Map &query_map(const uri &uri_, Map &map) {
48-
uri::const_range_type range = uri_.query_range();
49-
details::key_value_sequence<Map> parser;
50+
Map &query_map(const basic_uri<Tag> &uri, Map &map) {
51+
typename basic_uri<Tag>::const_range_type range = uri.query_range();
52+
details::key_value_sequence<basic_uri<Tag>, Map> parser;
5053
spirit::qi::parse(boost::begin(range), boost::end(range), parser, map);
5154
return map;
5255
}
5356

54-
std::string username(const uri &uri_) {
55-
uri::const_range_type user_info_range = uri_.user_info_range();
56-
uri::const_iterator it(boost::begin(user_info_range)), end(boost::end(user_info_range));
57+
template <
58+
class Tag
59+
>
60+
typename basic_uri<Tag>::string_type username(const basic_uri<Tag> &uri) {
61+
typename basic_uri<Tag>::const_range_type user_info_range = uri.user_info_range();
62+
typename basic_uri<Tag>::const_iterator_type it(boost::begin(user_info_range)), end(boost::end(user_info_range));
5763
for (; it != end; ++it) {
5864
if (*it == ':') {
5965
break;
6066
}
6167
}
62-
return std::string(boost::begin(user_info_range), it);
68+
return typename string<Tag>::type(boost::begin(user_info_range), it);
6369
}
6470

65-
std::string password(const uri &uri_) {
66-
uri::const_range_type user_info_range = uri_.user_info_range();
67-
uri::const_iterator it(boost::begin(user_info_range)), end(boost::end(user_info_range));
71+
template <
72+
class Tag
73+
>
74+
typename basic_uri<Tag>::string_type password(const basic_uri<Tag> &uri) {
75+
typename basic_uri<Tag>::const_range_type user_info_range = uri.user_info_range();
76+
typename basic_uri<Tag>::const_iterator_type it(boost::begin(user_info_range)), end(boost::end(user_info_range));
6877
for (; it != end; ++it) {
6978
if (*it == ':') {
7079
++it;
7180
break;
7281
}
7382
}
74-
return std::string(it, boost::end(user_info_range));
83+
return typename string<Tag>::type(it, boost::end(user_info_range));
7584
}
7685

77-
std::string decoded_path(const uri &uri_) {
78-
uri::const_range_type path_range = uri_.path_range();
79-
std::string decoded_path;
86+
template <
87+
class Tag
88+
>
89+
typename basic_uri<Tag>::string_type decoded_path(const basic_uri<Tag> &uri) {
90+
typename basic_uri<Tag>::const_range_type path_range = uri.path_range();
91+
typename basic_uri<Tag>::string_type decoded_path;
8092
decode(path_range, std::back_inserter(decoded_path));
8193
return decoded_path;
8294
}
8395

84-
std::string decoded_query(const uri &uri_) {
85-
uri::const_range_type query_range = uri_.query_range();
86-
std::string decoded_query;
96+
template <
97+
class Tag
98+
>
99+
typename basic_uri<Tag>::string_type decoded_query(const basic_uri<Tag> &uri) {
100+
typename basic_uri<Tag>::const_range_type query_range = uri.query_range();
101+
typename basic_uri<Tag>::string_type decoded_query;
87102
decode(query_range, std::back_inserter(decoded_query));
88103
return decoded_query;
89104
}
90105

91-
std::string decoded_fragment(const uri &uri_) {
92-
uri::const_range_type fragment_range = uri_.fragment_range();
93-
std::string decoded_fragment;
106+
template <
107+
class Tag
108+
>
109+
typename basic_uri<Tag>::string_type decoded_fragment(const basic_uri<Tag> &uri) {
110+
typename basic_uri<Tag>::const_range_type fragment_range = uri.fragment_range();
111+
typename basic_uri<Tag>::string_type decoded_fragment;
94112
decode(fragment_range, std::back_inserter(decoded_fragment));
95113
return decoded_fragment;
96114
}

0 commit comments

Comments
 (0)