dodo
0.0.1
A C++ library to create containerized Linux services
|
Go to the documentation of this file.
30 namespace network::protocol::http {
34 enum State : uint8_t {
47 uint8_t state = ssStart;
48 std::stringstream major;
49 std::stringstream minor;
50 while ( parseResult.
ok() && state != ssDone ) {
53 if ( ! isspace( buffer.
get() ) ) state = ssHttp;
57 if ( buffer.
get() ==
'H' ) {
63 if ( buffer.
get() ==
'T' ) {
69 if ( buffer.
get() ==
'T' ) {
75 if ( buffer.
get() ==
'P' ) {
81 if ( buffer.
get() ==
'/' ) {
87 if ( !isdigit( buffer.
get() ) ) state = ssDot;
89 major << buffer.
get();
94 if ( buffer.
get() ==
'.' ) {
101 if ( !isdigit( buffer.
get() ) ) state = ssDone;
103 minor << buffer.
get();
virtual ParseResult parse(VirtualReadBuffer &buffer)
Construct from current position in the VirtualReadBuffer 'HTTP/major_.minor_'.
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.
virtual common::SystemError next()=0
Move to the next char from the VirtualReadBuffer.
virtual char get() const =0
Get the current char from VirtualReadBuffer.
unsigned int minor_
The minor version.
A C++ platform interface to lean Linux services tailored for containerized deployment.
common::SystemError getSystemError() const
Return the systemError.
Used to convey parsing succces.
@ ecOK
0 Not an error, success
unsigned int major_
The major version.
@ peInvalidHTTPVersion
An invalid HTTP version was specified in the request line.