HTTP v1.13.1
Loading...
Searching...
No Matches
web Namespace Reference

Namespaces

namespace  exceptions
 

Classes

class  HTTPBuilder
 HTTP builder. More...
 
class  HTTPParser
 HTTP parser. More...
 
struct  InsensitiveStringEqual
 Custom equal for headers. More...
 
struct  InsensitiveStringHash
 Custom hashing for headers with case insensitive. More...
 
class  Multipart
 Defines each part of multipart/form-data. More...
 

Typedefs

using HeadersMap = std::unordered_map<std::string, std::string, InsensitiveStringHash, InsensitiveStringEqual>
 Case insensitive unordered_map.
 

Enumerations

enum class  ResponseCodes {
  Continue = 100 , switchingProtocols , processing , ok = 200 ,
  created , accepted , nonAuthoritativeInformation , noContent ,
  resetContent , partialContent , multiStatus , alreadyReported ,
  IMUsed = 226 , multipleChoices = 300 , movedPermanently , found ,
  seeOther , notModified , useProxy , temporaryRedirect = 307 ,
  permanentRedirect , badRequest = 400 , unauthorized , paymentRequired ,
  forbidden , notFound , methodNotAllowed , notAcceptable ,
  proxyAuthenticationRequired , requestTimeout , conflict , gone ,
  lengthRequired , preconditionFailed , payloadTooLarge , URITooLong ,
  unsupportedMediaType , rangeNotSatisfiable , expectationFailed , iamATeapot ,
  authenticationTimeout , misdirectedRequest = 421 , unprocessableEntity , locked ,
  failedDependency , upgradeRequired = 426 , preconditionRequired = 428 , tooManyRequests ,
  requestHeaderFieldsTooLarge = 431 , retryWith = 449 , unavailableForLegalReasons = 451 , clientClosedRequest = 499 ,
  internalServerError = 500 , notImplemented , badGateway , serviceUnavailable ,
  gatewayTimeout , HTTPVersionNotSupported , variantAlsoNegotiates , insufficientStorage ,
  loopDetected , bandwidthLimitExceeded , notExtended , networkAuthenticationRequired ,
  unknownError = 520 , webServerIsDown , connectionTimedOut , originIsUnreachable ,
  aTimeoutOccurred , SSLHandshakeFailed , invalidSSLCertificate
}
 Response codes. More...
 

Functions

ostream & operator<< (ostream &outputStream, const HTTPBuilder &builder)
 
ostream & operator<< (ostream &outputStream, const HTTPParser &parser)
 
istream & operator>> (istream &inputStream, HTTPParser &parser)
 
string getHTTPLibraryVersion ()
 Get version of HTTP library.
 
string encodeUrl (string_view data)
 
string decodeUrl (string_view data)
 
string __getMessageFromCode (int code)
 
std::ostream & operator<< (std::ostream &stream, ResponseCodes responseCode)
 Output stream operator for ResponseCodes.
 
bool operator== (int code, ResponseCodes otherCode)
 Compare operator for ResponseCodes.
 
HTTP_API_FUNCTION std::string encodeUrl (std::string_view data)
 Encode data to application/x-www-form-urlencoded format.
 
HTTP_API_FUNCTION std::string decodeUrl (std::string_view data)
 Decode data from application/x-www-form-urlencoded format.
 
template<typename T >
requires (std::same_as<T, ResponseCodes> || std::convertible_to<T, int>)
std::string getMessageFromCode (const T &code)
 Get response message from response code.
 

Typedef Documentation

◆ HeadersMap

using web::HeadersMap = std::unordered_map<std::string, std::string, InsensitiveStringHash, InsensitiveStringEqual>

Case insensitive unordered_map.

Definition at line 194 of file HTTPUtility.h.

Enumeration Type Documentation

◆ ResponseCodes

enum class web::ResponseCodes
strong

Response codes.

