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

Commitfa84259

Browse files
committed
Merge branch 'master' of github.com:mikhailberis/cpp-netlib
2 parents98a44c8 +d19dd2b commitfa84259

File tree

82 files changed

+3114
-2114
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

82 files changed

+3114
-2114
lines changed

‎CMakeLists.txt‎

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,18 @@ cmake_minimum_required(VERSION 2.6)
77
project(CPP-NETLIB)
88
find_package( Boost 1.41.0 )
99
set(CMAKE_VERBOSE_MAKEFILEtrue)
10+
11+
if (CMAKE_BUILD_TYPEMATCHES Debug)
12+
add_definitions(-DBOOST_NETWORK_DEBUG)
13+
endif()
14+
1015
if (Boost_FOUND)
1116
set(Boost_USE_STATIC_LIBSON)
1217
set(Boost_USE_MULTI_THREADEDON)
1318
include_directories(${Boost_INCLUDE_DIRS})
1419
endif()
1520
enable_testing()
16-
add_subdirectory(libs/network/build)
21+
add_subdirectory(libs/network/src)
1722
add_subdirectory(libs/network/test)
1823
add_subdirectory(libs/mime/test)
1924
add_subdirectory(libs/network/example)

‎README.rst‎

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -167,26 +167,21 @@ repository. It is recommended that forks be made against the upstream repostory
167167
and pull requests be submitted against the upstream repository so that patches
168168
and other implementations can be curated by the original maintainer.
169169

170-
Contact andCommercialSupport
171-
------------------------------
170+
Contact and Support
171+
-------------------
172172

173173
In case you have any questions or would like to make feature requests, you can
174174
contact the development team through the `developers mailing list`_
175-
or by filing issues at http://github.com/mikhailberis/cpp-netlib/issues.
175+
or by filing issues at http://github.com/cpp-netlib/cpp-netlib/issues.
176176

177177
.. _`developers mailing list`:
178178
https://lists.sourceforge.net/lists/listinfo/cpp-netlib-devel
179179

180180
You can reach the maintainers of the project through::
181181

182-
Dean Michael Berris
183-
mikhailberis@gmail.com
182+
Dean Michael Berris (dberris@google.com)
184183

185184
Glyn Matthews
186185

187186
Mike Dickey
188187

189-
At this time, paid commercial support is available for cpp-netlib being offered
190-
by the maintainers. In case you have any questions, please feel free to contact
191-
any one of the maintainers above or anybody on the developers mailing list.
192-

