@@ -80,8 +80,7 @@ namespace network {
8080
8181void read_response_status (const boost::system::error_code &ec,
8282 std::size_t bytes_written,
83- std::shared_ptr<request_context> context,
84- std::shared_ptr<response> res);
83+ std::shared_ptr<request_context> context);
8584
8685void read_response_headers (const boost::system::error_code &ec,
8786 std::size_t bytes_read,
@@ -299,19 +298,17 @@ namespace network {
299298 }
300299
301300// Create a response object and fill it with the status from the server.
302- std::shared_ptr<response>res (new response{});
303301 context->connection_ ->async_read_until (
304302 context->response_buffer_ ," \r\n " ,
305303 strand_.wrap ([=](const boost::system::error_code &ec,
306304 std::size_t bytes_read) {
307- read_response_status (ec, bytes_read, context, res );
305+ read_response_status (ec, bytes_read, context);
308306 }));
309307 }
310308
311309void client::impl::read_response_status (
312310const boost::system::error_code &ec, std::size_t ,
313- std::shared_ptr<request_context> context,
314- std::shared_ptr<response> res) {
311+ std::shared_ptr<request_context> context) {
315312if (timedout_) {
316313set_error (boost::asio::error::timed_out, context);
317314return ;
@@ -331,6 +328,11 @@ namespace network {
331328 string_type message;
332329std::getline (is, message);
333330
331+ // if options_.follow_redirects()
332+ // and if status in range 300 - 307
333+ // then take the request and reset the URL
334+
335+ std::shared_ptr<response>res (new response{});
334336 res->set_version (version);
335337 res->set_status (network::http::v2::status::code (status));
336338 res->set_status_message (boost::trim_copy (message));