From 24efa37846382ca09db821b374dde08d0cdc8fed Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adrien=20B=C3=A9raud?= Date: Sun, 8 Dec 2019 00:25:21 -0500 Subject: [PATCH] http: cleanup --- src/http.cpp | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/src/http.cpp b/src/http.cpp index 2548fd95..aadab647 100644 --- a/src/http.cpp +++ b/src/http.cpp @@ -920,16 +920,12 @@ Request::handle_response(const asio::error_code& ec, size_t n_bytes) } if (state_ != State::DONE and parser_ and not http_body_is_final(parser_.get())) { - if (auto toRead = parser_->content_length ? std::min(parser_->content_length, 64 * 1024) : 64 * 1024) { - if (logger_) - logger_->d("[http:request:%i] read more %llu", id_, toRead); - - std::weak_ptr wthis = shared_from_this(); - conn_->async_read_some(toRead, [wthis](const asio::error_code& ec, size_t bytes){ - if (auto sthis = wthis.lock()) - sthis->handle_response(ec, bytes); - }); - } + auto toRead = parser_->content_length ? std::min(parser_->content_length, 64 * 1024) : 64 * 1024; + std::weak_ptr wthis = shared_from_this(); + conn_->async_read_some(toRead, [wthis](const asio::error_code& ec, size_t bytes){ + if (auto sthis = wthis.lock()) + sthis->handle_response(ec, bytes); + }); } }