diff options
author | Julian Andres Klode <julian.klode@canonical.com> | 2020-06-29 11:32:12 +0200 |
---|---|---|
committer | Julian Andres Klode <julian.klode@canonical.com> | 2020-07-24 16:30:43 +0200 |
commit | 22e3e12b43a8cf0fdb3a474fd5800c4db496423d (patch) | |
tree | 88cfd0e4ec60cca0aa62192cc9e4db6789c08b27 | |
parent | f21ca6d73dacc277e0b3d7a8fa15b2c30633d3ae (diff) |
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.
-rw-r--r-- | methods/http.cc | 4 |
1 files changed, 2 insertions, 2 deletions
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; } |