summaryrefslogtreecommitdiff
path: root/methods/http.cc
diff options
context:
space:
mode:
authorJulian Andres Klode <julian.klode@canonical.com>2020-06-29 11:32:12 +0200
committerJulian Andres Klode <julian.klode@canonical.com>2020-07-24 16:30:43 +0200
commit22e3e12b43a8cf0fdb3a474fd5800c4db496423d (patch)
tree88cfd0e4ec60cca0aa62192cc9e4db6789c08b27 /methods/http.cc
parentf21ca6d73dacc277e0b3d7a8fa15b2c30633d3ae (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.
Diffstat (limited to 'methods/http.cc')
-rw-r--r--methods/http.cc4
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;
}