Decentralised Art Server
High-performance C++ backend that exposes HTML interface and a secure REST API for managing Performative Transactions entities
 
Loading...
Searching...
No Matches
dcn::http Namespace Reference

Classes

class  MessageBase
 
class  Request
 
class  Response
 
class  URL
 

Typedefs

using HeadersList = std::vector< std::pair< Header, std::string > >
 A list of headers A HeadersList is a vector of pairs, where the first element of the pair is a Header enum value and the second element is the value of the header. The index of the Header enum value is used as the key in the vector.
 

Enumerations

enum class  Code {
  Unknown = 0 , OK = 200 , Created = 201 , BadRequest = 400 ,
  Unauthorized = 401 , Forbidden = 403 , NotFound = 404 , InternalServerError = 500 ,
  ServiceUnavailable = 503 , GatewayTimeout = 504
}
 Enum to represent HTTP response status codes. More...
 
enum class  Header {
  Unknown = 0 , Accept , AccessControlAllowOrigin , AccessControlAllowMethods ,
  AccessControlAllowHeaders , Authorization , Connection , ContentEncoding ,
  ContentLength , ContentType , Cookie , Date ,
  Expect , SetCookie
}
 Enum of HTTP headers as defined by the standard This enum contains the most commonly used HTTP headers. More...
 
enum class  Method {
  Unknown = 0 , GET , HEAD , PUT ,
  DEL , POST , OPTIONS
}
 Enum to represent the request method. More...
 

Functions

template<typename H >
H AbslHashValue (H h, const URL &url)
 Combines hash values for a RouteKey object.
 
std::vector< std::string > splitPathSegments (const std::string path)
 
absl::flat_hash_map< std::string, std::string > splitQuerySegments (const std::string &query)
 

Typedef Documentation

◆ HeadersList

using dcn::http::HeadersList = typedef std::vector<std::pair<Header, std::string> >

A list of headers A HeadersList is a vector of pairs, where the first element of the pair is a Header enum value and the second element is the value of the header. The index of the Header enum value is used as the key in the vector.

Enumeration Type Documentation

◆ Code

Enum to represent HTTP response status codes.

This enum represents the possible status codes of an HTTP response.

The values of the enum are categorized as follows:

  • Unknown: The response code is not recognized or not supported.
  • Level 200: Successful responses.
    • - OK: The request succeeded.
  • Level 400: Client error responses.
    • - BadRequest: The request could not be understood by the server.
    • - Unauthorized: The request requires user authentication.
    • - Forbidden: The server understood the request, but refuses to authorize it.
    • - NotFound: The server has not found anything matching the request.
  • Level 500: Server error responses.
    • - InternalServerError: The server encountered an unexpected condition.
    • - ServiceUnavailable: The server is currently unable to handle the request.
    • - GatewayTimeout: The server did not receive a timely response from an upstream server.
Enumerator
Unknown 
OK 
Created 
BadRequest 
Unauthorized 
Forbidden 
NotFound 
InternalServerError 
ServiceUnavailable 
GatewayTimeout 

◆ Header

Enum of HTTP headers as defined by the standard This enum contains the most commonly used HTTP headers.

See also
https://en.wikipedia.org/wiki/List_of_HTTP_header_fields
Enumerator
Unknown 
Accept 
AccessControlAllowOrigin 
AccessControlAllowMethods 
AccessControlAllowHeaders 
Authorization 
Connection 
ContentEncoding 
ContentLength 
ContentType 
Cookie 
Date 
Expect 
SetCookie 

◆ Method

Enum to represent the request method.

This enum represents the possible methods of an HTTP request.

The values of the enum are:

  • Unknown: The request method is not recognized or not supported.
  • GET: method requests a representation of the specified resource.
  • HEAD: method requests headers of the response, not the actual body.
  • PUT: replaces all current representations of the target resource with the request payload.
  • DEL: Tdeletes the specified resource.
  • POST: sends data to the server to create a new resource.
  • OPTIONS: requests information about the communication options for the target resource.
Enumerator
Unknown 
GET 
HEAD 
PUT 
DEL 
POST 
OPTIONS 

Function Documentation

◆ AbslHashValue()

template<typename H >
H dcn::http::AbslHashValue ( H  h,
const URL url 
)
inline

Combines hash values for a RouteKey object.

Template Parameters
HThe hash state type.
Parameters
hThe initial hash state.
urlThe URL object whose attributes will be hashed.
Returns
A combined hash state

◆ splitPathSegments()

std::vector< std::string > dcn::http::splitPathSegments ( const std::string  path)

◆ splitQuerySegments()

absl::flat_hash_map< std::string, std::string > dcn::http::splitQuerySegments ( const std::string &  query)