diff --git a/methods/http.cc b/methods/http.cc index e72c61296ec98d82f48bdb8f0029fcb5aead9494..d1f6aaa60cc150027381f23f1ea3a5b6e032828d 100644 --- a/methods/http.cc +++ b/methods/http.cc @@ -695,6 +695,8 @@ ResultState HttpServerState::Die(RequestState &Req) { unsigned int LErrno = errno; + Close(); + // Dump the buffer to the file if (Req.State == RequestState::Data) { @@ -722,7 +724,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")); @@ -741,7 +742,6 @@ ResultState HttpServerState::Die(RequestState &Req) return ResultState::TRANSIENT_ERROR; // We may have got multiple responses back in one packet.. - Close(); return ResultState::SUCCESSFUL; }