Enumerator
Continue 
switchingProtocols 
processing 
ok 
created 
accepted 
nonAuthoritativeInformation 
noContent 
resetContent 
partialContent 
multiStatus 
alreadyReported 
IMUsed 
multipleChoices 
movedPermanently 
found 
seeOther 
notModified 
useProxy 
temporaryRedirect 
permanentRedirect 
badRequest 
unauthorized 
paymentRequired 
forbidden 
notFound 
methodNotAllowed 
notAcceptable 
proxyAuthenticationRequired 
requestTimeout 
conflict 
gone 
lengthRequired 
preconditionFailed 
payloadTooLarge 
URITooLong 
unsupportedMediaType 
rangeNotSatisfiable 
expectationFailed 
iamATeapot 
authenticationTimeout 
misdirectedRequest 
unprocessableEntity 
locked 
failedDependency 
upgradeRequired 
preconditionRequired 
tooManyRequests 
requestHeaderFieldsTooLarge 
retryWith 
unavailableForLegalReasons 
clientClosedRequest 
internalServerError 
notImplemented 
badGateway 
serviceUnavailable 
gatewayTimeout 
HTTPVersionNotSupported 
variantAlsoNegotiates 
insufficientStorage 
loopDetected 
bandwidthLimitExceeded 
notExtended 
networkAuthenticationRequired 
unknownError 
webServerIsDown 
connectionTimedOut 
originIsUnreachable 
aTimeoutOccurred 
SSLHandshakeFailed 
invalidSSLCertificate 

Definition at line 24 of file HTTPUtility.h.

Function Documentation

◆ __getMessageFromCode()

HTTP_API_FUNCTION std::string web::__getMessageFromCode ( int code)

Definition at line 260 of file HTTPUtility.cpp.

◆ decodeUrl() [1/2]

HTTP_API_FUNCTION std::string web::decodeUrl ( std::string_view data)

Decode data from application/x-www-form-urlencoded format.

Parameters
data
Returns

◆ decodeUrl() [2/2]

string web::decodeUrl ( string_view data)

Definition at line 136 of file HTTPUtility.cpp.

◆ encodeUrl() [1/2]

HTTP_API_FUNCTION std::string web::encodeUrl ( std::string_view data)

Encode data to application/x-www-form-urlencoded format.

Parameters
data
Returns

◆ encodeUrl() [2/2]

string web::encodeUrl ( string_view data)

Definition at line 117 of file HTTPUtility.cpp.

◆ getHTTPLibraryVersion()

HTTP_API_FUNCTION std::string web::getHTTPLibraryVersion ( )

Get version of HTTP library.

Returns

Definition at line 110 of file HTTPUtility.cpp.

◆ getMessageFromCode()

template<typename T >
requires (std::same_as<T, ResponseCodes> || std::convertible_to<T, int>)
std::string web::getMessageFromCode ( const T & code)

Get response message from response code.

Template Parameters
T
Parameters
code
Returns

Definition at line 200 of file HTTPUtility.h.

◆ operator<<() [1/3]

ostream & web::operator<< ( ostream & outputStream,
const HTTPBuilder & builder )

Definition at line 311 of file HTTPBuilder.cpp.

◆ operator<<() [2/3]

ostream & web::operator<< ( ostream & outputStream,
const HTTPParser & parser )

Definition at line 392 of file HTTPParser.cpp.

◆ operator<<() [3/3]

std::ostream & web::operator<< ( std::ostream & stream,
ResponseCodes responseCode )
inline

Output stream operator for ResponseCodes.

Parameters
stream
responseCode
Returns

Definition at line 105 of file HTTPUtility.h.

◆ operator==()

bool web::operator== ( int code,
ResponseCodes otherCode )
inline

Compare operator for ResponseCodes.

Parameters
code
otherCode
Returns

Definition at line 116 of file HTTPUtility.h.

◆ operator>>()

istream & web::operator>> ( istream & inputStream,
HTTPParser & parser )

Definition at line 452 of file HTTPParser.cpp.