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/EnvelopeParser.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/EnvelopeParser.h')
-rw-r--r-- | src/HTTPServer/EnvelopeParser.h | 73 |
1 files changed, 0 insertions, 73 deletions
diff --git a/src/HTTPServer/EnvelopeParser.h b/src/HTTPServer/EnvelopeParser.h deleted file mode 100644 index 2fa930539..000000000 --- a/src/HTTPServer/EnvelopeParser.h +++ /dev/null @@ -1,73 +0,0 @@ - -// EnvelopeParser.h - -// Declares the cEnvelopeParser class representing a parser for RFC-822 envelope headers, used both in HTTP and in MIME - - - - - -#pragma once - - - - - -class cEnvelopeParser -{ -public: - class cCallbacks - { - public: - // Force a virtual destructor in descendants: - virtual ~cCallbacks() {} - - /** Called when a full header line is parsed */ - virtual void OnHeaderLine(const AString & a_Key, const AString & a_Value) = 0; - } ; - - - cEnvelopeParser(cCallbacks & a_Callbacks); - - /** Parses the incoming data. - Returns the number of bytes consumed from the input. The bytes not consumed are not part of the envelope header. - Returns AString::npos on error - */ - size_t Parse(const char * a_Data, size_t a_Size); - - /** Makes the parser forget everything parsed so far, so that it can be reused for parsing another datastream */ - void Reset(void); - - /** Returns true if more input is expected for the envelope header */ - bool IsInHeaders(void) const { return m_IsInHeaders; } - - /** Sets the IsInHeaders flag; used by cMultipartParser to simplify the parser initial conditions */ - void SetIsInHeaders(bool a_IsInHeaders) { m_IsInHeaders = a_IsInHeaders; } - -public: - /** Callbacks to call for the various events */ - cCallbacks & m_Callbacks; - - /** Set to true while the parser is still parsing the envelope headers. Once set to true, the parser will not consume any more data. */ - bool m_IsInHeaders; - - /** Buffer for the incoming data until it is parsed */ - AString m_IncomingData; - - /** Holds the last parsed key; used for line-wrapped values */ - AString m_LastKey; - - /** Holds the last parsed value; used for line-wrapped values */ - AString m_LastValue; - - - /** Notifies the callback of the key / value stored in m_LastKey / m_LastValue, then erases them */ - void NotifyLast(void); - - /** Parses one line of header data. Returns true if successful */ - bool ParseLine(const char * a_Data, size_t a_Size); -} ; - - - - |