From fb3f36593563d09a8d1727cc7c6deb0b49823ca2 Mon Sep 17 00:00:00 2001 From: Julian Andres Klode Date: Fri, 2 Nov 2018 18:19:33 +0100 Subject: http: Fix handling of server connection closure If the server closed the connection while we're reading data, and we end up not having any data left to write; that is, for example, we received 0 bytes, then we did not exit before, as we only returned success if there was data to write. This is wrong: Obviously, if we have reached our limit, we are done anyway. It's a bit unclear if we actually ever reached this part, but it does make some sense wrt the bug below. LP: #1801338 --- methods/http.cc | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'methods') diff --git a/methods/http.cc b/methods/http.cc index 2e7fca307..c40336410 100644 --- a/methods/http.cc +++ b/methods/http.cc @@ -711,11 +711,10 @@ ResultState HttpServerState::Die(RequestState &Req) _error->Errno("write", _("Error writing to the file")); return ResultState::TRANSIENT_ERROR; } - - // Done - if (In.IsLimit() == true) - return ResultState::SUCCESSFUL; } + // Done + if (In.IsLimit() == true) + return ResultState::SUCCESSFUL; } // See if this is because the server finished the data stream -- cgit v1.2.3