From 22e3e12b43a8cf0fdb3a474fd5800c4db496423d Mon Sep 17 00:00:00 2001 From: Julian Andres Klode Date: Mon, 29 Jun 2020 11:32:12 +0200 Subject: http: Always Close() the connection in Die() If we reached Die() there was an issue with the server connection, so we should always explicitly close it. --- methods/http.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'methods') diff --git a/methods/http.cc b/methods/http.cc index 1d2c41337..76d4f6b5a 100644 --- a/methods/http.cc +++ b/methods/http.cc @@ -700,6 +700,8 @@ ResultState HttpServerState::Die(RequestState &Req) { unsigned int LErrno = errno; + Close(); + // Dump the buffer to the file if (Req.State == RequestState::Data) { @@ -727,7 +729,6 @@ ResultState HttpServerState::Die(RequestState &Req) if (In.IsLimit() == false && Req.State != RequestState::Header && Persistent == true) { - Close(); if (LErrno == 0) { _error->Error(_("Error reading from server. Remote end closed connection")); @@ -746,7 +747,6 @@ ResultState HttpServerState::Die(RequestState &Req) return ResultState::TRANSIENT_ERROR; // We may have got multiple responses back in one packet.. - Close(); return ResultState::SUCCESSFUL; } -- cgit v1.2.3