dodo
0.0.1
A C++ library to create containerized Linux services
|
Go to the documentation of this file.
24 #ifndef dodo_network_protocol_http_httpfragment_hpp
25 #define dodo_network_protocol_http_httpfragment_hpp
32 namespace network::protocol::http {
143 virtual std::string
asString()
const = 0;
@ peExpectingUnsignedInt
An unsigned int was expected.
virtual std::string asString() const =0
Convert the HTTPFragment in a HTTP protocol string.
@ peExpectingHeaderColon
A header field name was read, but no colon found after it.
static std::string getParseResultAsString(ParseError error)
Return the string description of a ParseError.
@ peIncomplete
Not an error, but more data is expected to complete.
@ peUnFinishedToken
A token is being parsed but is ending erroneously.
ParseResult(ParseError pe, common::SystemError se)
Explicit constructor.
@ peInvalidHeaderListEnd
A header list is not ending properly.
bool ok() const
Test if parseError == peOk && systemError == common::SystemError::ecOK.
Interface to read individual bytes whilst the implementation can read from an actual source (such as ...
void setSystemError(common::SystemError se)
Set the systemError.
@ peSystemError
The parse failed due to system error SocketReadBuffer::getLastError()
ParseResult()
Default constructor sets to { parseError = peOk; systemError = common::SystemError::ecOK; }
ParseError
Parse results returned by the parse functions.
Generic HTTP fragment, either a complete (such as HTTPRequest) or incomplete HTTP fragment (ssuch as ...
@ peInvalidChunkHex
The hex chunk size is invalid.
std::string asString() const
Get the system error string.
A C++ platform interface to lean Linux services tailored for containerized deployment.
@ peInvalidRequestLine
The request line is invalid.
@ peInvalidTransferEncoding
The specified transfer-encoding header is invalid.
common::SystemError getSystemError() const
Return the systemError.
virtual ParseResult parse(VirtualReadBuffer &buffer)=0
Read a complete HTTPFragment from a VirtualReadBuffer.
@ peUnexpectedBody
A message body is present but should not be there.
Used to convey parsing succces.
bool eof() const
Test if systemError == common::SystemError::ecEAGAIN
@ peInvalidLastChunk
The last chunk does not have size 0.
@ ecOK
0 Not an error, success
std::string asString() const
Return the ParseResult as a human readable string.
ParseError parseError
The parse eror.
@ peInvalidHeaderFieldValue
A header field value was being read, but it is invalid.
@ peInvalidMethod
An invalid method was specified in the request line.
Helper class to write strings in stream format, eg.
Linux system error primitive to provide a consistent interface to Linux error codes.
@ peExpectCRLF
A CR was not followed by an LF.
common::SystemError systemError
The common::SystemError is parseError == peSystemError, undefined otherwise.
@ peInvalidContentLength
The content length does not match the message body size.
@ peInvalidHTTPVersion
An invalid HTTP version was specified in the request line.