summaryrefslogtreecommitdiff
path: root/methods
diff options
context:
space:
mode:
authorJulian Andres Klode <julian.klode@canonical.com>2020-06-29 11:37:29 +0200
committerJulian Andres Klode <julian.klode@canonical.com>2020-07-24 16:30:43 +0200
commit1ee3b64be054a8deb6a598d93047637448e1928e (patch)
tree4bb89f88dc3a91dd951902d817f3d56009388f3d /methods
parent22e3e12b43a8cf0fdb3a474fd5800c4db496423d (diff)
http: Die(): Merge flushing code from Flush()
Die() needs its own Copy() of Flush() because it needs to return success or failure based on some states, but those are not precisely the same as Flush(), as Flush() will always return false at the end, for example, but we want to fall through to our error handling.
Diffstat (limited to 'methods')
-rw-r--r--methods/http.cc5
1 files changed, 5 insertions, 0 deletions
diff --git a/methods/http.cc b/methods/http.cc
index 76d4f6b5a..fef719e74 100644
--- a/methods/http.cc
+++ b/methods/http.cc
@@ -711,6 +711,8 @@ ResultState HttpServerState::Die(RequestState &Req)
// can't be set
if (Req.File.Name() != "/dev/null")
SetNonBlock(Req.File.Fd(),false);
+ if (not In.WriteSpace())
+ return ResultState::SUCCESSFUL;
while (In.WriteSpace() == true)
{
if (In.Write(MethodFd::FromFd(Req.File.Fd())) == false)
@@ -723,6 +725,9 @@ ResultState HttpServerState::Die(RequestState &Req)
if (In.IsLimit() == true)
return ResultState::SUCCESSFUL;
}
+
+ if (In.IsLimit() == true || Persistent == false)
+ return ResultState::SUCCESSFUL;
}
// See if this is because the server finished the data stream