diff options
| author | Stefan Boberg <[email protected]> | 2021-09-13 12:24:59 +0200 |
|---|---|---|
| committer | Stefan Boberg <[email protected]> | 2021-09-13 12:24:59 +0200 |
| commit | 4e2649977d034b913413d2cb35d4a88afc30393f (patch) | |
| tree | 9258d4329a2217d581aaedfb251a655692987d4d /zenhttp/include | |
| parent | Added Ref<>::Get to work around issue casting a pointer to a derived type to ... (diff) | |
| download | zen-4e2649977d034b913413d2cb35d4a88afc30393f.tar.xz zen-4e2649977d034b913413d2cb35d4a88afc30393f.zip | |
Changed interface for httpServerRequest::SessionId()/RequestId() so they share storage and lazy eval logic
They now call into ParseSessionId()/ParseRequestId() when required
Eliminates redundant logic in derived implementations
Also moved package transport code into httpshared.(cpp|h) for easier sharing with client code
Added some I/O error reporting in http.sys related code
Changed IHttpPackageHandler interface to support partially updated handling flow
Diffstat (limited to 'zenhttp/include')
| -rw-r--r-- | zenhttp/include/zenhttp/httpserver.h | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/zenhttp/include/zenhttp/httpserver.h b/zenhttp/include/zenhttp/httpserver.h index f859eb038..44559db53 100644 --- a/zenhttp/include/zenhttp/httpserver.h +++ b/zenhttp/include/zenhttp/httpserver.h @@ -213,9 +213,9 @@ public: inline HttpContentType RequestContentType() { return m_ContentType; } inline HttpContentType AcceptContentType() { return m_AcceptType; } - inline uint64_t ContentLength() const { return m_ContentLength; } - virtual Oid SessionId() const; - virtual uint32_t RequestId() const; + inline uint64_t ContentLength() const { return m_ContentLength; } + Oid SessionId() const; + uint32_t RequestId() const; inline bool IsHandled() const { return !!(m_Flags & kIsHandled); } inline bool SuppressBody() const { return !!(m_Flags & kSuppressBody); } @@ -265,15 +265,18 @@ protected: mutable Oid m_SessionId = Oid::Zero; inline void SetIsHandled() { m_Flags |= kIsHandled; } + + virtual Oid ParseSessionId() const = 0; + virtual uint32_t ParseRequestId() const = 0; }; class IHttpPackageHandler : public RefCounted { public: virtual void FilterOffer(std::vector<IoHash>& OfferCids) = 0; - virtual void OnBeginChunks() = 0; + virtual void OnRequestBegin() = 0; virtual IoBuffer CreateTarget(const IoHash& Cid, uint64_t StorageSize) = 0; - virtual void OnEndChunks() = 0; + virtual void OnRequestComplete() = 0; }; /** |