Thoth
A functional, expressive, asynchronous C++26 webdev library
Loading...
Searching...
No Matches
Thoth::Http Namespace Reference

Namespaces

namespace  NHeaders
 

Classes

struct  Client
 
struct  ClientJanitor
 The ClientJanitor stores all open Sockets in a pool to optimize consecutive calls. Only use it if you know what you are doing. More...
 
struct  ConnectMethod
 
struct  DeleteMethod
 
struct  GenericError
 
struct  GetMethod
 
struct  Headers
 This class stores the headers from HTTP. More...
 
struct  HeadMethod
 
struct  JsonFindError
 
struct  JsonGetError
 
struct  JsonParseError
 
struct  JsonSearchError
 
struct  JsonWrongTypeError
 
struct  OptionsMethod
 
struct  PatchMethod
 
struct  PostMethod
 
struct  PutMethod
 
struct  QueryParams
 
struct  Request
 
struct  RequestError
 
struct  RequestHeaders
 Represents the collection of HTTP headers associated with a request. Based on modern HTTP RFCs and inspired by .NET's HttpRequestHeaders. More...
 
struct  Response
 
struct  ResponseHead
 
struct  ResponseHeaders
 
struct  Socket
 structure that stores info about an open Socket, like the version, the type of socket and the last used time. More...
 
struct  TraceMethod
 
struct  Url
 

Concepts

concept  BodyConcept
 Class that transforms requests with a given method into their responses, monad friendly.
 
concept  ResponseBodyFactoryConcept
 
concept  MethodConcept
 The HTTP methods requirements following RFC9110.
 
concept  SizedRequestBodyConcept
 
concept  ChunkedRequestBodyConcept
 
concept  RequestBodyConcept
 
concept  ResponseBodyConcept
 

Typedefs

using GetRequest = Request<>
 
using PostRequest = Request< PostMethod >
 
using GetBinRequest = Request< GetMethod, vector< std::byte > >
 
using PostBinRequest = Request< PostMethod, vector< std::byte > >
 
using string_view = std::string_view
 
using string = std::string
 
using ConnectionErrorEnum = Hermes::ConnectionErrorEnum
 
using GetResponse = Response<>
 
using PostResponse = Response< PostMethod >
 
using GetBinResponse = Response< GetMethod, vector< std::byte > >
 
using PostBinResponse = Response< PostMethod, vector< std::byte > >
 
using GetFileResponse = Response< GetMethod, Dsa::TextFileOutputRange >
 
using PostFileResponse = Response< PostMethod, Dsa::TextFileOutputRange >
 
using GetFileBinResponse = Response< GetMethod, vector< std::byte > >
 
using PostFileBinResponse = Response< PostMethod, vector< std::byte > >
 
template<class T >
using WebResult = std::expected< T, StatusCodeEnum >
 
using WebResultOper = WebResult< std::monostate >
 

Enumerations

enum class  VersionEnum : uint8_t { HTTP1_0 , HTTP1_1 , HTTP2 , HTTP3 }
 
enum class  UrlParseErrorEnum { EmptyUrl , InvalidScheme , IllFormed , InvalidPort }
 
enum class  RequestBuildErrorEnum { InvalidResponse , InvalidVersion , InvalidHeaders , VersionNeedsContentLength }
 
