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