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

Commitf2970a7

Browse files
committed
Merge branch 'master' of github.com:cpp-netlib/cpp-netlib into http-client-refactoring
Conflicts:.gitignoreboost/network/protocol/http/client/connection/async_normal.hppboost/network/protocol/http/message.hppboost/network/protocol/http/traits/impl/content.ippboost/network/protocol/http/traits/impl/delimiters.ippboost/network/protocol/http/traits/impl/headers.ippboost/network/protocol/http/traits/impl/request_methods.ippboost/network/protocol/http/traits/impl/response_message.ippboost/network/uri/uri.hppboost/network/utils/thread_pool.hpplibs/network/example/CMakeLists.txtlibs/network/test/http/client_get_test.cpplibs/network/test/uri/url_test.cpp
2 parents335dd84 +52e7797 commitf2970a7

File tree

24 files changed

+947
-174
lines changed

24 files changed

+947
-174
lines changed

‎.gitignore‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,4 @@ libs/mime/test/mime-roundtrip
1010
*.a
1111
bin/
1212
tests/
13-
example/
13+
_build

‎boost/network/protocol/http/impl/message.ipp‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ namespace boost { namespace network { namespace http {
129129
}
130130

131131
template<typename Tag>
132-
boolconstmessage_impl<Tag>::base64_decode(consttypename message_impl<Tag>::string_type &input,typename message_impl<Tag>::string_type &output)
132+
bool message_impl<Tag>::base64_decode(consttypename message_impl<Tag>::string_type &input,typename message_impl<Tag>::string_type &output)
133133
{
134134
staticconstchar nop = -1;
135135
staticconstchar decoding_data[] = {
@@ -210,7 +210,7 @@ namespace boost { namespace network { namespace http {
210210
}
211211

212212
template<typename Tag>
213-
boolconstmessage_impl<Tag>::base64_encode(typename message_impl<Tag>::string_typeconst & input,typename message_impl<Tag>::string_type & output)
213+
bool message_impl<Tag>::base64_encode(typename message_impl<Tag>::string_typeconst & input,typename message_impl<Tag>::string_type & output)
214214
{
215215
staticconstchar encoding_data[] =
216216
"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";

‎boost/network/protocol/http/message/async_message.hpp‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ namespace boost { namespace network { namespace http {
7070
version_ = future;
7171
}
7272

73-
boost::uint16_tconststatus()const {
73+
boost::uint16_tstatus()const {
7474
return status_.get();
7575
}
7676

‎boost/network/protocol/http/server/storage_base.hpp‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ namespace boost { namespace network { namespace http {
1515
structhas_io_service {};
1616
protected:
1717
template<classArgPack>
18-
server_storage_base(ArgPackconst & args, no_io_service)
18+
server_storage_base(ArgPackconst &/*args*/, no_io_service)
1919
: self_service_(new boost::asio::io_service())
2020
, service_(*self_service_)
2121
{}

‎boost/network/uri/accessors.hpp‎

Lines changed: 23 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,10 @@ template <
2525
structkey_value_sequence
2626
: spirit::qi::grammar<uri::const_iterator, Map()>
2727
{
28+
typedeftypename Map::key_type key_type;
29+
typedeftypename Map::mapped_type mapped_type;
30+
typedef std::pair<key_type, mapped_type> pair_type;
31+
2832
key_value_sequence()
2933
: key_value_sequence::base_type(query)
3034
{
@@ -35,8 +39,9 @@ struct key_value_sequence
3539
}
3640

3741
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;
42+
spirit::qi::rule<uri::const_iterator, pair_type()> pair;
43+
spirit::qi::rule<uri::const_iterator, key_type()> key;
44+
spirit::qi::rule<uri::const_iterator, mapped_type()> value;
4045
};
4146
}// namespace details
4247

@@ -45,57 +50,57 @@ template <
4550
>
4651
inline
4752
Map &query_map(const uri &uri_, Map &map) {
48-
conststd::string range = uri_.query();
53+
consturi::string_type range = uri_.query();
4954
details::key_value_sequence<Map> parser;
5055
spirit::qi::parse(boost::begin(range),boost::end(range), parser, map);
5156
return map;
5257
}
5358

5459
inline
55-
std::stringusername(const uri &uri_) {
56-
conststd::string user_info = uri_.user_info();
60+
uri::string_typeusername(const uri &uri_) {
61+
consturi::string_type user_info = uri_.user_info();
5762
uri::const_iteratorit(boost::begin(user_info)),end(boost::end(user_info));
5863
for (; it != end; ++it) {
5964
if (*it ==':') {
6065
break;
6166
}
6267
}
63-
returnstd::string(boost::begin(user_info), it);
68+
returnuri::string_type(boost::begin(user_info), it);
6469
}
6570

6671
inline
67-
std::stringpassword(const uri &uri_) {
68-
conststd::string user_info = uri_.user_info();
72+
uri::string_typepassword(const uri &uri_) {
73+
consturi::string_type user_info = uri_.user_info();
6974
uri::const_iteratorit(boost::begin(user_info)),end(boost::end(user_info));
7075
for (; it != end; ++it) {
7176
if (*it ==':') {
7277
++it;
7378
break;
7479
}
7580
}
76-
returnstd::string(it,boost::end(user_info));
81+
returnuri::string_type(it,boost::end(user_info));
7782
}
7883

7984
inline
80-
std::stringdecoded_path(const uri &uri_) {
81-
conststd::string path = uri_.path();
82-
std::string decoded_path;
85+
uri::string_typedecoded_path(const uri &uri_) {
86+
consturi::string_type path = uri_.path();
87+
uri::string_type decoded_path;
8388
decode(path,std::back_inserter(decoded_path));
8489
return decoded_path;
8590
}
8691

8792
inline
88-
std::stringdecoded_query(const uri &uri_) {
89-
conststd::string query = uri_.query();
90-
std::string decoded_query;
93+
uri::string_typedecoded_query(const uri &uri_) {
94+
consturi::string_type query = uri_.query();
95+
uri::string_type decoded_query;
9196
decode(query,std::back_inserter(decoded_query));
9297
return decoded_query;
9398
}
9499

95100
inline
96-
std::stringdecoded_fragment(const uri &uri_) {
97-
conststd::string fragment = uri_.fragment();
98-
std::string decoded_fragment;
101+
uri::string_typedecoded_fragment(const uri &uri_) {
102+
consturi::string_type fragment = uri_.fragment();
103+
uri::string_type decoded_fragment;
99104
decode(fragment,std::back_inserter(decoded_fragment));
100105
return decoded_fragment;
101106
}

‎boost/network/uri/builder.hpp‎

Lines changed: 118 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,118 @@
1+
// Copyright (c) Glyn Matthews 2012.
2+
// Distributed under the Boost Software License, Version 1.0.
3+
// (See accompanying file LICENSE_1_0.txt or copy at
4+
// http://www.boost.org/LICENSE_1_0.txt)
5+
6+
7+
#ifndef __BOOST_NETWORK_URI_BUILDER_INC__
8+
#define__BOOST_NETWORK_URI_BUILDER_INC__
9+
10+
11+
#include<boost/network/uri/uri.hpp>
12+
13+
14+
namespaceboost {
15+
namespacenetwork {
16+
namespaceuri {
17+
classbuilder {
18+
19+
typedef uri::string_type string_type;
20+
21+
public:
22+
23+
builder(uri &uri_)
24+
: uri_(uri_) {
25+
26+
}
27+
28+
builder &scheme(const string_type &scheme) {
29+
uri_.uri_.append(scheme);
30+
if (opaque_schemes::exists(scheme)) {
31+
uri_.uri_.append(":");
32+
}
33+
else {
34+
uri_.uri_.append("://");
35+
}
36+
uri_.parse();
37+
return *this;
38+
}
39+
40+
builder &user_info(const string_type &user_info) {
41+
uri_.uri_.append(user_info);
42+
uri_.uri_.append("@");
43+
uri_.parse();
44+
return *this;
45+
}
46+
47+
builder &host(const string_type &host) {
48+
uri_.uri_.append(host);
49+
uri_.parse();
50+
return *this;
51+
}
52+
53+
builder &port(const string_type &port) {
54+
uri_.uri_.append(":");
55+
uri_.uri_.append(port);
56+
uri_.parse();
57+
return *this;
58+
}
59+
60+
builder &port(uint16_t port) {
61+
returnthis->port(boost::lexical_cast<string_type>(port));
62+
}
63+
64+
builder &path(const string_type &path) {
65+
uri_.uri_.append(path);
66+
uri_.parse();
67+
return *this;
68+
}
69+
70+
builder &encoded_path(const string_type &path) {
71+
string_type encoded_path;
72+
encode(path,std::back_inserter(encoded_path));
73+
uri_.uri_.append(encoded_path);
74+
uri_.parse();
75+
return *this;
76+
}
77+
78+
builder &query(const string_type &query) {
79+
uri_.uri_.append("?");
80+
uri_.uri_.append(query);
81+
uri_.parse();
82+
return *this;
83+
}
84+
85+
builder &query(const string_type &key,const string_type &value) {
86+
if (!uri_.query_range())
87+
{
88+
uri_.uri_.append("?");
89+
}
90+
else
91+
{
92+
uri_.uri_.append("&");
93+
}
94+
uri_.uri_.append(key);
95+
uri_.uri_.append("=");
96+
uri_.uri_.append(value);
97+
uri_.parse();
98+
return *this;
99+
}
100+
101+
builder &fragment(const string_type &fragment) {
102+
uri_.uri_.append("#");
103+
uri_.uri_.append(fragment);
104+
uri_.parse();
105+
return *this;
106+
}
107+
108+
private:
109+
110+
uri &uri_;
111+
112+
};
113+
}// namespace uri
114+
}// namespace network
115+
}// namespace boost
116+
117+
118+
#endif// __BOOST_NETWORK_URI_BUILDER_INC__

‎boost/network/uri/config.hpp‎

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
// Copyright (c) Glyn Matthews 2012.
2+
// Distributed under the Boost Software License, Version 1.0.
3+
// (See accompanying file LICENSE_1_0.txt or copy at
4+
// http://www.boost.org/LICENSE_1_0.txt)
5+
6+
7+
#ifndef __BOOST_NETWORK_URI_CONFIG_INC__
8+
#define__BOOST_NETWORK_URI_CONFIG_INC__
9+
10+
11+
#include<boost/config.hpp>
12+
#include<boost/detail/workaround.hpp>
13+
14+
#if defined(BOOST_ALL_DYN_LINK) || defined(BOOST_URI_DYN_LINK)
15+
#defineBOOST_URI_DECL
16+
#else
17+
#defineBOOST_URI_DECL
18+
#endif// defined(BOOST_ALL_DYN_LINK) || defined(BOOST_URI_DYN_LINK)
19+
20+
21+
#endif// __BOOST_NETWORK_URI_CONFIG_INC__

‎boost/network/uri/detail/uri_parts.hpp‎

Lines changed: 58 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,43 @@ struct hierarchical_part {
2323
optional<iterator_range<FwdIter> > host;
2424
optional<iterator_range<FwdIter> > port;
2525
optional<iterator_range<FwdIter> > path;
26+
27+
FwdIterbegin()const {
28+
returnboost::begin(user_info);
29+
}
30+
31+
FwdIterend()const {
32+
returnboost::end(path);
33+
}
34+
35+
voidupdate() {
36+
if (!user_info) {
37+
if (host) {
38+
user_info = iterator_range<FwdIter>(boost::begin(host.get()),
39+
boost::begin(host.get()));
40+
}
41+
elseif (path) {
42+
user_info = iterator_range<FwdIter>(boost::begin(path.get()),
43+
boost::begin(path.get()));
44+
}
45+
}
46+
47+
if (!host) {
48+
host = iterator_range<FwdIter>(boost::begin(path.get()),
49+
boost::begin(path.get()));
50+
}
51+
52+
if (!port) {
53+
port = iterator_range<FwdIter>(boost::end(host.get()),
54+
boost::end(host.get()));
55+
}
56+
57+
if (!path) {
58+
path = iterator_range<FwdIter>(boost::end(port.get()),
59+
boost::end(port.get()));
60+
}
61+
}
62+
2663
};
2764

2865
template<
@@ -34,14 +71,27 @@ struct uri_parts {
3471
optional<iterator_range<FwdIter> > query;
3572
optional<iterator_range<FwdIter> > fragment;
3673

37-
voidclear() {
38-
scheme = iterator_range<FwdIter>();
39-
hier_part.user_info = optional<iterator_range<FwdIter> >();
40-
hier_part.host = optional<iterator_range<FwdIter> >();
41-
hier_part.port = optional<iterator_range<FwdIter> >();
42-
hier_part.path = optional<iterator_range<FwdIter> >();
43-
query = optional<iterator_range<FwdIter> >();
44-
fragment = optional<iterator_range<FwdIter> >();
74+
FwdIterbegin()const {
75+
returnboost::begin(scheme);
76+
}
77+
78+
FwdIterend()const {
79+
returnboost::end(fragment);
80+
}
81+
82+
voidupdate() {
83+
84+
hier_part.update();
85+
86+
if (!query) {
87+
query = iterator_range<FwdIter>(boost::end(hier_part.path.get()),
88+
boost::end(hier_part.path.get()));
89+
}
90+
91+
if (!fragment) {
92+
fragment = iterator_range<FwdIter>(boost::end(query.get()),
93+
boost::end(query.get()));
94+
}
4595
}
4696
};
4797
}// namespace detail

‎boost/network/uri/directives.hpp‎

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,6 @@
99

1010

1111
#include<boost/network/uri/uri.hpp>
12-
#include<boost/network/uri/directives/scheme.hpp>
13-
#include<boost/network/uri/directives/user_info.hpp>
14-
#include<boost/network/uri/directives/host.hpp>
15-
#include<boost/network/uri/directives/port.hpp>
16-
#include<boost/network/uri/directives/authority.hpp>
17-
#include<boost/network/uri/directives/path.hpp>
18-
#include<boost/network/uri/directives/query.hpp>
19-
#include<boost/network/uri/directives/fragment.hpp>
2012

2113

2214
namespaceboost {
@@ -43,4 +35,14 @@ uri &operator << (uri &uri_, const Directive &directive) {
4335
}// namespace boost
4436

4537

38+
#include<boost/network/uri/directives/scheme.hpp>
39+
#include<boost/network/uri/directives/user_info.hpp>
40+
#include<boost/network/uri/directives/host.hpp>
41+
#include<boost/network/uri/directives/port.hpp>
42+
#include<boost/network/uri/directives/authority.hpp>
43+
#include<boost/network/uri/directives/path.hpp>
44+
#include<boost/network/uri/directives/query.hpp>
45+
#include<boost/network/uri/directives/fragment.hpp>
46+
47+
4648
#endif// __BOOST_NETWORK_URI_DIRECTIVES_INC__

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp