diff options
author | Julian Andres Klode <julian.klode@canonical.com> | 2018-11-02 18:19:33 +0100 |
---|---|---|
committer | Julian Andres Klode <julian.klode@canonical.com> | 2018-11-12 11:51:56 +0100 |
commit | fb3f36593563d09a8d1727cc7c6deb0b49823ca2 (patch) | |
tree | 9a4d28082ef1145c3bf60e2cc059dbc5a78908c0 | |
parent | 02abae0394c54ba43bfaf6c4e1b1bc0f39708e92 (diff) |
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
-rw-r--r-- | methods/http.cc | 7 |
1 files changed, 3 insertions, 4 deletions
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 |