Skip to content

Commit 242db42

Browse files
committed
Merge branch 'boost_future' into boost_future_master
2 parents 090e18b + 9835d24 commit 242db42

24 files changed

+131
-77
lines changed

CMakeLists.txt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ add_definitions(-DBOOST_TEST_DYN_LINK)
4545
# Always use multi-threaded Boost libraries.
4646
set(Boost_USE_MULTI_THREADED ON)
4747

48-
find_package(Boost 1.58.0 REQUIRED COMPONENTS system)
48+
find_package(Boost 1.58.0 REQUIRED COMPONENTS system thread)
4949

5050
if (CPP-NETLIB_ENABLE_HTTPS)
5151
if (APPLE)
@@ -135,6 +135,8 @@ endif()
135135

136136
enable_testing()
137137

138+
set(CPP-NETLIB_LIBRARIES ${Boost_LIBRARIES} CACHE INTERNAL "Dependent libraries for header-only use")
139+
138140
install(DIRECTORY boost DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})
139141

140142
# ###

boost/network/message/directives/detail/string_value.hpp

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

9-
#include <future>
109
#include <boost/network/traits/string.hpp>
1110
#include <boost/network/support/is_async.hpp>
1211
#include <boost/network/support/is_sync.hpp>
12+
#include <boost/thread/future.hpp>
1313
#include <boost/type_traits/is_same.hpp>
1414
#include <boost/mpl/if.hpp>
1515
#include <boost/mpl/or.hpp>
@@ -20,7 +20,7 @@ namespace detail {
2020

2121
template <class Tag>
2222
struct string_value
23-
: mpl::if_<is_async<Tag>, std::shared_future<typename string<Tag>::type>,
23+
: mpl::if_<is_async<Tag>, boost::shared_future<typename string<Tag>::type>,
2424
typename mpl::if_<
2525
mpl::or_<is_sync<Tag>, is_same<Tag, tags::default_string>,
2626
is_same<Tag, tags::default_wstring> >,

boost/network/message/modifiers/clear_headers.hpp

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

9-
#include <future>
109
#include <boost/mpl/and.hpp>
1110
#include <boost/mpl/not.hpp>
1211
#include <boost/network/support/is_async.hpp>
1312
#include <boost/network/support/is_pod.hpp>
13+
#include <boost/thread/future.hpp>
1414
#include <boost/utility/enable_if.hpp>
1515

1616
namespace boost {
@@ -34,8 +34,8 @@ template <class Message, class Tag>
3434
inline typename enable_if<mpl::and_<mpl::not_<is_pod<Tag> >, is_async<Tag> >,
3535
void>::type
3636
clear_headers(Message const &message, Tag const &) {
37-
std::promise<typename Message::headers_container_type> header_promise;
38-
std::shared_future<typename Message::headers_container_type> headers_future(
37+
boost::promise<typename Message::headers_container_type> header_promise;
38+
boost::shared_future<typename Message::headers_container_type> headers_future(
3939
header_promise.get_future());
4040
message.headers(headers_future);
4141
header_promise.set_value(typename Message::headers_container_type());

boost/network/message/traits/body.hpp

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

11-
#include <future>
1211
#include <boost/mpl/if.hpp>
1312
#include <boost/network/support/is_async.hpp>
1413
#include <boost/network/support/is_sync.hpp>
1514
#include <boost/network/tags.hpp>
1615
#include <boost/network/traits/string.hpp>
16+
#include <boost/thread/future.hpp>
1717
#include <boost/type_traits/is_same.hpp>
1818

1919
namespace boost {
@@ -27,7 +27,7 @@ template <class Message>
2727
struct body
2828
: mpl::if_<
2929
is_async<typename Message::tag>,
30-
std::shared_future<typename string<typename Message::tag>::type>,
30+
boost::shared_future<typename string<typename Message::tag>::type>,
3131
typename mpl::if_<
3232
mpl::or_<is_sync<typename Message::tag>,
3333
is_same<typename Message::tag,

boost/network/message/traits/destination.hpp

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

10-
#include <future>
1110
#include <boost/mpl/if.hpp>
1211
#include <boost/network/support/is_async.hpp>
1312
#include <boost/network/support/is_sync.hpp>
1413
#include <boost/network/tags.hpp>
1514
#include <boost/network/traits/string.hpp>
15+
#include <boost/thread/future.hpp>
1616
#include <boost/type_traits/is_same.hpp>
1717

1818
namespace boost {
@@ -26,7 +26,7 @@ struct unsupported_tag;
2626
template <class Message>
2727
struct destination
2828
: mpl::if_<is_async<typename Message::tag>,
29-
std::shared_future<typename string<typename Message::tag>::type>,
29+
boost::shared_future<typename string<typename Message::tag>::type>,
3030
typename mpl::if_<
3131
mpl::or_<is_sync<typename Message::tag>,
3232
is_same<typename Message::tag,

boost/network/message/traits/headers.hpp

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

10-
#include <future>
1110
#include <boost/mpl/if.hpp>
1211
#include <boost/mpl/or.hpp>
1312
#include <boost/network/message/directives.hpp>
1413
#include <boost/network/message/transformers.hpp>
1514
#include <boost/network/message/wrappers.hpp>
1615
#include <boost/network/support/is_async.hpp>
1716
#include <boost/network/support/is_sync.hpp>
17+
#include <boost/thread/future.hpp>
1818

1919
namespace boost {
2020
namespace network {
@@ -28,7 +28,7 @@ template <class Message>
2828
struct header_key
2929
: mpl::if_<
3030
is_async<typename Message::tag>,
31-
std::shared_future<typename string<typename Message::tag>::type>,
31+
boost::shared_future<typename string<typename Message::tag>::type>,
3232
typename mpl::if_<
3333
mpl::or_<is_sync<typename Message::tag>,
3434
is_same<typename Message::tag, tags::default_string>,
@@ -40,7 +40,7 @@ template <class Message>
4040
struct header_value
4141
: mpl::if_<
4242
is_async<typename Message::tag>,
43-
std::shared_future<typename string<typename Message::tag>::type>,
43+
boost::shared_future<typename string<typename Message::tag>::type>,
4444
typename mpl::if_<
4545
mpl::or_<is_sync<typename Message::tag>,
4646
is_same<typename Message::tag, tags::default_string>,

boost/network/message/traits/source.hpp

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

9-
#include <future>
109
#include <boost/mpl/if.hpp>
1110
#include <boost/network/support/is_async.hpp>
1211
#include <boost/network/support/is_sync.hpp>
1312
#include <boost/network/tags.hpp>
1413
#include <boost/network/traits/string.hpp>
14+
#include <boost/thread/future.hpp>
1515
#include <boost/type_traits/is_same.hpp>
1616

1717
namespace boost {
@@ -24,7 +24,7 @@ struct unsupported_tag;
2424
template <class Message>
2525
struct source
2626
: mpl::if_<is_async<typename Message::tag>,
27-
std::shared_future<typename string<typename Message::tag>::type>,
27+
boost::shared_future<typename string<typename Message::tag>::type>,
2828
typename mpl::if_<
2929
mpl::or_<is_sync<typename Message::tag>,
3030
is_same<typename Message::tag,

boost/network/protocol/http/client/connection/async_normal.hpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@ struct http_async_connection
6161
typedef typename base::string_type string_type;
6262
typedef typename base::request request;
6363
typedef typename base::resolver_base::resolve_function resolve_function;
64+
typedef typename base::char_const_range char_const_range;
6465
typedef
6566
typename base::body_callback_function_type body_callback_function_type;
6667
typedef

boost/network/protocol/http/client/connection/async_protocol_handler.hpp

Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
#include <boost/network/protocol/http/parser/incremental.hpp>
1818
#include <boost/network/protocol/http/request_parser.hpp>
1919
#include <boost/network/traits/string.hpp>
20+
#include <boost/thread/future.hpp>
2021

2122
namespace boost {
2223
namespace network {
@@ -57,30 +58,30 @@ struct http_async_protocol_handler {
5758
// TODO(dberris): review parameter necessity.
5859
(void)get_body;
5960

60-
std::shared_future<string_type> source_future(
61+
boost::shared_future<string_type> source_future(
6162
source_promise.get_future());
6263
source(response_, source_future);
6364

64-
std::shared_future<string_type> destination_future(
65+
boost::shared_future<string_type> destination_future(
6566
destination_promise.get_future());
6667
destination(response_, destination_future);
6768

68-
std::shared_future<typename headers_container<Tag>::type> headers_future(
69+
boost::shared_future<typename headers_container<Tag>::type> headers_future(
6970
headers_promise.get_future());
7071
headers(response_, headers_future);
7172

72-
std::shared_future<string_type> body_future(body_promise.get_future());
73+
boost::shared_future<string_type> body_future(body_promise.get_future());
7374
body(response_, body_future);
7475

75-
std::shared_future<string_type> version_future(
76+
boost::shared_future<string_type> version_future(
7677
version_promise.get_future());
7778
version(response_, version_future);
7879

79-
std::shared_future<std::uint16_t> status_future(
80+
boost::shared_future<std::uint16_t> status_future(
8081
status_promise.get_future());
8182
status(response_, status_future);
8283

83-
std::shared_future<string_type> status_message_future(
84+
boost::shared_future<string_type> status_message_future(
8485
status_message_promise.get_future());
8586
status_message(response_, status_message_future);
8687
}
@@ -339,13 +340,13 @@ struct http_async_protocol_handler {
339340
typedef std::array<typename char_<Tag>::type, 1024> buffer_type;
340341

341342
response_parser_type response_parser_;
342-
std::promise<string_type> version_promise;
343-
std::promise<std::uint16_t> status_promise;
344-
std::promise<string_type> status_message_promise;
345-
std::promise<typename headers_container<Tag>::type> headers_promise;
346-
std::promise<string_type> source_promise;
347-
std::promise<string_type> destination_promise;
348-
std::promise<string_type> body_promise;
343+
boost::promise<string_type> version_promise;
344+
boost::promise<std::uint16_t> status_promise;
345+
boost::promise<string_type> status_message_promise;
346+
boost::promise<typename headers_container<Tag>::type> headers_promise;
347+
boost::promise<string_type> source_promise;
348+
boost::promise<string_type> destination_promise;
349+
boost::promise<string_type> body_promise;
349350
buffer_type part;
350351
typename buffer_type::const_iterator part_begin;
351352
string_type partial_parsed;

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,9 @@ class basic_client_facade {
3434
/** The response type. This models the HTTP Response concept.*/
3535
typedef basic_response<Tag> response;
3636

37+
typedef typename std::array<typename char_<Tag>::type, 1024>::const_iterator const_iterator;
38+
typedef iterator_range<const_iterator> char_const_range;
39+
3740
/**
3841
* This callback is invoked with a range representing part of the response's
3942
* body as it comes in. In case of errors, the second argument is an error

0 commit comments

Comments
 (0)