dodo
0.0.1
A C++ library to create containerized Linux services
|
Generic HTTP fragment, either a complete (such as HTTPRequest) or incomplete HTTP fragment (ssuch as a HTTPRequest::HTTPRequestLine) . More...
#include <httpfragment.hpp>
Data Structures | |
struct | ParseResult |
Used to convey parsing succces. More... | |
Public Types | |
enum | ParseError : unsigned int { peOk = 0, peIncomplete, peSystemError, peExpectCRLF, peUnFinishedToken, peExpectingHeaderColon, peInvalidHeaderFieldValue, peInvalidHeaderListEnd, peInvalidMethod, peInvalidHTTPVersion, peInvalidRequestLine, peInvalidContentLength, peUnexpectedBody, peInvalidTransferEncoding, peInvalidChunkHex, peInvalidLastChunk, peExpectingUnsignedInt } |
Parse results returned by the parse functions. More... | |
Public Member Functions | |
virtual std::string | asString () const =0 |
Convert the HTTPFragment in a HTTP protocol string. More... | |
virtual ParseResult | parse (VirtualReadBuffer &buffer)=0 |
Read a complete HTTPFragment from a VirtualReadBuffer. More... | |
Static Public Member Functions | |
static std::string | getParseResultAsString (ParseError error) |
Return the string description of a ParseError. More... | |
Generic HTTP fragment, either a complete (such as HTTPRequest) or incomplete HTTP fragment (ssuch as a HTTPRequest::HTTPRequestLine) .
Descendant classes implement ParseResult parse( VirtualReadBuffer& buffer ) to extract a complete HTTP fragment. Note that the buffer is expected to be blocking on reads, if the HTTPFragment expects more data it will wait and in case of a read timeout, fail. If the parse fails due to incomplete data within the timeout, the ParseResult return value is { peSystemError, common::SystemError::ecEAGAIN }
.
Definition at line 45 of file httpfragment.hpp.
enum dodo::network::protocol::http::HTTPFragment::ParseError : unsigned int |
Parse results returned by the parse functions.
Definition at line 51 of file httpfragment.hpp.
|
pure virtual |
Convert the HTTPFragment in a HTTP protocol string.
Implemented in dodo::network::protocol::http::HTTPResponse, dodo::network::protocol::http::HTTPRequest, dodo::network::protocol::http::HTTPResponse::HTTPResponseLine, dodo::network::protocol::http::HTTPRequest::HTTPRequestLine, and dodo::network::protocol::http::HTTPVersion.
|
static |
Return the string description of a ParseError.
error | The ParseError to describe. |
Definition at line 37 of file httpfragment.cpp.
References peExpectCRLF, peExpectingHeaderColon, peExpectingUnsignedInt, peIncomplete, peInvalidChunkHex, peInvalidContentLength, peInvalidHeaderFieldValue, peInvalidHeaderListEnd, peInvalidHTTPVersion, peInvalidLastChunk, peInvalidMethod, peInvalidRequestLine, peInvalidTransferEncoding, peOk, peSystemError, peUnexpectedBody, and peUnFinishedToken.
Referenced by dodo::network::protocol::http::HTTPFragment::ParseResult::asString().
|
pure virtual |
Read a complete HTTPFragment from a VirtualReadBuffer.
buffer | the VirtualReadBuffer to get characters from. |
Implemented in dodo::network::protocol::http::HTTPResponse::HTTPResponseLine, dodo::network::protocol::http::HTTPRequest, dodo::network::protocol::http::HTTPRequest::HTTPRequestLine, dodo::network::protocol::http::HTTPResponse, and dodo::network::protocol::http::HTTPVersion.