45 virtual void OnBodyData(
const void * a_Data,
size_t a_Size) = 0;
56 size_t Parse(
const char * a_Data,
size_t a_Size);
110 size_t ParseBody(
const char * a_Data,
size_t a_Size);
119 virtual void OnError(
const AString & a_ErrorDescription)
override;
120 virtual void OnBodyData(
const void * a_Data,
size_t a_Size)
override;
std::shared_ptr< cTransferEncodingParser > cTransferEncodingParserPtr
void Reset(void)
Resets the parser to the initial state, so that a new request can be parsed.
virtual void OnBodyData(const void *a_Data, size_t a_Size) override
Called for each chunk of the incoming body data.
size_t Parse(const char *a_Data, size_t a_Size)
Parses the incoming data and calls the appropriate callbacks.
cCallbacks & m_Callbacks
The callbacks used for reporting.
void Finish(void)
Called when the server indicates no more data will be sent (HTTP 1.0 socket closed).
virtual void OnBodyFinished(void) override
Called when the entire body has been reported by OnBodyData().
virtual void OnError(const AString &a_ErrorDescription) override
Called when an error has occured while parsing.
bool m_IsFinished
True if the response has been fully parsed.
cEnvelopeParser m_EnvelopeParser
Parser for the envelope data (headers)
cHTTPMessageParser(cCallbacks &a_Callbacks)
Creates a new parser instance that will use the specified callbacks for reporting.
void HeadersFinished(void)
Called internally when the headers-parsing has just finished.
size_t m_ContentLength
The content length, parsed from the headers, if available.
AString m_FirstLine
The complete first line of the response.
size_t ParseBody(const char *a_Data, size_t a_Size)
Parses the message body.
AString m_TransferEncoding
The transfer encoding to be used by the parser.
virtual void OnHeaderLine(const AString &a_Key, const AString &a_Value) override
Called when a full header line is parsed.
bool IsFinished(void) const
Returns true if the entire response has been already parsed.
size_t ParseFirstLine(void)
Parses the first line out of m_Buffer.
cTransferEncodingParserPtr m_TransferEncodingParser
The specific parser for the transfer encoding used by this response.
bool m_HasHadError
Set to true if an error has been encountered by the parser.
AString m_Buffer
Buffer for the incoming data until the status line is parsed.
virtual void OnHeaderLine(const AString &a_Key, const AString &a_Value)=0
Called when a single header line is parsed.
virtual void OnFirstLine(const AString &a_FirstLine)=0
Called when the first line of the request or response is fully parsed.
virtual void OnBodyFinished(void)=0
Called when the entire body has been reported by OnBodyData().
virtual void OnBodyData(const void *a_Data, size_t a_Size)=0
Called for each chunk of the incoming body data.
virtual void OnError(const AString &a_ErrorDescription)=0
Called when an error has occured while parsing.
virtual void OnHeadersFinished(void)=0
Called when all the headers have been parsed.