diff --git a/Builds/VisualStudio2015/RippleD.vcxproj b/Builds/VisualStudio2015/RippleD.vcxproj
index 9bf9b1722..a27349891 100644
--- a/Builds/VisualStudio2015/RippleD.vcxproj
+++ b/Builds/VisualStudio2015/RippleD.vcxproj
@@ -256,6 +256,8 @@
+
+
@@ -403,10 +405,10 @@
-
-
+
+
diff --git a/Builds/VisualStudio2015/RippleD.vcxproj.filters b/Builds/VisualStudio2015/RippleD.vcxproj.filters
index b27f9c460..eebae5ed1 100644
--- a/Builds/VisualStudio2015/RippleD.vcxproj.filters
+++ b/Builds/VisualStudio2015/RippleD.vcxproj.filters
@@ -564,6 +564,9 @@
include\beast\detail
+
+ include\beast\detail
+
include\beast\detail
@@ -783,10 +786,10 @@
include\beast\websocket\impl
-
+
include\beast\websocket\impl
-
+
include\beast\websocket\impl
diff --git a/src/beast/Jamroot b/src/beast/Jamroot
index c7b17d37c..1f8631154 100644
--- a/src/beast/Jamroot
+++ b/src/beast/Jamroot
@@ -53,14 +53,15 @@ project beast
/boost/system//boost_system
/boost/filesystem//boost_filesystem
/boost/program_options//boost_program_options
-# ssl
-# crypto
+# ssl
+# crypto
BOOST_ALL_NO_LIB=1
+ BOOST_SYSTEM_NO_DEPRECATED=1
multi
static
shared
- gcc:-std=c++14
- clang:-std=c++14
+ gcc:-std=c++11
+ clang:-std=c++11
LINUX:_XOPEN_SOURCE=600
LINUX:_GNU_SOURCE=1
SOLARIS:_XOPEN_SOURCE=500
diff --git a/src/beast/examples/file_body.h b/src/beast/examples/file_body.h
index e46cff9ed..763c5a436 100644
--- a/src/beast/examples/file_body.h
+++ b/src/beast/examples/file_body.h
@@ -69,7 +69,7 @@ struct file_body
size_ = boost::filesystem::file_size(path_);
}
- auto
+ std::size_t
content_length() const
{
return size_;
diff --git a/src/beast/examples/http_async_server.h b/src/beast/examples/http_async_server.h
index e3ace8e9d..5438ab6e6 100644
--- a/src/beast/examples/http_async_server.h
+++ b/src/beast/examples/http_async_server.h
@@ -96,15 +96,12 @@ private:
explicit
peer(socket_type&& sock, std::string const& root)
- : id_([]
- {
- static int n = 0;
- return ++n;
- }())
- , stream_(std::move(sock))
+ : stream_(std::move(sock))
, strand_(stream_.get_io_service())
, root_(root)
{
+ static int n = 0;
+ id_ = ++n;
}
void run()
diff --git a/src/beast/examples/http_stream.h b/src/beast/examples/http_stream.h
index d49bbac5a..cb3bdb6b6 100644
--- a/src/beast/examples/http_stream.h
+++ b/src/beast/examples/http_stream.h
@@ -21,6 +21,7 @@
#define BEAST_HTTP_STREAM_H_INCLUDED
#include
+#include
#include
#include
#include
@@ -94,7 +95,7 @@ class stream : public detail::stream_base
public:
/// The type of the next layer.
using next_layer_type =
- std::remove_reference_t;
+ typename std::remove_reference::type;
/// The type of the lowest layer.
using lowest_layer_type =
@@ -335,7 +336,8 @@ public:
#if GENERATING_DOCS
void_or_deduced
#else
- auto
+ typename async_completion<
+ ReadHandler, void(error_code)>::result_type
#endif
async_read(message& msg,
ReadHandler&& handler);
@@ -429,7 +431,8 @@ public:
#if GENERATING_DOCS
void_or_deduced
#else
- auto
+ typename async_completion<
+ WriteHandler, void(error_code)>::result_type
#endif
async_write(message const& msg,
WriteHandler&& handler);
@@ -467,7 +470,8 @@ public:
#if GENERATING_DOCS
void_or_deduced
#else
- auto
+ typename async_completion<
+ WriteHandler, void(error_code)>::result_type
#endif
async_write(message&& msg,
WriteHandler&& handler);
diff --git a/src/beast/examples/http_stream.ipp b/src/beast/examples/http_stream.ipp
index fa5fd7ad7..b026651e8 100644
--- a/src/beast/examples/http_stream.ipp
+++ b/src/beast/examples/http_stream.ipp
@@ -20,7 +20,6 @@
#ifndef BEAST_HTTP_STREAM_IPP_INCLUDED
#define BEAST_HTTP_STREAM_IPP_INCLUDED
-#include
#include
#include
#include
@@ -78,7 +77,7 @@ public:
void operator()(error_code const& ec, bool again = true);
friend
- auto asio_handler_allocate(
+ void* asio_handler_allocate(
std::size_t size, read_op* op)
{
return boost_asio_handler_alloc_helpers::
@@ -86,7 +85,7 @@ public:
}
friend
- auto asio_handler_deallocate(
+ void asio_handler_deallocate(
void* p, std::size_t size, read_op* op)
{
return boost_asio_handler_alloc_helpers::
@@ -94,14 +93,14 @@ public:
}
friend
- auto asio_handler_is_continuation(read_op* op)
+ bool asio_handler_is_continuation(read_op* op)
{
return op->d_->cont;
}
template
friend
- auto asio_handler_invoke(Function&& f, read_op* op)
+ void asio_handler_invoke(Function&& f, read_op* op)
{
return boost_asio_handler_invoke_helpers::
invoke(f, op->d_->h);
@@ -198,7 +197,7 @@ public:
void operator()(error_code const& ec, bool again = true);
friend
- auto asio_handler_allocate(
+ void* asio_handler_allocate(
std::size_t size, write_op* op)
{
return boost_asio_handler_alloc_helpers::
@@ -206,7 +205,7 @@ public:
}
friend
- auto asio_handler_deallocate(
+ void asio_handler_deallocate(
void* p, std::size_t size, write_op* op)
{
return boost_asio_handler_alloc_helpers::
@@ -214,14 +213,14 @@ public:
}
friend
- auto asio_handler_is_continuation(write_op* op)
+ bool asio_handler_is_continuation(write_op* op)
{
return op->d_->cont;
}
template
friend
- auto asio_handler_invoke(Function&& f, write_op* op)
+ void asio_handler_invoke(Function&& f, write_op* op)
{
return boost_asio_handler_invoke_helpers::
invoke(f, op->d_->h);
@@ -319,7 +318,9 @@ template::
async_read(message& msg,
- ReadHandler&& handler)
+ ReadHandler&& handler) ->
+ typename async_completion<
+ ReadHandler, void(error_code)>::result_type
{
async_completion<
ReadHandler, void(error_code)
@@ -346,7 +347,9 @@ template::
async_write(message const& msg,
- WriteHandler&& handler)
+ WriteHandler&& handler) ->
+ typename async_completion<
+ WriteHandler, void(error_code)>::result_type
{
async_completion<
WriteHandler, void(error_code)> completion(handler);
@@ -375,7 +378,9 @@ template::
async_write(message&& msg,
- WriteHandler&& handler)
+ WriteHandler&& handler) ->
+ typename async_completion<
+ WriteHandler, void(error_code)>::result_type
{
async_completion<
WriteHandler, void(error_code)> completion(handler);
diff --git a/src/beast/examples/http_sync_server.h b/src/beast/examples/http_sync_server.h
index db72729da..df6e42395 100644
--- a/src/beast/examples/http_sync_server.h
+++ b/src/beast/examples/http_sync_server.h
@@ -94,6 +94,28 @@ public:
}
}
+ struct lambda
+ {
+ int id;
+ http_sync_server& self;
+ socket_type sock;
+ boost::asio::io_service::work work;
+
+ lambda(int id_, http_sync_server& self_,
+ socket_type&& sock_)
+ : id(id_)
+ , self(self_)
+ , sock(std::move(sock_))
+ , work(sock.get_io_service())
+ {
+ }
+
+ void operator()()
+ {
+ self.do_peer(id, std::move(sock));
+ }
+ };
+
void
on_accept(error_code ec)
{
@@ -101,16 +123,7 @@ public:
return;
maybe_throw(ec, "accept");
static int id_ = 0;
- std::thread{
- [
- id = ++id_,
- this,
- sock = std::move(sock_),
- work = boost::asio::io_service::work{ios_}
- ]() mutable
- {
- do_peer(id, std::move(sock));
- }}.detach();
+ std::thread{lambda{++id_, *this, std::move(sock_)}}.detach();
acceptor_.async_accept(sock_,
std::bind(&http_sync_server::on_accept, this,
asio::placeholders::error));
diff --git a/src/beast/examples/wsproto_sync_echo_peer.h b/src/beast/examples/wsproto_sync_echo_peer.h
index 991a2d8cb..6b2fe40bc 100644
--- a/src/beast/examples/wsproto_sync_echo_peer.h
+++ b/src/beast/examples/wsproto_sync_echo_peer.h
@@ -102,6 +102,28 @@ private:
}
}
+ struct lambda
+ {
+ int id;
+ sync_echo_peer& self;
+ socket_type sock;
+ boost::asio::io_service::work work;
+
+ lambda(int id_, sync_echo_peer& self_,
+ socket_type&& sock_)
+ : id(id_)
+ , self(self_)
+ , sock(std::move(sock_))
+ , work(sock.get_io_service())
+ {
+ }
+
+ void operator()()
+ {
+ self.do_peer(id, std::move(sock));
+ }
+ };
+
void
on_accept(error_code ec)
{
@@ -109,16 +131,7 @@ private:
return;
maybe_throw(ec, "accept");
static int id_ = 0;
- std::thread{
- [
- id = ++id_,
- this,
- sock = std::move(sock_),
- work = boost::asio::io_service::work{ios_}
- ]() mutable
- {
- do_peer(id, std::move(sock));
- }}.detach();
+ std::thread{lambda{++id_, *this, std::move(sock_)}}.detach();
acceptor_.async_accept(sock_,
std::bind(&sync_echo_peer::on_accept, this,
beast::asio::placeholders::error));
diff --git a/src/beast/include/beast/async_completion.hpp b/src/beast/include/beast/async_completion.hpp
index d4be5428c..325e996bb 100644
--- a/src/beast/include/beast/async_completion.hpp
+++ b/src/beast/include/beast/async_completion.hpp
@@ -32,12 +32,12 @@ namespace beast {
Usage:
@code
+ ...
template
- auto
+ typename async_completion::result_type
async_initfn(..., CompletionToken&& token)
{
- async_completion completion(token);
+ async_completion completion(token);
...
return completion.result.get();
}
@@ -46,7 +46,6 @@ namespace beast {
See
Library Foundations For Asynchronous Operations
*/
-
template
struct async_completion
{
@@ -59,12 +58,15 @@ struct async_completion
typename boost::asio::handler_type<
CompletionToken, Signature>::type;
+ using result_type = typename
+ boost::asio::async_result::type;
+
/** Construct the completion helper.
@param token The completion token. Copies will be made as
required. If `CompletionToken` is movable, it may also be moved.
*/
- async_completion(std::remove_reference_t& token)
+ async_completion(typename std::remove_reference::type& token)
: handler(std::forward(token))
, result(handler)
{
diff --git a/src/beast/include/beast/bind_handler.hpp b/src/beast/include/beast/bind_handler.hpp
index 6cc6225f7..e0dcdda2c 100644
--- a/src/beast/include/beast/bind_handler.hpp
+++ b/src/beast/include/beast/bind_handler.hpp
@@ -8,6 +8,7 @@
#ifndef BEAST_BIND_HANDLER_HPP
#define BEAST_BIND_HANDLER_HPP
+#include
#include
#include
#include
@@ -28,14 +29,14 @@ template
class bound_handler
{
private:
- using args_type = std::tuple...>;
+ using args_type = std::tuple::type...>;
Handler h_;
args_type args_;
template
static void invoke(Handler& h, Tuple& args,
- std::index_sequence )
+ index_sequence)
{
h(std::get(args)...);
}
@@ -55,14 +56,14 @@ public:
operator()()
{
invoke(h_, args_,
- std::index_sequence_for ());
+ index_sequence_for ());
}
void
operator()() const
{
invoke(h_, args_,
- std::index_sequence_for ());
+ index_sequence_for ());
}
friend
@@ -133,19 +134,19 @@ public:
@param handler The handler to wrap.
@param args A list of arguments to bind to the handler. The
- arguments are forwarded into the returned
-
+ arguments are forwarded into the returned object.
*/
template
#if GENERATING_DOCS
implementation_defined
#else
-detail::bound_handler, Args...>
+detail::bound_handler<
+ typename std::decay::type, Args...>
#endif
bind_handler(CompletionHandler&& handler, Args&&... args)
{
- return detail::bound_handler, Args...>(std::forward<
+ return detail::bound_handler::type, Args...>(std::forward<
CompletionHandler>(handler),
std::forward(args)...);
}
diff --git a/src/beast/include/beast/buffer_cat.hpp b/src/beast/include/beast/buffer_cat.hpp
index 40a556fda..bfbb2d2e3 100644
--- a/src/beast/include/beast/buffer_cat.hpp
+++ b/src/beast/include/beast/buffer_cat.hpp
@@ -79,8 +79,8 @@ class buffer_cat_helper<
using C = std::integral_constant;
template
- using iter_t = typename std::tuple_element_t<
- I, std::tuple>::const_iterator;
+ using iter_t = typename std::tuple_element<
+ I, std::tuple>::type::const_iterator;
template
iter_t&
@@ -491,7 +491,8 @@ implementation_defined
buffer_cat(BufferSequence const&... buffers)
#else
template
-auto
+detail::buffer_cat_helper<
+ boost::asio::const_buffer, B1, B2, Bn...>
buffer_cat(B1 const& b1, B2 const& b2, Bn const&... bn)
#endif
{
diff --git a/src/beast/include/beast/buffers_adapter.hpp b/src/beast/include/beast/buffers_adapter.hpp
index 85856b140..b6c6f3697 100644
--- a/src/beast/include/beast/buffers_adapter.hpp
+++ b/src/beast/include/beast/buffers_adapter.hpp
@@ -36,7 +36,7 @@ template
class buffers_adapter
{
private:
- using buffers_type = std::decay_t;
+ using buffers_type = typename std::decay::type;
using iter_type = typename buffers_type::const_iterator;
static auto constexpr is_mutable =
diff --git a/src/beast/include/beast/detail/ci_char_traits.hpp b/src/beast/include/beast/detail/ci_char_traits.hpp
index 0e4d6377e..8484f273f 100644
--- a/src/beast/include/beast/detail/ci_char_traits.hpp
+++ b/src/beast/include/beast/detail/ci_char_traits.hpp
@@ -45,8 +45,10 @@ bool
ci_equal(std::pair lhs,
std::pair rhs)
{
+ if(lhs.second != rhs.second)
+ return false;
return std::equal (lhs.first, lhs.first + lhs.second,
- rhs.first, rhs.first + rhs.second,
+ rhs.first,
[] (char lhs, char rhs)
{
return std::tolower(lhs) == std::tolower(rhs);
diff --git a/src/beast/include/beast/detail/integer_sequence.hpp b/src/beast/include/beast/detail/integer_sequence.hpp
new file mode 100644
index 000000000..73389c53b
--- /dev/null
+++ b/src/beast/include/beast/detail/integer_sequence.hpp
@@ -0,0 +1,145 @@
+//
+// Copyright (c) 2013-2016 Vinnie Falco (vinnie dot falco at gmail dot com)
+//
+// Distributed under the Boost Software License, Version 1.0. (See accompanying
+// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+//
+
+#ifndef BEAST_DETAIL_INTEGER_SEQUENCE_H_INCLUDED
+#define BEAST_DETAIL_INTEGER_SEQUENCE_H_INCLUDED
+
+#include
+#include
+#include
+
+namespace beast {
+namespace detail {
+
+template
+struct integer_sequence
+{
+ using value_type = T;
+ static_assert (std::is_integral::value,
+ "std::integer_sequence can only be instantiated with an integral type" );
+
+ static std::size_t constexpr static_size = sizeof...(Ints);
+
+ static std::size_t constexpr size()
+ {
+ return sizeof...(Ints);
+ }
+};
+
+template
+using index_sequence = integer_sequence;
+
+// This workaround is needed for broken sizeof...
+template
+struct sizeof_workaround
+{
+ static std::size_t constexpr size = sizeof... (Args);
+};
+
+#ifdef _MSC_VER
+
+// This implementation compiles on MSVC and clang but not gcc
+
+template
+struct make_integer_sequence_unchecked;
+
+template
+struct make_integer_sequence_unchecked<
+ T, N, integer_sequence>
+{
+ using type = typename make_integer_sequence_unchecked<
+ T, N-1, integer_sequence>::type;
+};
+
+template
+struct make_integer_sequence_unchecked<
+ T, 0, integer_sequence>
+{
+ using type = integer_sequence;
+};
+
+template
+struct make_integer_sequence_checked
+{
+ static_assert (std::is_integral::value,
+ "T must be an integral type");
+
+ static_assert (N >= 0,
+ "N must be non-negative");
+
+ using type = typename make_integer_sequence_unchecked<
+ T, N, integer_sequence>::type;
+};
+
+template
+using make_integer_sequence =
+ typename make_integer_sequence_checked::type;
+
+template
+using make_index_sequence = make_integer_sequence;
+
+template
+using index_sequence_for =
+ make_index_sequence::size>;
+
+#else
+
+// This implementation compiles on gcc but not MSVC
+
+template
+struct index_tuple
+{
+ using next = index_tuple;
+
+};
+
+template
+struct build_index_tuple
+{
+ using type = typename build_index_tuple::type::next;
+};
+
+template<>
+struct build_index_tuple<0>
+{
+ using type = index_tuple<>;
+};
+
+template::type
+>
+struct integer_sequence_helper;
+
+template
+struct integer_sequence_helper>
+{
+ static_assert (std::is_integral::value,
+ "T must be an integral type");
+
+ static_assert (N >= 0,
+ "N must be non-negative");
+
+ using type = integer_sequence (Ints)...>;
+};
+
+template
+using make_integer_sequence =
+ typename integer_sequence_helper::type;
+
+template
+using make_index_sequence = make_integer_sequence;
+
+template
+using index_sequence_for =
+ make_index_sequence::size>;
+
+#endif
+
+} // detail
+} // beast
+
+#endif
diff --git a/src/beast/include/beast/detail/stream/basic_scoped_ostream.hpp b/src/beast/include/beast/detail/stream/basic_scoped_ostream.hpp
index fcd34d6b6..262f3cd42 100644
--- a/src/beast/include/beast/detail/stream/basic_scoped_ostream.hpp
+++ b/src/beast/include/beast/detail/stream/basic_scoped_ostream.hpp
@@ -78,7 +78,7 @@ public:
explicit basic_scoped_ostream (Handler&& handler)
: m_handler (std::forward (handler))
#if BEAST_NO_STDLIB_STREAM_MOVE
- , m_ss (std::make_unique ())
+ , m_ss (new stream_type())
#endif
{
}
@@ -87,7 +87,7 @@ public:
basic_scoped_ostream (T const& t, Handler&& handler)
: m_handler (std::forward (handler))
#if BEAST_NO_STDLIB_STREAM_MOVE
- , m_ss (std::make_unique ())
+ , m_ss (new stream_type())
#endif
{
stream() << t;
diff --git a/src/beast/include/beast/http.hpp b/src/beast/include/beast/http.hpp
index 591c32bb0..61db5985c 100644
--- a/src/beast/include/beast/http.hpp
+++ b/src/beast/include/beast/http.hpp
@@ -13,7 +13,6 @@
#include
#include
#include
-#include
#include
#include
#include
diff --git a/src/beast/include/beast/http/basic_headers.hpp b/src/beast/include/beast/http/basic_headers.hpp
index cf1f77530..6bbff654d 100644
--- a/src/beast/include/beast/http/basic_headers.hpp
+++ b/src/beast/include/beast/http/basic_headers.hpp
@@ -393,8 +393,8 @@ public:
extended as per RFC2616 Section 4.2.
*/
template::value>>
+ class = typename std::enable_if<
+ ! std::is_constructible::value>::type>
void
insert(boost::string_ref name, T const& value)
{
@@ -417,8 +417,8 @@ public:
specified value is inserted as if by insert(field, value).
*/
template::value>>
+ class = typename std::enable_if<
+ ! std::is_constructible::value>::type>
void
replace(boost::string_ref const& name, T const& value)
{
diff --git a/src/beast/include/beast/http/chunk_encode.hpp b/src/beast/include/beast/http/chunk_encode.hpp
index 15ae2a427..13944fbd4 100644
--- a/src/beast/include/beast/http/chunk_encode.hpp
+++ b/src/beast/include/beast/http/chunk_encode.hpp
@@ -61,7 +61,8 @@ private:
// Unchecked conversion of unsigned to hex string
template
static
- std::enable_if_t::value, OutIter>
+ typename std::enable_if<
+ std::is_unsigned::value, OutIter>::type
to_hex(OutIter const first, OutIter const last, Unsigned n);
};
@@ -114,7 +115,8 @@ chunk_encoded_buffers::chunk_encoded_buffers (
template
template
-std::enable_if_t::value, OutIter>
+typename std::enable_if<
+ std::is_unsigned::value, OutIter>::type
chunk_encoded_buffers::to_hex(
OutIter const first, OutIter const last, Unsigned n)
{
diff --git a/src/beast/include/beast/http/detail/error.hpp b/src/beast/include/beast/http/detail/error.hpp
index a1543d988..414664eff 100644
--- a/src/beast/include/beast/http/detail/error.hpp
+++ b/src/beast/include/beast/http/detail/error.hpp
@@ -57,7 +57,7 @@ public:
};
template
-auto
+boost::system::error_code
make_error(int http_errno)
{
static message_category const mc{};
diff --git a/src/beast/include/beast/http/detail/writes.hpp b/src/beast/include/beast/http/detail/writes.hpp
index d887a95c0..bd68bb2c9 100644
--- a/src/beast/include/beast/http/detail/writes.hpp
+++ b/src/beast/include/beast/http/detail/writes.hpp
@@ -20,7 +20,8 @@ namespace http {
namespace detail {
template::value>>
+ class = typename std::enable_if<
+ is_Streambuf::value>::type>
void
write(Streambuf& streambuf, T&& t)
{
@@ -34,8 +35,8 @@ write(Streambuf& streambuf, T&& t)
}
template0) &&
- is_Streambuf::value>>
+ class = typename std::enable_if< (N>0) &&
+ is_Streambuf::value>::type>
void
write(Streambuf& streambuf, char const(&s)[N])
{
@@ -46,7 +47,8 @@ write(Streambuf& streambuf, char const(&s)[N])
}
template::value>>
+ class = typename std::enable_if<
+ is_Streambuf::value>::type>
void
write(Streambuf& streambuf, boost::string_ref const& s)
{
diff --git a/src/beast/include/beast/http/fields.hpp b/src/beast/include/beast/http/fields.hpp
deleted file mode 100644
index e1eeb7104..000000000
--- a/src/beast/include/beast/http/fields.hpp
+++ /dev/null
@@ -1,133 +0,0 @@
-//------------------------------------------------------------------------------
-/*
- This file is part of Beast: https://github.com/vinniefalco/Beast
- Copyright 2013, Vinnie Falco
-
- Permission to use, copy, modify, and/or distribute this software for any
- purpose with or without fee is hereby granted, provided that the above
- copyright notice and this permission notice appear in all copies.
-
- THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
- WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
- MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
- ANY SPECIAL , DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
- WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
- ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
- OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
-*/
-//==============================================================================
-
-#ifndef BEAST_HTTP_FIELDS_H_INCLUDED
-#define BEAST_HTTP_FIELDS_H_INCLUDED
-
-#include
-
-namespace beast {
-namespace http {
-
-#if defined(__clang__)
-#pragma clang diagnostic push
-#pragma clang diagnostic ignored "-Wmissing-braces"
-#endif // defined(__clang__)
-
-template
-auto const&
-common_fields()
-{
- // Must be sorted
- static std::array constexpr h{
- "Accept"
- ,"Accept-Charset"
- ,"Accept-Datetime"
- ,"Accept-Encoding"
- ,"Accept-Language"
- ,"Accept-Ranges"
- ,"Access-Control-Allow-Credentials"
- ,"Access-Control-Allow-Headers"
- ,"Access-Control-Allow-Methods"
- ,"Access-Control-Allow-Origin"
- ,"Access-Control-Expose-Headers"
- ,"Access-Control-Max-Age"
- ,"Access-Control-Request-Headers"
- ,"Access-Control-Request-Method"
- ,"Age"
- ,"Allow"
- ,"Authorization"
- ,"Cache-Control"
- ,"Connection"
- ,"Content-Disposition"
- ,"Content-Encoding"
- ,"Content-Language"
- ,"Content-Length"
- ,"Content-Location"
- ,"Content-MD5"
- ,"Content-Range"
- ,"Content-Type"
- ,"Cookie"
- ,"DNT"
- ,"Date"
- ,"ETag"
- ,"Expect"
- ,"Expires"
- ,"From"
- ,"Front-End-Https"
- ,"Host"
- ,"If-Match"
- ,"If-Modified-Since"
- ,"If-None-Match"
- ,"If-Range"
- ,"If-Unmodified-Since"
- ,"Keep-Alive"
- ,"Last-Modified"
- ,"Link"
- ,"Location"
- ,"Max-Forwards"
- ,"Origin"
- ,"P3P"
- ,"Pragma"
- ,"Proxy-Authenticate"
- ,"Proxy-Authorization"
- ,"Proxy-Connection"
- ,"Range"
- ,"Referer"
- ,"Refresh"
- ,"Retry-After"
- ,"Server"
- ,"Set-Cookie"
- ,"Strict-Transport-Security"
- ,"TE"
- ,"Timestamp"
- ,"Trailer"
- ,"Transfer-Encoding"
- ,"Upgrade"
- ,"User-Agent"
- ,"VIP"
- ,"Vary"
- ,"Via"
- ,"WWW-Authenticate"
- ,"Warning"
- ,"X-Accel-Redirect"
- ,"X-Content-Security-Policy-Report-Only"
- ,"X-Content-Type-Options"
- ,"X-Forwarded-For"
- ,"X-Forwarded-Proto"
- ,"X-Frame-Options"
- ,"X-Powered-By"
- ,"X-Real-IP"
- ,"X-Requested-With"
- ,"X-UA-Compatible"
- ,"X-Wap-Profile"
- ,"X-XSS-Protection"
- };
-
- return h;
-}
-
-#if defined(__clang__)
-#pragma clang diagnostic pop
-#endif // defined(__clang__)
-
-} // http
-} // beast
-
-#endif
diff --git a/src/beast/include/beast/http/impl/message.ipp b/src/beast/include/beast/http/impl/message.ipp
index 7984b3b83..8e25a6c64 100644
--- a/src/beast/include/beast/http/impl/message.ipp
+++ b/src/beast/include/beast/http/impl/message.ipp
@@ -127,6 +127,31 @@ buffers_to_string(ConstBufferSequence const& buffers)
return s;
}
+class writef_ostream
+{
+ std::ostream& os_;
+ bool chunked_;
+
+public:
+ writef_ostream(std::ostream& os, bool chunked)
+ : os_(os)
+ , chunked_(chunked)
+ {
+ }
+
+ template
+ void
+ operator()(ConstBufferSequence const& buffers)
+ {
+ if(chunked_)
+ os_ << buffers_to_string(
+ chunk_encode(buffers));
+ else
+ os_ << buffers_to_string(
+ buffers);
+ }
+};
+
} // detail
// Diagnostic output only
@@ -155,16 +180,7 @@ operator<<(std::ostream& os,
auto copy = resume;
os << detail::buffers_to_string(wp.sb.data());
wp.sb.consume(wp.sb.size());
- auto writef =
- [&os, &wp](auto const& buffers)
- {
- if(wp.chunked)
- os << detail::buffers_to_string(
- chunk_encode(buffers));
- else
- os << detail::buffers_to_string(
- buffers);
- };
+ detail::writef_ostream writef(os, wp.chunked);
for(;;)
{
{
diff --git a/src/beast/include/beast/http/impl/read.ipp b/src/beast/include/beast/http/impl/read.ipp
index 0022f184d..4c5b86d04 100644
--- a/src/beast/include/beast/http/impl/read.ipp
+++ b/src/beast/include/beast/http/impl/read.ipp
@@ -9,7 +9,6 @@
#define BEAST_HTTP_IMPL_READ_IPP_HPP
#include
-#include
#include
#include
#include
@@ -76,7 +75,7 @@ public:
std::size_t bytes_transferred, bool again = true);
friend
- auto asio_handler_allocate(
+ void* asio_handler_allocate(
std::size_t size, read_op* op)
{
return boost_asio_handler_alloc_helpers::
@@ -84,7 +83,7 @@ public:
}
friend
- auto asio_handler_deallocate(
+ void asio_handler_deallocate(
void* p, std::size_t size, read_op* op)
{
return boost_asio_handler_alloc_helpers::
@@ -92,14 +91,14 @@ public:
}
friend
- auto asio_handler_is_continuation(read_op* op)
+ bool asio_handler_is_continuation(read_op* op)
{
return op->d_->cont;
}
template
friend
- auto asio_handler_invoke(Function&& f, read_op* op)
+ void asio_handler_invoke(Function&& f, read_op* op)
{
return boost_asio_handler_invoke_helpers::
invoke(f, op->d_->h);
@@ -258,11 +257,12 @@ read(SyncReadStream& stream, Streambuf& streambuf,
template
-auto
+ class ReadHandler>
+typename async_completion<
+ ReadHandler, void(error_code)>::result_type
async_read(AsyncReadStream& stream, Streambuf& streambuf,
message& m,
- CompletionToken&& token)
+ ReadHandler&& handler)
{
static_assert(is_AsyncReadStream::value,
"AsyncReadStream requirements not met");
@@ -270,8 +270,8 @@ async_read(AsyncReadStream& stream, Streambuf& streambuf,
"Streambuf requirements not met");
static_assert(is_ReadableBody::value,
"ReadableBody requirements not met");
- beast::async_completion completion(token);
+ beast::async_completion completion(handler);
detail::read_op{completion.handler,
diff --git a/src/beast/include/beast/http/impl/write.ipp b/src/beast/include/beast/http/impl/write.ipp
index 30852e2ef..a1839a290 100644
--- a/src/beast/include/beast/http/impl/write.ipp
+++ b/src/beast/include/beast/http/impl/write.ipp
@@ -14,7 +14,6 @@
#include
#include
#include
-#include
#include
#include
#include
@@ -61,6 +60,60 @@ class write_op
}
};
+ class writef0
+ {
+ write_op& self_;
+
+ public:
+ explicit
+ writef0(write_op& self)
+ : self_(self)
+ {
+ }
+
+ template
+ void operator()(ConstBufferSequence const& buffers)
+ {
+ auto& d = *self_.d_;
+ // write headers and body
+ if(d.wp.chunked)
+ boost::asio::async_write(d.s,
+ buffer_cat(d.wp.sb.data(),
+ chunk_encode(buffers)),
+ std::move(self_));
+ else
+ boost::asio::async_write(d.s,
+ buffer_cat(d.wp.sb.data(),
+ buffers), std::move(self_));
+ }
+ };
+
+ class writef
+ {
+ write_op& self_;
+
+ public:
+ explicit
+ writef(write_op& self)
+ : self_(self)
+ {
+ }
+
+ template
+ void operator()(ConstBufferSequence const& buffers)
+ {
+ auto& d = *self_.d_;
+ // write body
+ if(d.wp.chunked)
+ boost::asio::async_write(d.s,
+ chunk_encode(buffers),
+ std::move(self_));
+ else
+ boost::asio::async_write(d.s,
+ buffers, std::move(self_));
+ }
+ };
+
std::shared_ptr d_;
public:
@@ -74,9 +127,11 @@ public:
std::forward(args)...))
{
auto& d = *d_;
+ auto sp = d_;
d.resume = {
- [self = *this]() mutable
+ [sp]() mutable
{
+ write_op self(std::move(sp));
self.d_->cont = false;
auto& ios = self.d_->s.get_io_service();
ios.dispatch(bind_handler(std::move(self),
@@ -97,7 +152,7 @@ public:
std::size_t bytes_transferred, bool again = true);
friend
- auto asio_handler_allocate(
+ void* asio_handler_allocate(
std::size_t size, write_op* op)
{
return boost_asio_handler_alloc_helpers::
@@ -105,7 +160,7 @@ public:
}
friend
- auto asio_handler_deallocate(
+ void asio_handler_deallocate(
void* p, std::size_t size, write_op* op)
{
return boost_asio_handler_alloc_helpers::
@@ -113,14 +168,14 @@ public:
}
friend
- auto asio_handler_is_continuation(write_op* op)
+ bool asio_handler_is_continuation(write_op* op)
{
return op->d_->cont;
}
template
friend
- auto asio_handler_invoke(Function&& f, write_op* op)
+ void asio_handler_invoke(Function&& f, write_op* op)
{
return boost_asio_handler_invoke_helpers::
invoke(f, op->d_->h);
@@ -156,20 +211,8 @@ operator()(error_code ec, std::size_t, bool again)
case 1:
{
- auto const result = d.wp.w(std::move(d.copy), ec,
- [&](auto const& buffers)
- {
- // write headers and body
- if(d.wp.chunked)
- boost::asio::async_write(d.s,
- buffer_cat(d.wp.sb.data(),
- chunk_encode(buffers)),
- std::move(*this));
- else
- boost::asio::async_write(d.s,
- buffer_cat(d.wp.sb.data(),
- buffers), std::move(*this));
- });
+ auto const result = d.wp.w(
+ std::move(d.copy), ec, writef0{*this});
if(ec)
{
// call handler
@@ -199,18 +242,8 @@ operator()(error_code ec, std::size_t, bool again)
case 3:
{
- auto const result = d.wp.w(std::move(d.copy), ec,
- [&](auto const& buffers)
- {
- // write body
- if(d.wp.chunked)
- boost::asio::async_write(d.s,
- chunk_encode(buffers),
- std::move(*this));
- else
- boost::asio::async_write(d.s,
- buffers, std::move(*this));
- });
+ auto const result = d.wp.w(
+ std::move(d.copy), ec, writef{*this});
if(ec)
{
// call handler
@@ -256,6 +289,65 @@ operator()(error_code ec, std::size_t, bool again)
d.copy = {};
}
+template
+class writef0_write
+{
+ Streambuf const& sb_;
+ SyncWriteStream& stream_;
+ bool chunked_;
+ error_code& ec_;
+
+public:
+ writef0_write(SyncWriteStream& stream,
+ Streambuf const& sb, bool chunked, error_code& ec)
+ : sb_(sb)
+ , stream_(stream)
+ , chunked_(chunked)
+ , ec_(ec)
+ {
+ }
+
+ template
+ void operator()(ConstBufferSequence const& buffers)
+ {
+ // write headers and body
+ if(chunked_)
+ boost::asio::write(stream_, buffer_cat(
+ sb_.data(), chunk_encode(buffers)), ec_);
+ else
+ boost::asio::write(stream_, buffer_cat(
+ sb_.data(), buffers), ec_);
+ }
+};
+
+template
+class writef_write
+{
+ SyncWriteStream& stream_;
+ bool chunked_;
+ error_code& ec_;
+
+public:
+ writef_write(SyncWriteStream& stream,
+ bool chunked, error_code& ec)
+ : stream_(stream)
+ , chunked_(chunked)
+ , ec_(ec)
+ {
+ }
+
+ template
+ void operator()(ConstBufferSequence const& buffers)
+ {
+ // write body
+ if(chunked_)
+ boost::asio::write(stream_,
+ chunk_encode(buffers), ec_);
+ else
+ boost::asio::write(stream_, buffers, ec_);
+ }
+};
+
} // detail
//------------------------------------------------------------------------------
@@ -288,16 +380,8 @@ write(SyncWriteStream& stream,
{
{
auto result = wp.w(std::move(copy), ec,
- [&](auto const& buffers)
- {
- // write headers and body
- if(wp.chunked)
- boost::asio::write(stream, buffer_cat(
- wp.sb.data(), chunk_encode(buffers)), ec);
- else
- boost::asio::write(stream, buffer_cat(
- wp.sb.data(), buffers), ec);
- });
+ detail::writef0_write{
+ stream, wp.sb, wp.chunked, ec});
if(ec)
return;
if(result)
@@ -318,15 +402,8 @@ write(SyncWriteStream& stream,
for(;;)
{
auto result = wp.w(std::move(copy), ec,
- [&](auto const& buffers)
- {
- // write body
- if(wp.chunked)
- boost::asio::write(stream,
- chunk_encode(buffers), ec);
- else
- boost::asio::write(stream, buffers, ec);
- });
+ detail::writef_write{
+ stream, wp.chunked, ec});
if(ec)
return;
if(result)
@@ -360,19 +437,20 @@ write(SyncWriteStream& stream,
template
-auto
+ class WriteHandler>
+typename async_completion<
+ WriteHandler, void(error_code)>::result_type
async_write(AsyncWriteStream& stream,
message const& msg,
- CompletionToken&& token)
+ WriteHandler&& handler)
{
static_assert(
is_AsyncWriteStream::value,
"AsyncWriteStream requirements not met");
static_assert(is_WritableBody::value,
"WritableBody requirements not met");
- beast::async_completion completion(token);
+ beast::async_completion completion(handler);
detail::write_op{completion.handler, stream, msg};
return completion.result.get();
diff --git a/src/beast/include/beast/http/message.hpp b/src/beast/include/beast/http/message.hpp
index e1756a395..b31991e06 100644
--- a/src/beast/include/beast/http/message.hpp
+++ b/src/beast/include/beast/http/message.hpp
@@ -66,8 +66,8 @@ struct response_params
*/
template
struct message
- : std::conditional_t
+ : std::conditional::type
{
/** The trait type characterizing the body.
diff --git a/src/beast/include/beast/http/read.hpp b/src/beast/include/beast/http/read.hpp
index 9532cdee0..6b2ef3ab9 100644
--- a/src/beast/include/beast/http/read.hpp
+++ b/src/beast/include/beast/http/read.hpp
@@ -8,6 +8,7 @@
#ifndef BEAST_HTTP_READ_HPP
#define BEAST_HTTP_READ_HPP
+#include
#include
#include
#include
@@ -76,7 +77,7 @@ read(SyncReadStream& stream, Streambuf& streambuf,
@param msg An object used to store the read message. Any
contents will be overwritten.
- @param token The handler to be called when the request completes.
+ @param handler The handler to be called when the request completes.
Copies will be made of the handler as required. The equivalent
function signature of the handler must be:
@code void handler(
@@ -89,15 +90,16 @@ read(SyncReadStream& stream, Streambuf& streambuf,
*/
template
+ class ReadHandler>
#if GENERATING_DOCS
void_or_deduced
#else
-auto
+typename async_completion<
+ ReadHandler, void(error_code)>::result_type
#endif
async_read(AsyncReadStream& stream, Streambuf& streambuf,
message& msg,
- CompletionToken&& token);
+ ReadHandler&& handler);
} // http
} // beast
diff --git a/src/beast/include/beast/http/rfc2616.hpp b/src/beast/include/beast/http/rfc2616.hpp
index ea43016c7..254eca983 100644
--- a/src/beast/include/beast/http/rfc2616.hpp
+++ b/src/beast/include/beast/http/rfc2616.hpp
@@ -429,13 +429,12 @@ ci_equal(boost::string_ref s1, boost::string_ref s2)
/** Returns a range representing the list. */
inline
-auto
+boost::iterator_range
make_list(boost::string_ref const& field)
{
return boost::iterator_range{
list_iterator{field.begin(), field.end()},
list_iterator{field.end(), field.end()}};
-
}
/** Returns true if the specified token exists in the list.
diff --git a/src/beast/include/beast/http/streambuf_body.hpp b/src/beast/include/beast/http/streambuf_body.hpp
index 7b2fe581e..7271da7db 100644
--- a/src/beast/include/beast/http/streambuf_body.hpp
+++ b/src/beast/include/beast/http/streambuf_body.hpp
@@ -80,12 +80,6 @@ struct basic_streambuf_body
write(body_.data());
return true;
}
-
- auto
- data() const noexcept
- {
- return body_.data();
- }
};
};
diff --git a/src/beast/include/beast/http/write.hpp b/src/beast/include/beast/http/write.hpp
index 9544687b2..0489dda67 100644
--- a/src/beast/include/beast/http/write.hpp
+++ b/src/beast/include/beast/http/write.hpp
@@ -10,6 +10,7 @@
#include
#include
+#include
#include
#include
@@ -73,15 +74,16 @@ write(SyncWriteStream& stream,
*/
template
+ class WriteHandler>
#if GENERATING_DOCS
void_or_deduced
#else
-auto
+typename async_completion<
+ WriteHandler, void(error_code)>::result_type
#endif
async_write(AsyncWriteStream& stream,
message const& msg,
- CompletionToken&& token);
+ WriteHandler&& handler);
} // http
} // beast
diff --git a/src/beast/include/beast/impl/streambuf_readstream.ipp b/src/beast/include/beast/impl/streambuf_readstream.ipp
index 9c52df411..e35e9313a 100644
--- a/src/beast/include/beast/impl/streambuf_readstream.ipp
+++ b/src/beast/include/beast/impl/streambuf_readstream.ipp
@@ -8,7 +8,6 @@
#ifndef BEAST_IMPL_STREAMBUF_READSTREAM_IPP
#define BEAST_IMPL_STREAMBUF_READSTREAM_IPP
-#include
#include
#include
#include
@@ -61,7 +60,7 @@ public:
std::size_t bytes_transferred);
friend
- auto asio_handler_allocate(
+ void* asio_handler_allocate(
std::size_t size, read_some_op* op)
{
return boost_asio_handler_alloc_helpers::
@@ -69,7 +68,7 @@ public:
}
friend
- auto asio_handler_deallocate(
+ void asio_handler_deallocate(
void* p, std::size_t size, read_some_op* op)
{
return boost_asio_handler_alloc_helpers::
@@ -77,7 +76,7 @@ public:
}
friend
- auto asio_handler_is_continuation(read_some_op* op)
+ bool asio_handler_is_continuation(read_some_op* op)
{
return boost_asio_handler_cont_helpers::
is_continuation(op->d_->h);
@@ -85,7 +84,7 @@ public:
template
friend
- auto asio_handler_invoke(Function&& f, read_some_op* op)
+ void asio_handler_invoke(Function&& f, read_some_op* op)
{
return boost_asio_handler_invoke_helpers::
invoke(f, op->d_->h);
@@ -170,7 +169,9 @@ template
auto
streambuf_readstream::
async_write_some(ConstBufferSequence const& buffers,
- WriteHandler&& handler)
+ WriteHandler&& handler) ->
+ typename async_completion<
+ WriteHandler, void(error_code)>::result_type
{
static_assert(is_ConstBufferSequence<
ConstBufferSequence>::value,
@@ -234,7 +235,9 @@ auto
streambuf_readstream::
async_read_some(
MutableBufferSequence const& buffers,
- ReadHandler&& handler)
+ ReadHandler&& handler) ->
+ typename async_completion<
+ ReadHandler, void(error_code)>::result_type
{
static_assert(is_MutableBufferSequence<
MutableBufferSequence>::value,
diff --git a/src/beast/include/beast/streambuf_readstream.hpp b/src/beast/include/beast/streambuf_readstream.hpp
index 8b5bb7705..7d88ee81c 100644
--- a/src/beast/include/beast/streambuf_readstream.hpp
+++ b/src/beast/include/beast/streambuf_readstream.hpp
@@ -8,6 +8,7 @@
#ifndef BEAST_STREAMBUF_READSTREAM_HPP
#define BEAST_STREAMBUF_READSTREAM_HPP
+#include
#include
#include
#include
@@ -101,7 +102,7 @@ public:
/// The type of the next layer.
using next_layer_type =
- std::remove_reference_t;
+ typename std::remove_reference::type;
/// The type of the lowest layer.
using lowest_layer_type =
@@ -215,7 +216,8 @@ public:
/// Start an asynchronous write. The data being written must be valid for the
/// lifetime of the asynchronous operation.
template
- auto
+ typename async_completion<
+ WriteHandler, void(error_code)>::result_type
async_write_some(ConstBufferSequence const& buffers,
WriteHandler&& handler);
@@ -235,7 +237,8 @@ public:
/// Start an asynchronous read. The buffer into which the data will be read
/// must be valid for the lifetime of the asynchronous operation.
template
- auto
+ typename async_completion<
+ ReadHandler, void(error_code)>::result_type
async_read_some(MutableBufferSequence const& buffers,
ReadHandler&& handler);
};
diff --git a/src/beast/include/beast/type_check.hpp b/src/beast/include/beast/type_check.hpp
index 16dfa8c84..43c49f9b3 100644
--- a/src/beast/include/beast/type_check.hpp
+++ b/src/beast/include/beast/type_check.hpp
@@ -338,7 +338,7 @@ public:
/// Determine if `T` meets the requirements of `CompletionHandler`.
template
using is_Handler = std::integral_constant>::value &&
+ std::is_copy_constructible::type>::value &&
detail::is_call_possible::value>;
#endif
diff --git a/src/beast/include/beast/websocket/detail/invokable.hpp b/src/beast/include/beast/websocket/detail/invokable.hpp
index 37053fc8f..d049df65b 100644
--- a/src/beast/include/beast/websocket/detail/invokable.hpp
+++ b/src/beast/include/beast/websocket/detail/invokable.hpp
@@ -134,7 +134,7 @@ private:
base&
get()
{
- return *reinterpret_cast(buf_);
+ return *reinterpret_cast(&buf_[0]);
}
};
diff --git a/src/beast/include/beast/websocket/detail/mask.hpp b/src/beast/include/beast/websocket/detail/mask.hpp
index f5ebaddd7..e37fdca50 100644
--- a/src/beast/include/beast/websocket/detail/mask.hpp
+++ b/src/beast/include/beast/websocket/detail/mask.hpp
@@ -106,28 +106,28 @@ prepare_key(std::uint64_t& prepared, std::uint32_t key)
template
inline
-std::enable_if_t::value, T>
+typename std::enable_if::value, T>::type
rol(T t, unsigned n = 1)
{
auto constexpr bits =
static_cast(
sizeof(T) * CHAR_BIT);
n &= bits-1;
- return static_cast((t << n) |
- (static_cast>(t) >> (bits - n)));
+ return static_cast((t << n) | (
+ static_cast::type>(t) >> (bits - n)));
}
template
inline
-std::enable_if_t::value, T>
+typename std::enable_if