Skip to content

Commit 770cacc

Browse files
FrodeFrode
Frode
authored and
Frode
committed
Corrected iterator type
1 parent f2427fd commit 770cacc

File tree

6 files changed

+11
-9
lines changed

6 files changed

+11
-9
lines changed

boost/network/protocol/http/client/async_impl.hpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ struct async_client
3131
typedef typename resolver<Tag>::type resolver_type;
3232
typedef typename string<Tag>::type string_type;
3333

34-
typedef std::function<void(boost::iterator_range<char const*> const&,
34+
typedef std::function<void(boost::iterator_range<typename std::array<typename char_<Tag>::type, 1024>::const_iterator> const&,
3535
boost::system::error_code const&)>
3636
body_callback_function_type;
3737

boost/network/protocol/http/client/connection/async_normal.hpp

+4-4
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ struct http_async_connection
128128
this->destination_promise.set_exception(std::make_exception_ptr(error));
129129
this->body_promise.set_exception(std::make_exception_ptr(error));
130130
if ( callback )
131-
callback( boost::iterator_range<const char*>(), ec );
131+
callback( boost::iterator_range<typename std::array<typename char_<Tag>::type, 1024>::const_iterator>(), ec );
132132
this->timer_.cancel();
133133
}
134134

@@ -321,7 +321,7 @@ struct http_async_connection
321321
// body (in the case of a HEAD request).
322322
this->body_promise.set_value("");
323323
if ( callback )
324-
callback( boost::iterator_range<const char*>(), boost::asio::error::eof );
324+
callback( boost::iterator_range<typename std::array<typename char_<Tag>::type, 1024>::const_iterator>(), boost::asio::error::eof );
325325
this->destination_promise.set_value("");
326326
this->source_promise.set_value("");
327327
// this->part.assign('\0');
@@ -392,7 +392,7 @@ struct http_async_connection
392392
} else {
393393
string_type body_string;
394394
std::swap(body_string, this->partial_parsed);
395-
body_string.append(this->part.begin(), bytes_transferred);
395+
body_string.append(this->part.begin(), this->part.begin() + bytes_transferred);
396396
if (this->is_chunk_encoding) {
397397
this->body_promise.set_value(parse_chunk_encoding(body_string));
398398
} else {
@@ -468,7 +468,7 @@ struct http_async_connection
468468
this->body_promise.set_exception(std::make_exception_ptr(error));
469469
}
470470
else
471-
callback( boost::iterator_range<const char*>(), report_code );
471+
callback( boost::iterator_range<typename std::array<typename char_<Tag>::type, 1024>::const_iterator>(), report_code );
472472
break;
473473
default:
474474
BOOST_ASSERT(false && "Bug, report this to the developers!");

boost/network/protocol/http/client/connection/async_protocol_handler.hpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -328,7 +328,7 @@ struct http_async_protocol_handler {
328328
void parse_body(Delegate& delegate_, Callback callback, size_t bytes) {
329329
// TODO(dberris): we should really not use a string for the partial body
330330
// buffer.
331-
partial_parsed.append(part_begin, bytes);
331+
partial_parsed.append(part_begin, part_begin + bytes);
332332
part_begin = part.begin();
333333
delegate_->read_some(
334334
boost::asio::mutable_buffers_1(part.data(), part.size()), callback);

boost/network/protocol/http/client/facade.hpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ class basic_client_facade {
3939
* body as it comes in. In case of errors, the second argument is an error
4040
* code.
4141
*/
42-
typedef std::function<void(iterator_range<char const*> const&,
42+
typedef std::function<void(iterator_range<typename std::array<typename char_<Tag>::type, 1024>::const_iterator> const&,
4343
boost::system::error_code const&)>
4444
body_callback_function_type;
4545

boost/network/protocol/http/client/macros.hpp

+3-1
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,15 @@
66
// (See accompanying file LICENSE_1_0.txt or copy at
77
// http://www.boost.org/LICENSE_1_0.txt)
88

9+
#include <array>
910
#include <boost/range/iterator_range.hpp>
11+
#include <boost/network/traits/string.hpp>
1012
#include <system_error>
1113

1214
#ifndef BOOST_NETWORK_HTTP_BODY_CALLBACK
1315
#define BOOST_NETWORK_HTTP_BODY_CALLBACK(function_name, range_name, \
1416
error_name) \
15-
void function_name(boost::iterator_range<const char*> const& (range_name), \
17+
void function_name(boost::iterator_range<typename std::array<std::string::traits_type::char_type, 1024>::const_iterator> const& (range_name), \
1618
boost::system::error_code const& (error_name))
1719
#endif
1820

boost/network/protocol/http/policies/async_connection.hpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ struct async_connection_policy : resolver_policy<Tag>::type {
3030
typedef typename resolver_base::resolve_function resolve_function;
3131
typedef typename resolver_base::resolve_completion_function
3232
resolve_completion_function;
33-
typedef std::function<void(iterator_range<char const*> const&,
33+
typedef std::function<void(iterator_range<typename std::array<typename char_<Tag>::type, 1024>::const_iterator> const&,
3434
boost::system::error_code const&)>
3535
body_callback_function_type;
3636
typedef std::function<bool(string_type&)> body_generator_function_type;

0 commit comments

Comments
 (0)