SNode.C
|
#include <Parser.h>
Public Member Functions | |
Parser (core::socket::stream::SocketContext *socketContext, const enum HTTPCompliance &compliance=HTTPCompliance::RFC2616|HTTPCompliance::RFC7230) | |
virtual | ~Parser () |
std::size_t | parse () |
void | reset () |
Protected Types | |
enum struct | HTTPCompliance : unsigned short { RFC1945 = 0x01 << 0 , RFC2616 = 0x01 << 1 , RFC7230 = 0x01 << 2 , RFC7231 = 0x01 << 3 , RFC7232 = 0x01 << 4 , RFC7233 = 0x01 << 5 , RFC7234 = 0x01 << 6 , RFC7235 = 0x01 << 7 , RFC7540 = 0x01 << 8 , RFC7541 = 0x01 << 9 } |
enum struct | ParserState { BEGIN , FIRSTLINE , HEADER , BODY , TRAILER , ERROR } |
Protected Member Functions | |
virtual void | analyzeHeader () |
Protected Attributes | |
enum web::http::Parser::HTTPCompliance | hTTPCompliance |
ParserState | parserState = ParserState::BEGIN |
TransferEncoding | transferEncoding = TransferEncoding::HTTP10 |
CiStringMap< std::string > | headers |
std::vector< char > | content |
int | httpMajor = 0 |
int | httpMinor = 0 |
std::list< web::http::ContentDecoder * > | decoderQueue |
core::socket::stream::SocketContext * | socketContext = nullptr |
std::string | line |
std::size_t | contentLength = 0 |
std::size_t | contentLengthRead = 0 |
Static Protected Attributes | |
static const std::regex | httpVersionRegex |
Private Member Functions | |
virtual void | begin ()=0 |
virtual void | parseStartLine (const std::string &line)=0 |
virtual void | parseError (int code, const std::string &reason)=0 |
virtual void | parsingFinished ()=0 |
std::size_t | readStartLine () |
std::size_t | readHeader () |
std::size_t | readContent () |
std::size_t | readTrailer () |
Private Attributes | |
web::http::decoder::Fields | headerDecoder |
std::set< std::string > | trailerFieldsExpected |
web::http::decoder::Fields | trailerDecoder |
Friends | |
enum HTTPCompliance | operator| (const enum HTTPCompliance &c1, const enum HTTPCompliance &c2) |
enum HTTPCompliance | operator& (const enum HTTPCompliance &c1, const enum HTTPCompliance &c2) |
|
strongprotected |
Enumerator | |
---|---|
RFC1945 | |
RFC2616 | |
RFC7230 | |
RFC7231 | |
RFC7232 | |
RFC7233 | |
RFC7234 | |
RFC7235 | |
RFC7540 | |
RFC7541 |
|
strongprotected |
|
explicit |
Definition at line 41 of file Parser.cpp.
|
virtual |
Definition at line 48 of file Parser.cpp.
References reset().
|
protectedvirtual |
Reimplemented in web::http::client::ResponseParser, and web::http::server::RequestParser.
Definition at line 138 of file Parser.cpp.
Referenced by web::http::client::ResponseParser::analyzeHeader(), web::http::server::RequestParser::analyzeHeader(), and readHeader().
|
privatepure virtual |
Implemented in web::http::client::ResponseParser, and web::http::server::RequestParser.
std::size_t web::http::Parser::parse | ( | ) |
Definition at line 70 of file Parser.cpp.
|
privatepure virtual |
Implemented in web::http::client::ResponseParser, and web::http::server::RequestParser.
|
privatepure virtual |
Implemented in web::http::client::ResponseParser, and web::http::server::RequestParser.
|
privatepure virtual |
Implemented in web::http::client::ResponseParser, and web::http::server::RequestParser.
Referenced by readContent(), and readTrailer().
|
private |
Definition at line 197 of file Parser.cpp.
References parserState, parsingFinished(), and TRAILER.
|
private |
Definition at line 125 of file Parser.cpp.
References analyzeHeader().
|
private |
Definition at line 101 of file Parser.cpp.
|
private |
Definition at line 220 of file Parser.cpp.
References parsingFinished().
void web::http::Parser::reset | ( | ) |
Definition at line 52 of file Parser.cpp.
References BEGIN, httpMajor, httpMinor, and parserState.
Referenced by web::http::client::ResponseParser::parseError(), web::http::server::RequestParser::parseError(), web::http::client::ResponseParser::parsingFinished(), web::http::server::RequestParser::parsingFinished(), and ~Parser().
|
friend |
Definition at line 238 of file Parser.cpp.
|
friend |
Definition at line 234 of file Parser.cpp.
|
protected |
|
protected |
|
private |
|
protected |
|
protected |
|
protected |
|
protected |
|
staticprotected |
|
protected |
Definition at line 78 of file Parser.h.
Referenced by web::http::client::ResponseParser::analyzeHeader(), web::http::server::RequestParser::analyzeHeader(), web::http::client::ResponseParser::parseError(), web::http::server::RequestParser::parseError(), web::http::client::ResponseParser::parseStartLine(), web::http::server::RequestParser::parseStartLine(), web::http::client::ResponseParser::parsingFinished(), web::http::server::RequestParser::parsingFinished(), readContent(), and reset().
|
protected |
|
private |
|
private |
|
protected |