File tree Expand file tree Collapse file tree 5 files changed +73
-1
lines changed
boost/network/protocol/http Expand file tree Collapse file tree 5 files changed +73
-1
lines changed Original file line number Diff line number Diff line change 1717
1818namespace boost { namespace network { namespace http {
1919
20+ namespace impl {
21+
22+ template <class Tag >
23+ struct ready_wrapper ;
24+
25+ } /* impl */
26+
2027 template <class Tag >
2128 struct async_message {
2229
@@ -137,7 +144,7 @@ namespace boost { namespace network { namespace http {
137144 mutable std::set<string_type> removed_headers;
138145 mutable boost::shared_future<string_type> body_;
139146
140- friend struct boost ::network::detail::wrapper_base <Tag, async_message<Tag> >;
147+ friend struct boost ::network::http::impl::ready_wrapper <Tag>;
141148 };
142149
143150 template <class Tag >
Original file line number Diff line number Diff line change 1+ #ifndef BOOST_NETWORK_PROTOCOL_HTTP_MESSAGE_WRAPPERS_READY_HPP_20100618
2+ #define BOOST_NETWORK_PROTOCOL_HTTP_MESSAGE_WRAPPERS_READY_HPP_20100618
3+
4+ // Copyright 2010 Dean Michael Berris.
5+ // Distributed under the Boost Software License, Version 1.0.
6+ // (See accompanying file LICENSE_1_0.txt or copy at
7+ // http://www.boost.org/LICENSE_1_0.txt)
8+
9+ #include < boost/network/detail/wrapper_base.hpp>
10+
11+ namespace boost { namespace network { namespace http {
12+
13+ template <class Tag >
14+ struct async_message ;
15+
16+ namespace impl {
17+ template <class Tag >
18+ struct ready_wrapper : boost::network::detail::wrapper_base_const<Tag, async_message<Tag> > {
19+ typedef boost::network::detail::wrapper_base_const<Tag, async_message<Tag> >
20+ wrapper_base;
21+ explicit ready_wrapper (async_message<Tag> const & message)
22+ : wrapper_base(message) {}
23+ operator bool () {
24+ return
25+ wrapper_base::_message.version_ .is_ready ()
26+ && wrapper_base::_message.status_ .is_ready ()
27+ && wrapper_base::_message.status_message_ .is_ready ()
28+ && wrapper_base::_message.headers_ .is_ready ()
29+ && wrapper_base::_message.body_ .is_ready ();
30+ }
31+ };
32+ } // namespace impl
33+
34+ template <class Tag >
35+ inline bool ready (async_message<Tag> const & message) {
36+ return impl::ready_wrapper<Tag>(message);
37+ }
38+
39+ } /* http */
40+
41+ } /* network */
42+
43+ } /* boost */
44+
45+ #endif /* BOOST_NETWORK_PROTOCOL_HTTP_MESSAGE_WRAPPERS_READY_HPP_20100618 */
Original file line number Diff line number Diff line change 3030#include < boost/network/protocol/http/message/wrappers/status_message.hpp>
3131#include < boost/network/protocol/http/message/wrappers/destination.hpp>
3232#include < boost/network/protocol/http/message/wrappers/source.hpp>
33+ #include < boost/network/protocol/http/message/wrappers/ready.hpp>
3334
3435#include < boost/network/protocol/http/message.hpp>
3536#include < boost/network/protocol/http/message/async_message.hpp>
Original file line number Diff line number Diff line change @@ -29,6 +29,7 @@ if (Boost_FOUND)
2929 url_test
3030 http_url_test
3131 utils_thread_pool
32+ http_async_message_ready
3233 )
3334 foreach (test ${TESTS} )
3435 set_source_files_properties (${test} .cpp
Original file line number Diff line number Diff line change 1+
2+ // Copyright 2010 Dean Michael Berris.
3+ // Distributed under the Boost Software License, Version 1.0.
4+ // (See accompanying file LICENSE_1_0.txt or copy at
5+ // http://www.boost.org/LICENSE_1_0.txt)
6+
7+ #define BOOST_TEST_MODULE HTTP Async Response Test
8+ #include < boost/test/unit_test.hpp>
9+ #include < boost/network/include/http/client.hpp>
10+
11+ namespace http = boost::network::http;
12+
13+ BOOST_AUTO_TEST_CASE (unready_state_response) {
14+ typedef http::basic_response<http::tags::http_async_8bit_udp_resolve> response;
15+ response r;
16+ BOOST_CHECK (!ready (r));
17+ }
18+
You can’t perform that action at this time.
0 commit comments