diff options
author | David Kalnischkies <david@kalnischkies.de> | 2016-11-09 12:25:44 +0100 |
---|---|---|
committer | David Kalnischkies <david@kalnischkies.de> | 2016-12-31 02:29:21 +0100 |
commit | 13a9f08de18dea0dfc1951992b0ddeda9c2fa2dd (patch) | |
tree | 8ad39c2360ffe9cc7fee09baba04fa6fe3033dbd /methods/http.h | |
parent | cfc11b2e1d8480727208b9d3e9577172de9a4038 (diff) |
separating state variables regarding server/request
Having a Reset(bool) method to partially reset certain variables like
the download size always were strange, so this commit splits the
ServerState into an additional RequestState living on the stack for as
long as we deal with this request causing an automatic "reset".
There is much to do still to make this code look better, but this is a
good first step which compiles cleanly and passes all tests, so keeping
it as history might be beneficial and due to avoiding explicit memory
allocations it ends up fixing a small memory leak in https, too.
Closes: #440057
Diffstat (limited to 'methods/http.h')
-rw-r--r-- | methods/http.h | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/methods/http.h b/methods/http.h index b7341f5f8..4b0e77524 100644 --- a/methods/http.h +++ b/methods/http.h @@ -99,23 +99,23 @@ struct HttpServerState: public ServerState protected: virtual bool ReadHeaderLines(std::string &Data) APT_OVERRIDE; - virtual bool LoadNextResponse(bool const ToFile, FileFd * const File) APT_OVERRIDE; + virtual bool LoadNextResponse(bool const ToFile, RequestState &Req) APT_OVERRIDE; virtual bool WriteResponse(std::string const &Data) APT_OVERRIDE; public: - virtual void Reset(bool const Everything = true) APT_OVERRIDE; + virtual void Reset() APT_OVERRIDE; - virtual bool RunData(FileFd * const File) APT_OVERRIDE; - virtual bool RunDataToDevNull() APT_OVERRIDE; + virtual bool RunData(RequestState &Req) APT_OVERRIDE; + virtual bool RunDataToDevNull(RequestState &Req) APT_OVERRIDE; virtual bool Open() APT_OVERRIDE; virtual bool IsOpen() APT_OVERRIDE; virtual bool Close() APT_OVERRIDE; virtual bool InitHashes(HashStringList const &ExpectedHashes) APT_OVERRIDE; virtual Hashes * GetHashes() APT_OVERRIDE; - virtual bool Die(FileFd * const File) APT_OVERRIDE; + virtual bool Die(RequestState &Req) APT_OVERRIDE; virtual bool Flush(FileFd * const File) APT_OVERRIDE; - virtual bool Go(bool ToFile, FileFd * const File) APT_OVERRIDE; + virtual bool Go(bool ToFile, RequestState &Req) APT_OVERRIDE; HttpServerState(URI Srv, HttpMethod *Owner); virtual ~HttpServerState() {Close();}; @@ -128,7 +128,7 @@ class HttpMethod : public ServerMethod virtual std::unique_ptr<ServerState> CreateServerState(URI const &uri) APT_OVERRIDE; virtual void RotateDNS() APT_OVERRIDE; - virtual DealWithHeadersResult DealWithHeaders(FetchResult &Res) APT_OVERRIDE; + virtual DealWithHeadersResult DealWithHeaders(FetchResult &Res, RequestState &Req) APT_OVERRIDE; protected: std::string AutoDetectProxyCmd; |