enum class  StatusCodeEnum {
  CONTINUE = 100 , SWITCHING_PROTOCOLS = 101 , PROCESSING_DEPRECATED = 102 , EARLY_HINTS = 103 ,
  OK = 200 , CREATED = 201 , ACCEPTED = 202 , NON_AUTHORITATIVE_INFORMATION = 203 ,
  NO_CONTENT = 204 , RESET_CONTENT = 205 , PARTIAL_CONTENT = 206 , MULTI_STATUS = 207 ,
  ALREADY_REPORTED = 208 , IM_USED = 226 , MULTIPLE_CHOICES = 300 , MOVED_PERMANENTLY = 301 ,
  FOUND = 302 , SEE_OTHER = 303 , NOT_MODIFIED = 304 , USE_PROXY_DEPRECATED = 305 ,
  UNUSED = 306 , TEMPORARY_REDIRECT = 307 , PERMANENT_REDIRECT = 308 , BAD_REQUEST = 400 ,
  UNAUTHORIZED = 401 , PAYMENT_REQUIRED = 402 , FORBIDDEN = 403 , NOT_FOUND = 404 ,
  METHOD_NOT_ALLOWED = 405 , NOT_ACCEPTABLE = 406 , PROXY_AUTHENTICATION_REQUIRED = 407 , REQUEST_TIMEOUT = 408 ,
  CONFLICT = 409 , GONE = 410 , LENGTH_REQUIRED = 411 , PRECONDITION_FAILED = 412 ,
  CONTENT_TOO_LARGE = 413 , URI_TOO_LONG = 414 , UNSUPPORTED_MEDIA_TYPE = 415 , RANGE_NOT_SATISFIABLE = 416 ,
  EXPECTATION_FAILED = 417 , IM_A_TEAPOT = 418 , MISDIRECTED_REQUEST = 421 , UNPROCESSABLE_CONTENT = 422 ,
  LOCKED = 423 , FAILED_DEPENDENCY = 424 , TOO_EARLY_EXPERIMENTAL = 425 , UPGRADE_REQUIRED = 426 ,
  PRECONDITION_REQUIRED = 428 , TOO_MANY_REQUESTS = 429 , REQUEST_HEADER_FIELDS_TOO_LARGE = 431 , UNAVAILABLE_FOR_LEGAL_REASONS = 451 ,
  INTERNAL_SERVER_ERROR = 500 , NOT_IMPLEMENTED = 501 , BAD_GATEWAY = 502 , SERVICE_UNAVAILABLE = 503 ,
  GATEWAY_TIMEOUT = 504 , HTTP_VERSION_NOT_SUPPORTED = 505 , VARIANT_ALSO_NEGOTIATES = 506 , INSUFFICIENT_STORAGE = 507 ,
  LOOP_DETECTED = 508 , NOT_EXTENDED = 510 , NETWORK_AUTHENTICATION_REQUIRED = 511
}
 
enum class  StatusTypeEnum {
  INFORMATIONAL , SUCCESSFUL , REDIRECTION , CLIENT_ERROR ,
  SERVER_ERROR
}
 

Functions

std::string_view VersionToString (VersionEnum version)
 Exactly what you think it is.
 
template<ResponseBodyConcept Body>
auto GetInserterIterator (Body &body)
 
constexpr StatusTypeEnum GetStatusType (StatusCodeEnum code)
 Check what type of code StatusCodeEnum is, the first digit of it's number.
 

Typedef Documentation

◆ ConnectionErrorEnum

using Thoth::Http::ConnectionErrorEnum = typedef Hermes::ConnectionErrorEnum

◆ GetBinRequest

using Thoth::Http::GetBinRequest = typedef Request<GetMethod, vector<std::byte> >

◆ GetBinResponse

using Thoth::Http::GetBinResponse = typedef Response<GetMethod, vector<std::byte> >

◆ GetFileBinResponse

using Thoth::Http::GetFileBinResponse = typedef Response<GetMethod, vector<std::byte> >

◆ GetFileResponse

◆ GetRequest

using Thoth::Http::GetRequest = typedef Request<>

◆ GetResponse

◆ PostBinRequest

using Thoth::Http::PostBinRequest = typedef Request<PostMethod, vector<std::byte> >

◆ PostBinResponse

using Thoth::Http::PostBinResponse = typedef Response<PostMethod, vector<std::byte> >

◆ PostFileBinResponse

using Thoth::Http::PostFileBinResponse = typedef Response<PostMethod, vector<std::byte> >

◆ PostFileResponse

◆ PostRequest

◆ PostResponse

◆ string

using Thoth::Http::string = typedef std::string

◆ string_view

using Thoth::Http::string_view = typedef std::string_view

◆ WebResult

template<class T >
using Thoth::Http::WebResult = typedef std::expected<T, StatusCodeEnum>

◆ WebResultOper

using Thoth::Http::WebResultOper = typedef WebResult<std::monostate>

Enumeration Type Documentation

◆ RequestBuildErrorEnum

Enumerator
InvalidResponse 
InvalidVersion 
InvalidHeaders 
VersionNeedsContentLength 

◆ StatusCodeEnum

enum class Thoth::Http::StatusCodeEnum
strong
Enumerator
CONTINUE 
SWITCHING_PROTOCOLS 
PROCESSING_DEPRECATED 
EARLY_HINTS 
OK 
CREATED 
ACCEPTED 
NON_AUTHORITATIVE_INFORMATION 
NO_CONTENT 
RESET_CONTENT 
PARTIAL_CONTENT 
MULTI_STATUS 
ALREADY_REPORTED 
IM_USED 
MULTIPLE_CHOICES 
MOVED_PERMANENTLY 
FOUND 
SEE_OTHER 
NOT_MODIFIED 
USE_PROXY_DEPRECATED 
UNUSED 
TEMPORARY_REDIRECT 
PERMANENT_REDIRECT 
BAD_REQUEST 
UNAUTHORIZED 
PAYMENT_REQUIRED 
FORBIDDEN 
NOT_FOUND 
METHOD_NOT_ALLOWED 
NOT_ACCEPTABLE 
PROXY_AUTHENTICATION_REQUIRED 
REQUEST_TIMEOUT 
CONFLICT 
GONE 
LENGTH_REQUIRED 
PRECONDITION_FAILED 
CONTENT_TOO_LARGE 
URI_TOO_LONG 
UNSUPPORTED_MEDIA_TYPE 
RANGE_NOT_SATISFIABLE 
EXPECTATION_FAILED 
IM_A_TEAPOT 
MISDIRECTED_REQUEST 
UNPROCESSABLE_CONTENT 
LOCKED 
FAILED_DEPENDENCY 
TOO_EARLY_EXPERIMENTAL 
UPGRADE_REQUIRED 
PRECONDITION_REQUIRED 
TOO_MANY_REQUESTS 
REQUEST_HEADER_FIELDS_TOO_LARGE 
UNAVAILABLE_FOR_LEGAL_REASONS 
INTERNAL_SERVER_ERROR 
NOT_IMPLEMENTED 
BAD_GATEWAY 
SERVICE_UNAVAILABLE 
GATEWAY_TIMEOUT 
HTTP_VERSION_NOT_SUPPORTED 
VARIANT_ALSO_NEGOTIATES 
INSUFFICIENT_STORAGE 
LOOP_DETECTED 
NOT_EXTENDED 
NETWORK_AUTHENTICATION_REQUIRED 

◆ StatusTypeEnum

enum class Thoth::Http::StatusTypeEnum
strong
Enumerator
INFORMATIONAL 
SUCCESSFUL 
REDIRECTION 
CLIENT_ERROR 
SERVER_ERROR 

◆ UrlParseErrorEnum

enum class Thoth::Http::UrlParseErrorEnum
strong
Enumerator
EmptyUrl 
InvalidScheme 
IllFormed 
InvalidPort 

◆ VersionEnum

enum class Thoth::Http::VersionEnum : uint8_t
strong
Enumerator
HTTP1_0 
HTTP1_1 
HTTP2 
HTTP3 

Function Documentation

◆ GetInserterIterator()

template<ResponseBodyConcept Body>
auto Thoth::Http::GetInserterIterator ( Body &  body)

◆ GetStatusType()

constexpr StatusTypeEnum Thoth::Http::GetStatusType ( StatusCodeEnum  code)
constexpr

Check what type of code StatusCodeEnum is, the first digit of it's number.

1XX => INFORMATIONAL 2XX => SUCCESSFUL 3XX => REDIRECTION 4XX => CLIENT_ERROR 5XX => SERVER_ERROR

◆ VersionToString()

std::string_view Thoth::Http::VersionToString ( VersionEnum  version)

Exactly what you think it is.