Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit9ab0cac

Browse files
committed
Merge branch '0.9-devel' of github.com:deanberris/cpp-netlib into canonical-0.9-devel
Conflicts:libs/network/example/CMakeLists.txtlibs/network/test/CMakeLists.txtlibs/network/test/http/CMakeLists.txtlibs/network/test/uri/CMakeLists.txt
2 parents79d3fd6 +cd5b003 commit9ab0cac

36 files changed

+812
-1540
lines changed

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

Lines changed: 12 additions & 6 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/http/uri.hpp>
18+
#include<boost/network/uri/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
structbasic_request :publicbasic_message<Tag>
5151
{
5252

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

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

8282
voidswap(basic_request & other) {
83-
using boost::network::uri::swap;
8483
base_type &base_ref(other);
8584
basic_request<Tag> &this_ref(*this);
8685
base_ref.swap(this_ref);
87-
swap(other.uri_,this->uri_);
86+
boost::swap(other.uri_,this->uri_);
8887
}
8988

9089
string_typeconsthost()const {
9190
return uri_.host();
9291
}
9392

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

98104
string_typeconstpath()const {
@@ -115,7 +121,7 @@ namespace http {
115121
uri_ = new_uri;
116122
}
117123

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

‎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-
returnport_us(message_.uri());
33+
returnuri::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/http/uri.hpp>
10+
#include<boost/network/uri/uri.hpp>
1111

1212
namespaceboost {namespacenetwork {namespacehttp {
1313

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

4141
}// namespace network
4242

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

4545
#endif// BOOST_NETWORK_PROTOCOL_HTTP_MESSAGE_WRAPPERS_URI_HPP_20100620

‎boost/network/uri.hpp‎

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -6,24 +6,7 @@
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>
109
#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-
namespaceboost {namespacenetwork {namespaceuri {
16-
17-
typedef basic_uri<boost::network::tags::default_string> uri;
18-
typedef basic_uri<boost::network::tags::default_wstring> wuri;
19-
20-
namespacehttp {
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
2710

2811
#endif
2912

‎boost/network/uri/accessors.hpp‎

Lines changed: 25 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -12,21 +12,19 @@
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>
1516

1617

1718
namespaceboost {
1819
namespacenetwork {
1920
namespaceuri {
2021
namespacedetails {
2122
template<
22-
typename Uri,
2323
typename Map
2424
>
2525
structkey_value_sequence
26-
: spirit::qi::grammar<typename Uri::const_iterator_type, Map()>
26+
: spirit::qi::grammar<uri::const_iterator, Map()>
2727
{
28-
typedeftypename Uri::const_iterator_type const_iterator_type;
29-
3028
key_value_sequence()
3129
: key_value_sequence::base_type(query)
3230
{
@@ -36,79 +34,63 @@ struct key_value_sequence
3634
value = +spirit::qi::char_("a-zA-Z_0-9/%");
3735
}
3836

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,typenameUri::string_type()> key, value;
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,typenamestd::string()> key, value;
4240
};
4341
}// namespace details
4442

4543
template<
46-
classTag,
4744
classMap
4845
>
4946
inline
50-
Map &query_map(constbasic_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;
47+
Map &query_map(consturi &uri_, Map &map) {
48+
uri::const_range_type range =uri_.query_range();
49+
details::key_value_sequence<Map> parser;
5350
spirit::qi::parse(boost::begin(range),boost::end(range), parser, map);
5451
return map;
5552
}
5653

57-
template<
58-
classTag
59-
>
60-
typename basic_uri<Tag>::string_typeusername(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_typeit(boost::begin(user_info_range)),end(boost::end(user_info_range));
54+
std::stringusername(const uri &uri_) {
55+
uri::const_range_type user_info_range = uri_.user_info_range();
56+
uri::const_iteratorit(boost::begin(user_info_range)),end(boost::end(user_info_range));
6357
for (; it != end; ++it) {
6458
if (*it ==':') {
6559
break;
6660
}
6761
}
68-
returntypename string<Tag>::type(boost::begin(user_info_range), it);
62+
returnstd::string(boost::begin(user_info_range), it);
6963
}
7064

71-
template<
72-
classTag
73-
>
74-
typename basic_uri<Tag>::string_typepassword(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_typeit(boost::begin(user_info_range)),end(boost::end(user_info_range));
65+
std::stringpassword(const uri &uri_) {
66+
uri::const_range_type user_info_range = uri_.user_info_range();
67+
uri::const_iteratorit(boost::begin(user_info_range)),end(boost::end(user_info_range));
7768
for (; it != end; ++it) {
7869
if (*it ==':') {
7970
++it;
8071
break;
8172
}
8273
}
83-
returntypename string<Tag>::type(it,boost::end(user_info_range));
74+
returnstd::string(it,boost::end(user_info_range));
8475
}
8576

86-
template<
87-
classTag
88-
>
89-
typename basic_uri<Tag>::string_typedecoded_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;
77+
std::stringdecoded_path(const uri &uri_) {
78+
uri::const_range_type path_range = uri_.path_range();
79+
std::string decoded_path;
9280
decode(path_range,std::back_inserter(decoded_path));
9381
return decoded_path;
9482
}
9583

96-
template<
97-
classTag
98-
>
99-
typename basic_uri<Tag>::string_typedecoded_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;
84+
std::stringdecoded_query(const uri &uri_) {
85+
uri::const_range_type query_range = uri_.query_range();
86+
std::string decoded_query;
10287
decode(query_range,std::back_inserter(decoded_query));
10388
return decoded_query;
10489
}
10590

106-
template<
107-
classTag
108-
>
109-
typename basic_uri<Tag>::string_typedecoded_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;
91+
std::stringdecoded_fragment(const uri &uri_) {
92+
uri::const_range_type fragment_range = uri_.fragment_range();
93+
std::string decoded_fragment;
11294
decode(fragment_range,std::back_inserter(decoded_fragment));
11395
return decoded_fragment;
11496
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp