HTTP helpers.
Namespaces | |
namespace | headers |
Common HTTP headers. | |
Classes | |
class | ContentType |
Content-Type representation. More... | |
class | ContentTypeHash |
class | MalformedContentType |
Content-Type parsing error. More... | |
Typedefs | |
using | Args = std::unordered_map<std::string, std::string, utils::StrCaseHash> |
using | MultiArgs = std::multimap<std::string, std::string> |
Enumerations | |
enum class | HttpVersion { kDefault , k10 , k11 , k2 , k2Tls , k2PriorKnowledge } |
HTTP version to use. More... | |
enum | StatusCode : uint16_t { kInvalid = 0 , kContinue = 100 , kSwitchingProtocols = 101 , kProcessing = 102 , kEarlyHints = 103 , kOk = 200 , kCreated = 201 , kAccepted = 202 , kNonAuthoritativeInformation = 203 , kNoContent = 204 , kResetContent = 205 , kPartialContent = 206 , kMultiStatus = 207 , kAlreadyReported = 208 , kThisIsFine = 218 , kImUsed = 226 , kMultipleChoices = 300 , kMovedPermanently = 301 , kFound = 302 , kSeeOther = 303 , kNotModified = 304 , kUseProxy = 305 , kSwitchProxy = 306 , kTemporaryRedirect = 307 , kPermanentRedirect = 308 , kBadRequest = 400 , kUnauthorized = 401 , kPaymentRequired = 402 , kForbidden = 403 , kNotFound = 404 , kMethodNotAllowed = 405 , kNotAcceptable = 406 , kProxyAuthenticationRequired = 407 , kRequestTimeout = 408 , kConflict = 409 , kGone = 410 , kLengthRequired = 411 , kPreconditionFailed = 412 , kPayloadTooLarge = 413 , kUriTooLong = 414 , kUnsupportedMediaType = 415 , kRangeNotSatisfiable = 416 , kExpectationFailed = 417 , kImATeapot = 418 , kPageExpired = 419 , kMethodFailure = 420 , kMisdirectedRequest = 421 , kUnprocessableEntity = 422 , kLocked = 423 , kFailedDependency = 424 , kTooEarly = 425 , kUpgradeRequired = 426 , kPreconditionRequired = 428 , kTooManyRequests = 429 , kRequestHeaderFieldsTooLarge = 431 , kNginxNoResponse = 444 , kUnavailableForLegalReasons = 451 , kNginxRequestHeaderTooLarge = 494 , kNginxSSLCertificateError = 495 , kNginxSSLCertificateRequired = 496 , kNginxHTTPRequestSenttoHTTPSPort = 497 , kDeadlineExpired = 498 , kNginxClientClosedRequest = 499 , kInternalServerError = 500 , kNotImplemented = 501 , kBadGateway = 502 , kServiceUnavailable = 503 , kGatewayTimeout = 504 , kHttpVersionNotSupported = 505 , kVariantAlsoNegotiates = 506 , kInsufficientStorage = 507 , kLoopDetected = 508 , kBandwidthLimitExceeded = 509 , kNotExtended = 510 , kNetworkAuthenticationRequired = 511 , kWebServerIsDown = 520 , kConnectionTimedOut = 522 , kOriginIsUnreachable = 523 , kTimeoutOccurred = 524 , kSslHandshakeFailed = 525 , kInvalidSslCertificate = 526 , Invalid = kInvalid , OK = kOk , Created = kCreated , NoContent = kNoContent , BadRequest = kBadRequest , NotFound = kNotFound , Conflict = kConflict , TooManyRequests = kTooManyRequests , InternalServerError = kInternalServerError , kClientClosedRequest = kNginxClientClosedRequest } |
https://en.wikipedia.org/wiki/List_of_HTTP_status_codes More... | |
Functions | |
bool | operator== (const ContentType &, const ContentType &) |
bool | operator!= (const ContentType &, const ContentType &) |
bool | operator< (const ContentType &, const ContentType &) |
std::ostream & | operator<< (std::ostream &, const ContentType &) |
HttpVersion | Parse (const yaml_config::YamlConfig &value, formats::parse::To< HttpVersion >) |
std::string_view | StatusCodeString (StatusCode status) |
std::string | ToString (StatusCode status) |
std::ostream & | operator<< (std::ostream &os, StatusCode s) |
std::string | UrlDecode (std::string_view range) |
Decode URL. | |
std::string | UrlEncode (std::string_view input_string) |
Encode as URL. | |
std::string | MakeQuery (const Args &query_args) |
Make an URL query. | |
std::string | MakeQuery (const std::unordered_map< std::string, std::string > &query_args) |
Make an URL query. | |
std::string | MakeQuery (std::initializer_list< std::pair< std::string_view, std::string_view > > query_args) |
Make an URL query. | |
std::string | MakeUrl (std::string_view path, const Args &query_args) |
Make an URL with query arguments. | |
std::string | MakeUrl (std::string_view path, const std::unordered_map< std::string, std::string > &query_args) |
Make an URL with query arguments. | |
std::string | MakeUrl (std::string_view path, const Args &query_args, MultiArgs query_multiargs) |
Make an URL with query arguments. | |
std::string | MakeUrl (std::string_view path, std::initializer_list< std::pair< std::string_view, std::string_view > > query_args) |
Make an URL with query arguments. | |
std::string | ExtractMetaTypeFromUrl (const std::string &url) |
Returns URL part before the first '?' character. | |
std::string | ExtractPath (std::string_view url) |
Returns HTTP path part of a URL. | |
std::string | ExtractHostname (std::string_view url) |
Returns hostname part of a URL. | |
template<typename Value , typename = std::enable_if_t<formats::common::kIsFormatValue<Value>>> | |
StatusCode | Parse (const Value &value, formats::parse::To< StatusCode >) |
using http::Args = std::unordered_map<std::string, std::string, utils::StrCaseHash> |
using http::MultiArgs = std::multimap<std::string, std::string> |
|
strong |
HTTP version to use.
Definition at line 13 of file http_version.hpp.
enum http::StatusCode : uint16_t |
https://en.wikipedia.org/wiki/List_of_HTTP_status_codes
Definition at line 16 of file status_code.hpp.
bool http::operator< | ( | const ContentType & | , |
const ContentType & | ) |
Weak ordering for Accept media-ranges checking. Positions less specific types before more specific, so that the most specific type can be matched first.
StatusCode http::Parse | ( | const Value & | value, |
formats::parse::To< StatusCode > | ) |
Definition at line 16 of file parse_status_code.hpp.