From 1ee3b64be054a8deb6a598d93047637448e1928e Mon Sep 17 00:00:00 2001 From: Julian Andres Klode Date: Mon, 29 Jun 2020 11:37:29 +0200 Subject: 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. --- methods/http.cc | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'methods') 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 -- cgit v1.2.3