From 73780d7f664a4ea1da55527d726b4c9c7753f1fb Mon Sep 17 00:00:00 2001 From: Julian Andres Klode Date: Tue, 11 Aug 2020 10:55:09 +0200 Subject: http: Fully flush local file both before/after server read We do not want to end up in a code path while reading content from the server where we have local data left to write, which can happen if a previous read included both headers and content. Restructure Flush() to accept a new argument to allow incomplete flushs (which do not match our limit), so that it can flush as far as possible, and modify Go() and use that before and after reading from the server. --- methods/http.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'methods/http.h') diff --git a/methods/http.h b/methods/http.h index 5668f0b87..cae579afe 100644 --- a/methods/http.h +++ b/methods/http.h @@ -114,7 +114,7 @@ struct HttpServerState: public ServerState virtual bool InitHashes(HashStringList const &ExpectedHashes) APT_OVERRIDE; virtual Hashes * GetHashes() APT_OVERRIDE; virtual ResultState Die(RequestState &Req) APT_OVERRIDE; - virtual bool Flush(FileFd * const File) APT_OVERRIDE; + virtual bool Flush(FileFd *const File, bool MustComplete = true) APT_OVERRIDE; virtual ResultState Go(bool ToFile, RequestState &Req) APT_OVERRIDE; HttpServerState(URI Srv, HttpMethod *Owner); -- cgit v1.2.3