diff options
author | Mattes D <github@xoft.cz> | 2016-01-03 15:59:55 +0100 |
---|---|---|
committer | Mattes D <github@xoft.cz> | 2016-03-01 16:19:56 +0100 |
commit | fea556ca1b8aeec975f5276d5d829ee6275841d9 (patch) | |
tree | 9a61a61edbb232c01bfb34e1c2959542d470887e /src/HTTPServer/TransferEncodingParser.h | |
parent | Added HTTPResponseParser. (diff) | |
download | cuberite-fea556ca1b8aeec975f5276d5d829ee6275841d9.tar cuberite-fea556ca1b8aeec975f5276d5d829ee6275841d9.tar.gz cuberite-fea556ca1b8aeec975f5276d5d829ee6275841d9.tar.bz2 cuberite-fea556ca1b8aeec975f5276d5d829ee6275841d9.tar.lz cuberite-fea556ca1b8aeec975f5276d5d829ee6275841d9.tar.xz cuberite-fea556ca1b8aeec975f5276d5d829ee6275841d9.tar.zst cuberite-fea556ca1b8aeec975f5276d5d829ee6275841d9.zip |
Diffstat (limited to 'src/HTTPServer/TransferEncodingParser.h')
-rw-r--r-- | src/HTTPServer/TransferEncodingParser.h | 76 |
1 files changed, 0 insertions, 76 deletions
diff --git a/src/HTTPServer/TransferEncodingParser.h b/src/HTTPServer/TransferEncodingParser.h deleted file mode 100644 index ce3d01df7..000000000 --- a/src/HTTPServer/TransferEncodingParser.h +++ /dev/null @@ -1,76 +0,0 @@ - -// TransferEncodingParser.h - -// Declares the cTransferEncodingParser class representing the parser for the various transfer encodings (chunked etc.) - -#pragma once - - - - - -// fwd: -class cTransferEncodingParser; -typedef SharedPtr<cTransferEncodingParser> cTransferEncodingParserPtr; - - - - - -/** Used as both the interface that all the parsers share and the (static) factory creating such parsers. */ -class cTransferEncodingParser -{ -public: - class cCallbacks - { - public: - // Force a virtual destructor in descendants - virtual ~cCallbacks() {} - - /** Called when an error has occured while parsing. */ - virtual void OnError(const AString & a_ErrorDescription) = 0; - - /** Called for each chunk of the incoming body data. */ - virtual void OnBodyData(const void * a_Data, size_t a_Size) = 0; - - /** Called when the entire body has been reported by OnBodyData(). */ - virtual void OnBodyFinished(void) = 0; - }; - - - // Force a virtual destructor in all descendants - virtual ~cTransferEncodingParser() {} - - /** Parses the incoming data and calls the appropriate callbacks. - Returns the number of bytes from the end of a_Data that is already not part of this message (if the parser can detect it). - Returns AString::npos on an error. */ - virtual size_t Parse(const char * a_Data, size_t a_Size) = 0; - - /** To be called when the stream is terminated from the source (connection closed). - Flushes any buffers and calls appropriate callbacks. */ - virtual void Finish(void) = 0; - - /** Creates a new parser for the specified encoding. - If the encoding is not known, returns a nullptr. - a_ContentLength is the length of the content, received in a Content-Length header. - It is used for the Identity encoding, it is ignored for the Chunked encoding. */ - static cTransferEncodingParserPtr Create( - cCallbacks & a_Callbacks, - const AString & a_TransferEncoding, - size_t a_ContentLength - ); - -protected: - /** The callbacks used to report progress. */ - cCallbacks & m_Callbacks; - - - cTransferEncodingParser(cCallbacks & a_Callbacks): - m_Callbacks(a_Callbacks) - { - } -}; - - - - |