‎boost/network/message.hpp‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ namespace boost { namespace network {
8383
_headers.erase(key);
8484
}
8585

86-
headers_container_type &headers()const {
86+
headers_container_typeconst&headers()const {
8787
return _headers;
8888
}
8989

@@ -95,7 +95,7 @@ namespace boost { namespace network {
9595
_body = body_;
9696
}
9797

98-
string_typebody()const {
98+
string_typeconst &body()const {
9999
return _body;
100100
}
101101

@@ -107,7 +107,7 @@ namespace boost { namespace network {
107107
_source = source_;
108108
}
109109

110-
string_typesource()const {
110+
string_typeconst &source()const {
111111
return _source;
112112
}
113113

@@ -119,7 +119,7 @@ namespace boost { namespace network {
119119
_destination = destination_;
120120
}
121121

122-
string_typedestination()const {
122+
string_typeconst &destination()const {
123123
return _destination;
124124
}
125125

‎boost/network/protocol/http/client.hpp‎

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525

2626
#include<boost/network/protocol/http/client/facade.hpp>
2727
#include<boost/network/protocol/http/client/parameters.hpp>
28+
#include<boost/network/protocol/http/client/macros.hpp>
2829

2930
namespaceboost {namespacenetwork {namespacehttp {
3031

@@ -33,7 +34,7 @@ namespace boost { namespace network { namespace http {
3334
: basic_client_facade<Tag, version_major, version_minor>
3435
{
3536
private:
36-
typedef basic_client_facade<Tag, version_major, version_minor>
37+
typedef basic_client_facade<Tag, version_major, version_minor>
3738
base_facade_type;
3839
public:
3940
typedef basic_request<Tag> request;
@@ -64,8 +65,8 @@ namespace boost { namespace network { namespace http {
6465

6566
BOOST_PARAMETER_CONSTRUCTOR(
6667
basic_client, (base_facade_type), tag,
67-
(optional
68-
(in_out(io_service), (boost::asio::io_service))
68+
(optional
69+
(in_out(io_service), (boost::asio::io_service&))
6970
(follow_redirects, (bool))
7071
(cache_resolved, (bool))
7172
(openssl_certificate, (string_type))
@@ -77,7 +78,11 @@ namespace boost { namespace network { namespace http {
7778

7879
};
7980

80-
typedef basic_client<tags::http_default_8bit_udp_resolve,1,0> client;
81+
#ifndef BOOST_NETWORK_HTTP_CLIENT_DEFAULT_TAG
82+
#defineBOOST_NETWORK_HTTP_CLIENT_DEFAULT_TAG tags::http_async_8bit_udp_resolve
83+
#endif
84+
85+
typedef basic_client<BOOST_NETWORK_HTTP_CLIENT_DEFAULT_TAG,1,1> client;
8186

8287
}// namespace http
8388

‎boost/network/protocol/http/client/async_impl.hpp‎

Lines changed: 76 additions & 69 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22
#defineBOOST_NETWORK_PROTOCOL_HTTP_CLIENT_ASYNC_IMPL_HPP_20100623
33

44
// Copyright Dean Michael Berris 2010.
5+
// Copyright 2011 Dean Michael Berris (dberris@google.com).
6+
// Copyright 2011 Google, Inc.
57
// Distributed under the Boost Software License, Version 1.0.
68
// (See accompanying file LICENSE_1_0.txt or copy at
79
// http://www.boost.org/LICENSE_1_0.txt)
@@ -13,82 +15,87 @@
1315

1416
namespaceboost {namespacenetwork {namespacehttp {
1517

18+
template<classTag,unsigned version_major,unsigned version_minor>
19+
structbasic_client_impl;
20+
21+
namespaceimpl {
1622
template<classTag,unsigned version_major,unsigned version_minor>
17-
structbasic_client_impl;
23+
structasync_client :
24+
connection_policy<Tag,version_major,version_minor>::type
25+
{
26+
typedef
27+
typename connection_policy<Tag,version_major,version_minor>::type
28+
connection_base;
29+
typedef
30+
typename resolver<Tag>::type
31+
resolver_type;
32+
typedef
33+
typename string<Tag>::type
34+
string_type;
1835

19-
namespaceimpl {
20-
template<classTag,unsigned version_major,unsigned version_minor>
21-
structasync_client :
22-
connection_policy<Tag,version_major,version_minor>::type
23-
{
24-
typedef
25-
typename connection_policy<Tag,version_major,version_minor>::type
26-
connection_base;
27-
typedef
28-
typename resolver<Tag>::type
29-
resolver_type;
30-
typedef
31-
typename string<Tag>::type
32-
string_type;
36+
typedef
37+
function<void(boost::iterator_range<charconst *>const &, system::error_codeconst &)>
38+
body_callback_function_type;
3339

34-
async_client(bool cache_resolved,bool follow_redirect, optional<string_type>const & certificate_filename, optional<string_type>const & verify_path)
35-
: connection_base(cache_resolved, follow_redirect),
36-
service_ptr(new boost::asio::io_service),
37-
service_(*service_ptr),
38-
resolver_(service_),
39-
sentinel_(new boost::asio::io_service::work(service_)),
40-
certificate_filename_(certificate_filename),
41-
verify_path_(verify_path)
42-
{
43-
connection_base::resolver_strand_.reset(new
44-
boost::asio::io_service::strand(service_));
45-
lifetime_thread_.reset(newboost::thread(
46-
boost::bind(
47-
&boost::asio::io_service::run,
48-
&service_
49-
)));
50-
}
40+
async_client(bool cache_resolved,bool follow_redirect, optional<string_type>const & certificate_filename, optional<string_type>const & verify_path)
41+
: connection_base(cache_resolved, follow_redirect),
42+
service_ptr(new boost::asio::io_service),
43+
service_(*service_ptr),
44+
resolver_(service_),
45+
sentinel_(new boost::asio::io_service::work(service_)),
46+
certificate_filename_(certificate_filename),
47+
verify_path_(verify_path)
48+
{
49+
connection_base::resolver_strand_.reset(new
50+
boost::asio::io_service::strand(service_));
51+
lifetime_thread_.reset(newboost::thread(
52+
boost::bind(
53+
&boost::asio::io_service::run,
54+
&service_
55+
)));
56+
}
5157

52-
async_client(bool cache_resolved,bool follow_redirect, boost::asio::io_service & service, optional<string_type>const & certificate_filename, optional<string_type>const & verify_path)
53-
: connection_base(cache_resolved, follow_redirect),
54-
service_ptr(0),
55-
service_(service),
56-
resolver_(service_),
57-
sentinel_(new boost::asio::io_service::work(service_)),
58-
certificate_filename_(certificate_filename),
59-
verify_path_(verify_path)
60-
{
61-
}
58+
async_client(bool cache_resolved,bool follow_redirect, boost::asio::io_service & service, optional<string_type>const & certificate_filename, optional<string_type>const & verify_path)
59+
: connection_base(cache_resolved, follow_redirect),
60+
service_ptr(0),
61+
service_(service),
62+
resolver_(service_),
63+
sentinel_(new boost::asio::io_service::work(service_)),
64+
certificate_filename_(certificate_filename),
65+
verify_path_(verify_path)
66+
{
67+
}
6268

63-
~async_client()throw ()
64-
{
65-
sentinel_.reset();
66-
if (lifetime_thread_.get()) {
67-
lifetime_thread_->join();
68-
lifetime_thread_.reset();
69-
}
70-
delete service_ptr;
71-
}
69+
~async_client()throw ()
70+
{
71+
sentinel_.reset();
72+
if (lifetime_thread_.get()) {
73+
lifetime_thread_->join();
74+
lifetime_thread_.reset();
75+
}
76+
delete service_ptr;
77+
}
7278

73-
basic_response<Tag>constrequest_skeleton(
74-
basic_request<Tag>const & request_,
75-
string_typeconst & method,
76-
bool get_body
77-
)
78-
{
79-
typename connection_base::connection_ptr connection_;
80-
connection_ =connection_base::get_connection(resolver_, request_, certificate_filename_, verify_path_);
81-
return connection_->send_request(method, request_, get_body);
82-
}
79+
basic_response<Tag>constrequest_skeleton(
80+
basic_request<Tag>const & request_,
81+
string_typeconst & method,
82+
bool get_body,
83+
body_callback_function_type callback
84+
)
85+
{
86+
typename connection_base::connection_ptr connection_;
87+
connection_ =connection_base::get_connection(resolver_, request_, certificate_filename_, verify_path_);
88+
return connection_->send_request(method, request_, get_body, callback);
89+
}
8390

84-
boost::asio::io_service * service_ptr;
85-
boost::asio::io_service & service_;
86-
resolver_type resolver_;
87-
boost::shared_ptr<boost::asio::io_service::work> sentinel_;
88-
boost::shared_ptr<boost::thread> lifetime_thread_;
89-
optional<string_type> certificate_filename_, verify_path_;
90-
};
91-
}// namespace impl
91+
boost::asio::io_service * service_ptr;
92+
boost::asio::io_service & service_;
93+
resolver_type resolver_;
94+
boost::shared_ptr<boost::asio::io_service::work> sentinel_;
95+
boost::shared_ptr<boost::thread> lifetime_thread_;
96+
optional<string_type> certificate_filename_, verify_path_;
97+
};
98+
}// namespace impl
9299

93100
}// namespace http
94101

‎boost/network/protocol/http/client/connection/async_base.hpp‎

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,9 @@ namespace boost { namespace network { namespace http { namespace impl {
2323
typedeftypename string<Tag>::type string_type;
2424
typedef basic_request<Tag> request;
2525
typedef basic_response<Tag> response;
26+
typedef
27+
function<void(iterator_range<charconst *>const &, system::error_codeconst &)>
28+
body_callback_function_type;
2629

2730
static boost::shared_ptr<async_connection_base<Tag,version_major,version_minor> >new_connection(resolve_function resolve, resolver_type & resolver,bool follow_redirect,bool https, optional<string_type> certificate_filename=optional<string_type>(), optional<string_type>const & verify_path=optional<string_type>()) {
2831
boost::shared_ptr<async_connection_base<Tag,version_major,version_minor> > temp;
@@ -39,7 +42,9 @@ namespace boost { namespace network { namespace http { namespace impl {
3942
return temp;
4043
}
4144

42-
virtual responsestart(requestconst & request, string_typeconst & method,bool get_body) = 0;
45+
virtual responsestart(requestconst & request, string_typeconst & method,bool get_body, body_callback_function_type callback) = 0;
46+
47+
virtual~async_connection_base() {}
4348

4449
};
4550

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp