@@ -80,8 +80,7 @@ namespace network {
80
80
81
81
void read_response_status (const boost::system::error_code &ec,
82
82
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);
85
84
86
85
void read_response_headers (const boost::system::error_code &ec,
87
86
std::size_t bytes_read,
@@ -299,19 +298,17 @@ namespace network {
299
298
}
300
299
301
300
// Create a response object and fill it with the status from the server.
302
- std::shared_ptr<response> res (new response{});
303
301
context->connection_ ->async_read_until (
304
302
context->response_buffer_ , " \r\n " ,
305
303
strand_.wrap ([=](const boost::system ::error_code &ec,
306
304
std::size_t bytes_read) {
307
- read_response_status (ec, bytes_read, context, res );
305
+ read_response_status (ec, bytes_read, context);
308
306
}));
309
307
}
310
308
311
309
void client::impl::read_response_status (
312
310
const 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) {
315
312
if (timedout_) {
316
313
set_error (boost::asio::error::timed_out, context);
317
314
return ;
@@ -331,6 +328,11 @@ namespace network {
331
328
string_type message;
332
329
std::getline (is, message);
333
330
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{});
334
336
res->set_version (version);
335
337
res->set_status (network::http::v2::status::code (status));
336
338
res->set_status_message (boost::trim_copy (message));
0 commit comments