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

Commit5a5cff3

Browse files
committed
Squashed commit of the following:
commit e84929c5985440503b90a70aa8baf61e2cdc628fAuthor: Dean Michael Berris <dberris@google.com>Date: Fri Aug 19 19:04:54 2011 +1000 Adding Copyright information.commit 50b9c226a5c2aa7a9baed82e5021c14dd3ae9d9bAuthor: Dean Michael Berris <dberris@google.com>Date: Fri Aug 19 19:01:14 2011 +1000 Internal refactor complete, now testing can start to happen.commit 4e7349ad1fb4946b916150d5b09d2ee1748c82fbAuthor: Dean Michael Berris <dberris@google.com>Date: Fri Aug 19 17:49:13 2011 +1000 WIP: broken build because Boost 1.45 asio seems to not have support for wide strings in API.
1 parentc59dbd7 commit5a5cff3

18 files changed

+623
-676
lines changed

‎CMakeLists.txt‎

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,18 +6,24 @@
66
cmake_minimum_required(VERSION 2.6)
77
project(CPP-NETLIB)
88
find_package( Boost 1.41.0 )
9+
find_package( OpenSSL )
10+
find_package( Threads )
911
set(CMAKE_VERBOSE_MAKEFILEtrue)
1012

1113
if (CMAKE_BUILD_TYPEMATCHES Debug)
1214
add_definitions(-DBOOST_NETWORK_DEBUG)
1315
endif()
14-
1516
if (Boost_FOUND)
1617
set(Boost_USE_STATIC_LIBSON)
1718
set(Boost_USE_MULTI_THREADEDON)
1819
include_directories(${Boost_INCLUDE_DIRS})
1920
endif()
2021
enable_testing()
22+
23+
if (OPENSSL_FOUND)
24+
add_definitions(-DBOOST_NETWORK_ENABLE_HTTPS)
25+
endif()
26+
2127
add_subdirectory(libs/network/src)
2228
add_subdirectory(libs/network/test)
2329
add_subdirectory(libs/mime/test)

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

Lines changed: 54 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -8,45 +8,64 @@
88
// http://www.boost.org/LICENSE_1_0.txt)
99

1010
#include<boost/network/protocol/http/response.hpp>
11+
#include<boost/network/protocol/http/client/connection/connection_delegate_factory.hpp>
12+
#include<boost/network/protocol/http/traits/delegate_factory.hpp>
1113
#include<boost/network/protocol/http/client/connection/async_normal.hpp>
12-
#ifdef BOOST_NETWORK_ENABLE_HTTPS
13-
#include<boost/network/protocol/http/client/connection/async_ssl.hpp>
14-
#endif
1514

1615
namespaceboost {namespacenetwork {namespacehttp {namespaceimpl {
1716

18-
template<classTag,unsigned version_major,unsigned version_minor>
19-
structasync_connection_base {
20-
typedeftypename resolver_policy<Tag>::type resolver_base;
21-
typedeftypename resolver_base::resolver_type resolver_type;
22-
typedeftypename resolver_base::resolve_function resolve_function;
23-
typedeftypename string<Tag>::type string_type;
24-
typedef basic_request<Tag> request;
25-
typedef basic_response<Tag> response;
26-
typedef
27-
function<void(iterator_range<charconst *>const &, system::error_codeconst &)>
28-
body_callback_function_type;
29-
30-
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>()) {
31-
boost::shared_ptr<async_connection_base<Tag,version_major,version_minor> > temp;
32-
if (https) {
33-
#ifdef BOOST_NETWORK_ENABLE_HTTPS
34-
temp.reset(new https_async_connection<Tag,version_major,version_minor>(resolver, resolve, follow_redirect, certificate_filename, verify_path));
35-
return temp;
36-
#else
37-
throwstd::runtime_error("HTTPS not supported.");
38-
#endif
39-
}
40-
temp.reset(new http_async_connection<Tag,version_major,version_minor>(resolver, resolve, follow_redirect));
41-
assert(temp.get() !=0);
42-
return temp;
43-
}
44-
45-
virtual responsestart(requestconst & request, string_typeconst & method,bool get_body, body_callback_function_type callback) = 0;
46-
47-
virtual~async_connection_base() {}
48-
49-
};
17+
template<classTag,unsigned version_major,unsigned version_minor>
18+
structasync_connection_base {
19+
typedef async_connection_base<Tag,version_major,version_minor> this_type;
20+
typedeftypename resolver_policy<Tag>::type resolver_base;
21+
typedeftypename resolver_base::resolver_type resolver_type;
22+
typedeftypename resolver_base::resolve_function resolve_function;
23+
typedeftypename string<Tag>::type string_type;
24+
typedef basic_request<Tag> request;
25+
typedef basic_response<Tag> response;
26+
typedef iterator_range<charconst *> char_const_range;
27+
typedef function<void(char_const_rangeconst &, system::error_codeconst &)>
28+
body_callback_function_type;
29+
typedef shared_ptr<this_type> connection_ptr;
30+
31+
// This is the factory function which constructs the appropriate async
32+
// connection implementation with the correct delegate chosen based on the
33+
// tag.
34+
static connection_ptrnew_connection(
35+
resolve_function resolve,
36+
resolver_type & resolver,
37+
bool follow_redirect,
38+
bool https,
39+
optional<string_type> certificate_filename=optional<string_type>(),
40+
optional<string_type>const & verify_path=optional<string_type>()) {
41+
typedef http_async_connection<Tag,version_major,version_minor>
42+
async_connection;
43+
typedeftypename delegate_factory<Tag>::type delegate_factory_type;
44+
connection_ptr temp;
45+
temp.reset(
46+
newasync_connection(
47+
resolver,
48+
resolve,
49+
follow_redirect,
50+
delegate_factory_type::new_connection_delegate(
51+
resolver.get_io_service(),
52+
https,
53+
certificate_filename,
54+
verify_path)));
55+
BOOST_ASSERT(temp.get() !=0);
56+
return temp;
57+
}
58+
59+
// This is the pure virtual entry-point for all asynchronous connections.
60+
virtual responsestart(
61+
requestconst & request,
62+
string_typeconst & method,
63+
bool get_body,
64+
body_callback_function_type callback) = 0;
65+
66+
virtual~async_connection_base() {}
67+
68+
};
5069

5170
}// namespace impl
5271

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp