| 1 | // |
| 2 | // Copyright (c) 2023 Mohammad Nejati |
| 3 | // |
| 4 | // Distributed under the Boost Software License, Version 1.0. (See accompanying |
| 5 | // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) |
| 6 | // |
| 7 | |
| 8 | #include <boost/asio/deferred.hpp> |
| 9 | #include <boost/asio/ip/tcp.hpp> |
| 10 | #include <boost/beast/http.hpp> |
| 11 | |
| 12 | using namespace boost; |
| 13 | namespace http = boost::beast::http; |
| 14 | |
| 15 | #if !defined(BOOST_NO_CXX14) |
| 16 | |
| 17 | // just compile this. |
| 18 | void test_deferred_for_http( |
| 19 | asio::ip::tcp::socket & stream, |
| 20 | beast::flat_static_buffer_base & buf, |
| 21 | http::basic_parser<true> & parser, |
| 22 | http::serializer<true, http::empty_body> & ser, |
| 23 | http::message<false, http::empty_body> & msg) |
| 24 | { |
| 25 | (void)http::async_read(stream, buffer&: buf, parser, handler: asio::deferred); |
| 26 | (void)http::async_read(stream, buffer&: buf, msg, handler: asio::deferred); |
| 27 | (void)http::async_read_some(stream, buffer&: buf, parser, handler: asio::deferred); |
| 28 | (void)http::async_read_header(stream, buffer&: buf, parser, handler: asio::deferred); |
| 29 | |
| 30 | (void)http::async_write(stream, sr&: ser, handler: asio::deferred); |
| 31 | (void)http::async_write(stream, msg, handler: asio::deferred); |
| 32 | (void)http::async_write_header(stream, sr&: ser, handler: asio::deferred); |
| 33 | (void)http::async_write_some(stream, sr&: ser, handler: asio::deferred); |
| 34 | } |
| 35 | |
| 36 | #endif |
| 37 | |