Imported Upstream version 1.72.0
[platform/upstream/boost.git] / boost / beast / http / write.hpp
index b4d7410..be582fb 100644 (file)
 #define BOOST_BEAST_HTTP_WRITE_HPP
 
 #include <boost/beast/core/detail/config.hpp>
-#include <boost/beast/core/buffers_cat.hpp>
-#include <boost/beast/core/buffers_suffix.hpp>
-#include <boost/beast/core/multi_buffer.hpp>
 #include <boost/beast/http/message.hpp>
 #include <boost/beast/http/serializer.hpp>
 #include <boost/beast/http/type_traits.hpp>
 #include <boost/beast/http/detail/chunk_encode.hpp>
 #include <boost/beast/core/error.hpp>
-#include <boost/beast/core/string.hpp>
+#include <boost/beast/core/stream_traits.hpp>
 #include <boost/asio/async_result.hpp>
 #include <iosfwd>
 #include <limits>
@@ -169,12 +166,16 @@ write_some(
 template<
     class AsyncWriteStream,
     bool isRequest, class Body, class Fields,
-    class WriteHandler>
+    BOOST_BEAST_ASYNC_TPARAM2 WriteHandler =
+        net::default_completion_token_t<
+            executor_type<AsyncWriteStream>>>
 BOOST_BEAST_ASYNC_RESULT2(WriteHandler)
 async_write_some(
     AsyncWriteStream& stream,
     serializer<isRequest, Body, Fields>& sr,
-    WriteHandler&& handler);
+    WriteHandler&& handler =
+        net::default_completion_token_t<
+            executor_type<AsyncWriteStream>>{});
 
 //------------------------------------------------------------------------------
 
@@ -295,12 +296,16 @@ write_header(
 template<
     class AsyncWriteStream,
     bool isRequest, class Body, class Fields,
-    class WriteHandler>
+    BOOST_BEAST_ASYNC_TPARAM2 WriteHandler =
+        net::default_completion_token_t<
+            executor_type<AsyncWriteStream>>>
 BOOST_BEAST_ASYNC_RESULT2(WriteHandler)
 async_write_header(
     AsyncWriteStream& stream,
     serializer<isRequest, Body, Fields>& sr,
-    WriteHandler&& handler);
+    WriteHandler&& handler =
+        net::default_completion_token_t<
+            executor_type<AsyncWriteStream>>{});
 
 //------------------------------------------------------------------------------
 
@@ -412,12 +417,16 @@ write(
 template<
     class AsyncWriteStream,
     bool isRequest, class Body, class Fields,
-    class WriteHandler>
+    BOOST_BEAST_ASYNC_TPARAM2 WriteHandler =
+        net::default_completion_token_t<
+            executor_type<AsyncWriteStream>>>
 BOOST_BEAST_ASYNC_RESULT2(WriteHandler)
 async_write(
     AsyncWriteStream& stream,
     serializer<isRequest, Body, Fields>& sr,
-    WriteHandler&& handler);
+    WriteHandler&& handler =
+        net::default_completion_token_t<
+            executor_type<AsyncWriteStream>>{});
 
 //------------------------------------------------------------------------------
 
@@ -633,18 +642,21 @@ write(
 template<
     class AsyncWriteStream,
     bool isRequest, class Body, class Fields,
-    class WriteHandler>
-#if BOOST_BEAST_DOXYGEN
+    BOOST_BEAST_ASYNC_TPARAM2 WriteHandler =
+        net::default_completion_token_t<
+            executor_type<AsyncWriteStream>>>
 BOOST_BEAST_ASYNC_RESULT2(WriteHandler)
-#else
-typename std::enable_if<
-    is_mutable_body_writer<Body>::value,
-    BOOST_BEAST_ASYNC_RESULT2(WriteHandler)>::type
-#endif
 async_write(
     AsyncWriteStream& stream,
     message<isRequest, Body, Fields>& msg,
-    WriteHandler&& handler);
+    WriteHandler&& handler =
+        net::default_completion_token_t<
+            executor_type<AsyncWriteStream>>{}
+#ifndef BOOST_BEAST_DOXYGEN
+    , typename std::enable_if<
+        is_mutable_body_writer<Body>::value>::type* = 0
+#endif
+    );
 
 /** Write a complete message to a stream asynchronously.
 
@@ -692,18 +704,22 @@ async_write(
 template<
     class AsyncWriteStream,
     bool isRequest, class Body, class Fields,
-    class WriteHandler>
-#if BOOST_BEAST_DOXYGEN
+    BOOST_BEAST_ASYNC_TPARAM2 WriteHandler =
+        net::default_completion_token_t<
+            executor_type<AsyncWriteStream>>>
 BOOST_BEAST_ASYNC_RESULT2(WriteHandler)
-#else
-typename std::enable_if<
-    ! is_mutable_body_writer<Body>::value,
-    BOOST_BEAST_ASYNC_RESULT2(WriteHandler)>::type
-#endif
 async_write(
     AsyncWriteStream& stream,
     message<isRequest, Body, Fields> const& msg,
-    WriteHandler&& handler);
+    WriteHandler&& handler =
+        net::default_completion_token_t<
+            executor_type<AsyncWriteStream>>{}
+#ifndef BOOST_BEAST_DOXYGEN
+    , typename std::enable_if<
+        ! is_mutable_body_writer<Body>::value>::type* = 0
+#endif
+    );
+
 
 //------------------------------------------------------------------------------