|
SNode.C
|
#include <ResponseParser.h>
Public Member Functions | |
| ResponseParser (core::socket::stream::SocketContext *socketContext, const std::function< void()> &onResponseStart, const std::function< void(Response &)> &onResponseParsed, const std::function< void(int, const std::string &)> &onResponseParseError) | |
| ResponseParser (const ResponseParser &)=delete | |
| ResponseParser & | operator= (const ResponseParser &)=delete |
Public Member Functions inherited from web::http::Parser | |
| Parser (core::socket::stream::SocketContext *socketContext, const enum HTTPCompliance &compliance=HTTPCompliance::RFC2616|HTTPCompliance::RFC7230) | |
| virtual | ~Parser () |
| std::size_t | parse () |
| void | reset () |
Private Member Functions | |
| void | begin () override |
| void | parseStartLine (const std::string &line) override |
| void | analyzeHeader () override |
| void | parsingFinished () override |
| void | parseError (int code, const std::string &reason) override |
Private Attributes | |
| Response | response |
| std::function< void()> | onResponseStart |
| std::function< void(Response &)> | onResponseParsed |
| std::function< void(int, const std::string &)> | onResponseParseError |
Additional Inherited Members | |
Protected Types inherited from web::http::Parser | |
| 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 Attributes inherited from web::http::Parser | |
| 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 inherited from web::http::Parser | |
| static const std::regex | httpVersionRegex |
Definition at line 63 of file ResponseParser.h.
| web::http::client::ResponseParser::ResponseParser | ( | core::socket::stream::SocketContext * | socketContext, |
| const std::function< void()> & | onResponseStart, | ||
| const std::function< void(Response &)> & | onResponseParsed, | ||
| const std::function< void(int, const std::string &)> & | onResponseParseError | ||
| ) |
Definition at line 58 of file ResponseParser.cpp.
References onResponseParsed, onResponseParseError, onResponseStart, and web::http::Parser::Parser().
Referenced by apps::http::getResponseParser(), and web::http::client::SocketContext::SocketContext().
|
delete |
|
overrideprivatevirtual |
Reimplemented from web::http::Parser.
Definition at line 107 of file ResponseParser.cpp.
References web::http::Parser::analyzeHeader(), web::http::Parser::BODY, web::http::ciContains(), web::http::Close, web::http::client::Response::connectionState, web::http::Parser::contentLength, web::http::CookieOptions::CookieOptions(), web::http::client::Response::cookies, web::http::Parser::headers, web::http::Identity, web::http::Keep, web::http::Parser::parserState, parsingFinished(), response, web::http::CookieOptions::setOption(), httputils::str_split(), httputils::str_trimm(), and web::http::Parser::transferEncoding.
|
overrideprivatevirtual |
Implements web::http::Parser.
Definition at line 68 of file ResponseParser.cpp.
References onResponseStart.
|
delete |
|
overrideprivatevirtual |
Implements web::http::Parser.
Definition at line 178 of file ResponseParser.cpp.
References web::http::Parser::ERROR, onResponseParseError, web::http::Parser::parserState, and web::http::Parser::reset().
Referenced by parseStartLine().
|
overrideprivatevirtual |
Implements web::http::Parser.
Definition at line 72 of file ResponseParser.cpp.
References web::http::StatusCode::contains(), web::http::Parser::HEADER, web::http::HTTP10, web::http::Parser::httpMajor, web::http::Parser::httpMinor, web::http::client::Response::httpVersion, web::http::Parser::httpVersionRegex, web::http::Identity, parseError(), web::http::Parser::parserState, web::http::client::Response::reason, response, web::http::client::Response::statusCode, httputils::str_split(), and web::http::Parser::transferEncoding.
|
overrideprivatevirtual |
Implements web::http::Parser.
Definition at line 165 of file ResponseParser.cpp.
References web::http::Parser::BEGIN, web::http::client::Response::body, web::http::Parser::content, web::http::client::Response::headers, web::http::Parser::headers, web::http::client::Response::httpMajor, web::http::Parser::httpMajor, web::http::client::Response::httpMinor, web::http::Parser::httpMinor, onResponseParsed, web::http::Parser::parserState, web::http::Parser::reset(), and response.
Referenced by analyzeHeader().
|
private |
Definition at line 89 of file ResponseParser.h.
Referenced by parsingFinished(), and ResponseParser().
|
private |
Definition at line 90 of file ResponseParser.h.
Referenced by parseError(), and ResponseParser().
|
private |
Definition at line 88 of file ResponseParser.h.
Referenced by begin(), and ResponseParser().
|
private |
Definition at line 85 of file ResponseParser.h.
Referenced by analyzeHeader(), parseStartLine(), and parsingFinished().