HTTP v1.13.1
Loading...
Searching...
No Matches
web::HTTPParser Class Reference

HTTP parser. More...

#include <HTTPParser.h>

Public Member Functions

 HTTPParser ()
 
 HTTPParser (const std::string &HTTPMessage)
 
 HTTPParser (const std::vector< char > &HTTPMessage)
 
 HTTPParser (const HTTPParser &other)=default
 
 HTTPParser (HTTPParser &&other) noexcept=default
 
HTTPParseroperator= (const HTTPParser &other)=default
 
HTTPParseroperator= (HTTPParser &&other) noexcept=default
 
void parse (std::string_view HTTPMessage)
 
const std::string & getMethod () const
 
double getHTTPVersion () const
 
const std::string & getParameters () const
 
const std::unordered_map< std::string, std::string > & getQueryParameters () const
 
const std::pair< int, std::string > & getFullResponse () const
 
int getResponseCode () const
 
const std::string & getResponseMessage () const
 
const HeadersMapgetHeaders () const
 
const std::string & getBody () const
 
const std::vector< std::string > & getChunks () const
 
const json::JSONParser & getJSON () const
 
const std::string & getRawData () const
 
const std::vector< Multipart > & getMultiparts () const
 
 operator bool () const
 
 ~HTTPParser ()=default
 

Static Public Attributes

static const std::string contentLengthHeader = "Content-Length"
 
static const std::string contentTypeHeader = "Content-Type"
 
static const std::string transferEncodingHeader = "Transfer-Encoding"
 
static const std::string utf8Encoded = "charset=utf-8"
 
static const std::string chunkEncoded = "chunked"
 
static constexpr std::string_view crlfcrlf = "\r\n\r\n"
 
static constexpr std::string_view crlf = "\r\n"
 
static constexpr std::string_view urlEncoded = "application/x-www-form-urlencoded"
 
static constexpr std::string_view jsonEncoded = "application/json"
 
static constexpr std::string_view multipartEncoded = "multipart/form-data"
 

Friends

HTTP_API std::ostream & operator<< (std::ostream &outputStream, const HTTPParser &parser)
 
HTTP_API std::istream & operator>> (std::istream &inputStream, HTTPParser &parser)
 

Detailed Description

HTTP parser.

Definition at line 13 of file HTTPParser.h.

Constructor & Destructor Documentation

◆ HTTPParser() [1/5]

web::HTTPParser::HTTPParser ( )

Definition at line 177 of file HTTPParser.cpp.

◆ HTTPParser() [2/5]

web::HTTPParser::HTTPParser ( const std::string & HTTPMessage)

◆ HTTPParser() [3/5]

web::HTTPParser::HTTPParser ( const std::vector< char > & HTTPMessage)

◆ HTTPParser() [4/5]

web::HTTPParser::HTTPParser ( const HTTPParser & other)
default

◆ HTTPParser() [5/5]

web::HTTPParser::HTTPParser ( HTTPParser && other)
defaultnoexcept

◆ ~HTTPParser()

web::HTTPParser::~HTTPParser ( )
default

Member Function Documentation

◆ getBody()

const string & web::HTTPParser::getBody ( ) const

Definition at line 362 of file HTTPParser.cpp.

◆ getChunks()

const vector< string > & web::HTTPParser::getChunks ( ) const

Definition at line 367 of file HTTPParser.cpp.

◆ getFullResponse()

const pair< int, string > & web::HTTPParser::getFullResponse ( ) const

Definition at line 342 of file HTTPParser.cpp.

◆ getHeaders()

const HeadersMap & web::HTTPParser::getHeaders ( ) const

Definition at line 357 of file HTTPParser.cpp.

◆ getHTTPVersion()

double web::HTTPParser::getHTTPVersion ( ) const

Definition at line 327 of file HTTPParser.cpp.

◆ getJSON()

const json::JSONParser & web::HTTPParser::getJSON ( ) const

Definition at line 372 of file HTTPParser.cpp.

◆ getMethod()

const string & web::HTTPParser::getMethod ( ) const

Definition at line 322 of file HTTPParser.cpp.

◆ getMultiparts()

const vector< Multipart > & web::HTTPParser::getMultiparts ( ) const

Definition at line 382 of file HTTPParser.cpp.

◆ getParameters()

const string & web::HTTPParser::getParameters ( ) const

Definition at line 332 of file HTTPParser.cpp.

◆ getQueryParameters()

const unordered_map< string, string > & web::HTTPParser::getQueryParameters ( ) const

Definition at line 337 of file HTTPParser.cpp.

◆ getRawData()

const string & web::HTTPParser::getRawData ( ) const

Definition at line 377 of file HTTPParser.cpp.

◆ getResponseCode()

int web::HTTPParser::getResponseCode ( ) const

Definition at line 347 of file HTTPParser.cpp.

◆ getResponseMessage()

const string & web::HTTPParser::getResponseMessage ( ) const

Definition at line 352 of file HTTPParser.cpp.

◆ operator bool()

web::HTTPParser::operator bool ( ) const

Definition at line 387 of file HTTPParser.cpp.

◆ operator=() [1/2]

HTTPParser & web::HTTPParser::operator= ( const HTTPParser & other)
default

◆ operator=() [2/2]

HTTPParser & web::HTTPParser::operator= ( HTTPParser && other)
defaultnoexcept

◆ parse()

void web::HTTPParser::parse ( std::string_view HTTPMessage)

Definition at line 194 of file HTTPParser.cpp.

Friends And Related Symbol Documentation

◆ operator<<

HTTP_API std::ostream & operator<< ( std::ostream & outputStream,
const HTTPParser & parser )
friend

◆ operator>>

HTTP_API std::istream & operator>> ( std::istream & inputStream,
HTTPParser & parser )
friend

Member Data Documentation

◆ chunkEncoded

const std::string web::HTTPParser::chunkEncoded = "chunked"
inlinestatic

Definition at line 29 of file HTTPParser.h.

◆ contentLengthHeader

const std::string web::HTTPParser::contentLengthHeader = "Content-Length"
inlinestatic

Definition at line 25 of file HTTPParser.h.

◆ contentTypeHeader

const std::string web::HTTPParser::contentTypeHeader = "Content-Type"
inlinestatic

Definition at line 26 of file HTTPParser.h.

◆ crlf

std::string_view web::HTTPParser::crlf = "\r\n"
inlinestaticconstexpr

Definition at line 31 of file HTTPParser.h.

◆ crlfcrlf

std::string_view web::HTTPParser::crlfcrlf = "\r\n\r\n"
inlinestaticconstexpr

Definition at line 30 of file HTTPParser.h.

◆ jsonEncoded

std::string_view web::HTTPParser::jsonEncoded = "application/json"
inlinestaticconstexpr

Definition at line 35 of file HTTPParser.h.

◆ multipartEncoded

std::string_view web::HTTPParser::multipartEncoded = "multipart/form-data"
inlinestaticconstexpr

Definition at line 36 of file HTTPParser.h.

◆ transferEncodingHeader

const std::string web::HTTPParser::transferEncodingHeader = "Transfer-Encoding"
inlinestatic

Definition at line 27 of file HTTPParser.h.

◆ urlEncoded

std::string_view web::HTTPParser::urlEncoded = "application/x-www-form-urlencoded"
inlinestaticconstexpr

Definition at line 34 of file HTTPParser.h.

◆ utf8Encoded

const std::string web::HTTPParser::utf8Encoded = "charset=utf-8"
inlinestatic

Definition at line 28 of file HTTPParser.h.


The documentation for this class was generated from the following files: