This is not a complete fix. Compiling, for example, thehttp_client example, you run into more errors of the same kind: C:\cpp-netlib\boost/network/protocol/http/policies/async_connection.hpp(60): error C2664: 'boost::network::http::basic_response<Tag> boost::network::http::impl::async_connection_base<Tag,1,1>::start(const boost::network::http::basic_request<Tag> &,const std::basic_string<char,std::char_traits<char>,std::allocator<char>> &,bool,std::function<void (const boost::iterator_range<std::_Array_const_iterator<_Ty,1024>> &,const std::error_code &)>,std::function<bool (std::basic_string<char,std::char_traits<char>,std::allocator<_Ty>> &)>)': cannot convert argument 4 from 'boost::network::http::async_connection_policy<Tag,1,1>::body_callback_function_type' to 'std::function<void (const boost::iterator_range<std::_Array_const_iterator<_Ty,1024>> &,const std::error_code &)>'
It looks likeasync_connection_policy ---and perhaps other classes---still have the oldconst char * iterator type on their callback type. Below is a diff (against the0.12-release branch) that gets around all the compilation errors. I have no idea if it breaks anything, though. Note that theservers.ipp patch is unrelated to this issue, but fixes#662. diff --git a/boost/network/protocol/http/client/async_impl.hpp b/boost/network/protocol/http/client/async_impl.hppindex fb1dc50..5fc6d43 100644--- a/boost/network/protocol/http/client/async_impl.hpp+++ b/boost/network/protocol/http/client/async_impl.hpp@@ -31,7 +31,7 @@ struct async_client typedef typename resolver<Tag>::type resolver_type; typedef typename string<Tag>::type string_type;- typedef std::function<void(boost::iterator_range<char const*> const&,+ typedef std::function<void(boost::iterator_range<typename std::array<typename char_<Tag>::type, 1024>::const_iterator> const&, std::error_code const&)> body_callback_function_type;diff --git a/boost/network/protocol/http/client/connection/async_normal.hpp b/boost/network/protocol/http/client/connection/async_normal.hppindex 240a42a..b3fe72a 100644--- a/boost/network/protocol/http/client/connection/async_normal.hpp+++ b/boost/network/protocol/http/client/connection/async_normal.hpp@@ -128,7 +128,7 @@ struct http_async_connection this->destination_promise.set_exception(std::make_exception_ptr(error)); this->body_promise.set_exception(std::make_exception_ptr(error)); if ( callback )- callback( boost::iterator_range<const char*>(), ec );+ callback( boost::iterator_range<typename std::array<typename char_<Tag>::type, 1024>::const_iterator>(), ec ); this->timer_.cancel(); }@@ -321,7 +321,7 @@ struct http_async_connection // body (in the case of a HEAD request). this->body_promise.set_value(""); if ( callback )- callback( boost::iterator_range<const char*>(), ::asio::error::eof );+ callback( boost::iterator_range<typename std::array<typename char_<Tag>::type, 1024>::const_iterator>(), ::asio::error::eof ); this->destination_promise.set_value(""); this->source_promise.set_value(""); // this->part.assign('\0');@@ -392,7 +392,7 @@ struct http_async_connection } else { string_type body_string; std::swap(body_string, this->partial_parsed);- body_string.append(this->part.begin(), bytes_transferred);+ body_string.append(this->part.begin(), this->part.begin() + bytes_transferred); if (this->is_chunk_encoding) { this->body_promise.set_value(parse_chunk_encoding(body_string)); } else {@@ -468,7 +468,7 @@ struct http_async_connection this->body_promise.set_exception(std::make_exception_ptr(error)); } else- callback( boost::iterator_range<const char*>(), report_code );+ callback( boost::iterator_range<typename std::array<typename char_<Tag>::type, 1024>::const_iterator>(), report_code ); break; default: BOOST_ASSERT(false && "Bug, report this to the developers!");diff --git a/boost/network/protocol/http/client/connection/async_protocol_handler.hpp b/boost/network/protocol/http/client/connection/async_protocol_handler.hppindex b350862..5ceb103 100644--- a/boost/network/protocol/http/client/connection/async_protocol_handler.hpp+++ b/boost/network/protocol/http/client/connection/async_protocol_handler.hpp@@ -328,7 +328,7 @@ struct http_async_protocol_handler { void parse_body(Delegate& delegate_, Callback callback, size_t bytes) { // TODO(dberris): we should really not use a string for the partial body // buffer.- partial_parsed.append(part_begin, bytes);+ partial_parsed.append(part_begin, part_begin + bytes); part_begin = part.begin(); delegate_->read_some( ::asio::mutable_buffers_1(part.data(), part.size()), callback);diff --git a/boost/network/protocol/http/client/facade.hpp b/boost/network/protocol/http/client/facade.hppindex ff05d07..c447dc1 100644--- a/boost/network/protocol/http/client/facade.hpp+++ b/boost/network/protocol/http/client/facade.hpp@@ -45,7 +45,7 @@ class basic_client_facade { * body as it comes in. In case of errors, the second argument is an error * code. */- typedef std::function<void(iterator_range<char const*> const&,+ typedef std::function<void(iterator_range<typename std::array<typename char_<Tag>::type, 1024>::const_iterator> const&, std::error_code const&)> body_callback_function_type;diff --git a/boost/network/protocol/http/policies/async_connection.hpp b/boost/network/protocol/http/policies/async_connection.hppindex 34a1f0c..f1a43a6 100644--- a/boost/network/protocol/http/policies/async_connection.hpp+++ b/boost/network/protocol/http/policies/async_connection.hpp@@ -30,7 +30,7 @@ struct async_connection_policy : resolver_policy<Tag>::type { typedef typename resolver_base::resolve_function resolve_function; typedef typename resolver_base::resolve_completion_function resolve_completion_function;- typedef std::function<void(iterator_range<char const*> const&,+ typedef std::function<void(iterator_range<typename std::array<typename char_<Tag>::type, 1024>::const_iterator> const&, std::error_code const&)> body_callback_function_type; typedef std::function<bool(string_type&)> body_generator_function_type;diff --git a/boost/network/protocol/http/server/async_connection.hpp b/boost/network/protocol/http/server/async_connection.hppindex 915c6fb..e9394c7 100644--- a/boost/network/protocol/http/server/async_connection.hpp+++ b/boost/network/protocol/http/server/async_connection.hpp@@ -579,7 +579,7 @@ struct async_connection } new_start = std::end(result_range); auto self = this->shared_from_this();- thread_pool().post([this, self] { handler(request_, self); });+ thread_pool().post([this, self]() { handler(request_, self); }); return; } else { partial_parsed.append(std::begin(result_range),diff --git a/boost/network/protocol/http/server/impl/parsers.ipp b/boost/network/protocol/http/server/impl/parsers.ippindex b0de375..b3f733a 100644--- a/boost/network/protocol/http/server/impl/parsers.ipp+++ b/boost/network/protocol/http/server/impl/parsers.ipp@@ -56,9 +56,9 @@ BOOST_NETWORK_INLINE void parse_version( BOOST_NETWORK_INLINE void parse_headers( std::string const& input, std::vector<request_header_narrow>& container) {- using namespace boost::spirit::qi; u8_to_u32_iterator<std::string::const_iterator> begin = input.begin(), end = input.end();+ using namespace boost::spirit::qi; typedef as<boost::spirit::traits::u32_string> as_u32_string; parse(begin, end, *(+((alnum | punct) - ':') >> lit(": ") >>
|
There was a mismatch in the iterator type. I don't have access to VS2015, so it is as yet untested.