matador::http::http Class Reference

Class consisting of common http protocol definitions. More...

#include <http.hpp>

Classes

struct  content
 Content struct. More...
 
struct  version
 Version struct. More...
 

Public Types

enum  method_t {
  UNKNOWN , GET , POST , PUT ,
  DEL , OPTIONS , HEAD
}
 
enum  status_t {
  OK = 200 , CREATED = 201 , ACCEPTED = 202 , NO_CONTENT = 204 ,
  MULTIPLE_CHOICES = 300 , MOVED_PERMANENTLY = 301 , MOVED_TEMPORARILY = 302 , NOT_MODIFIED = 304 ,
  BAD_REQUEST = 400 , UNAUTHORIZED = 401 , FORBIDDEN = 403 , NOT_FOUND = 404 ,
  INTERNAL_SERVER_ERROR = 500 , NOT_IMPLEMENTED = 501 , BAD_GATEWAY = 502 , SERVICE_UNAVAILABLE = 503
}
 

Static Public Member Functions

static OOS_HTTP_API std::string to_string (method_t m)
 
static OOS_HTTP_API matador::buffer_view to_buffer (method_t m)
 
static OOS_HTTP_API method_t to_method (const std::string &str)
 
static OOS_HTTP_API std::string to_request_string (status_t status)
 
static OOS_HTTP_API std::string to_string (status_t status)
 
static OOS_HTTP_API matador::buffer_view to_buffer (status_t status)
 
static OOS_HTTP_API status_t to_status (const std::string &str)
 

Detailed Description

Class consisting of common http protocol definitions.

This class consists of common http protocol definitions like http method, status or a version and content struct.

There are also converting methods for these enums.

Member Enumeration Documentation

◆ method_t

Enum representing the supported http methods

Enumerator
UNKNOWN 

Unknown method

GET 

GET method

POST 

POST method

PUT 

PUT method

DEL 

DELETE method

OPTIONS 

OPTIONS method

HEAD 

HEAD method

◆ status_t

Http status codes enumeration

Enumerator
OK 

OK status code

CREATED 

CREATED status code

ACCEPTED 

ACCEPTED status code

NO_CONTENT 

NO_CONTENT status code

MULTIPLE_CHOICES 

MULTIPLE_CHOICES status code

MOVED_PERMANENTLY 

MOVED_PERMANENTLY status code

MOVED_TEMPORARILY 

MOVED_TEMPORARILY status code

NOT_MODIFIED 

NOT_MODIFIED status code

BAD_REQUEST 

BAD_REQUEST status code

UNAUTHORIZED 

UNAUTHORIZED status code

FORBIDDEN 

FORBIDDEN status code

NOT_FOUND 

NOT_FOUND status code

INTERNAL_SERVER_ERROR 

INTERNAL_SERVER_ERROR status code

NOT_IMPLEMENTED 

NOT_IMPLEMENTED status code

BAD_GATEWAY 

BAD_GATEWAY status code

SERVICE_UNAVAILABLE 

SERVICE_UNAVAILABLE status code

Member Function Documentation

◆ to_buffer() [1/2]

static OOS_HTTP_API matador::buffer_view matador::http::http::to_buffer ( method_t  m)
static

Converts a given http method into a buffer_view

Parameters
mHttp method to convert
Returns
The buffer_view representation og the http method

◆ to_buffer() [2/2]

static OOS_HTTP_API matador::buffer_view matador::http::http::to_buffer ( status_t  status)
static

Converts a http status enum value into a buffer_view

Parameters
statusHttp status enum to convert
Returns
The buffer_view representing the http status code

◆ to_method()

static OOS_HTTP_API method_t matador::http::http::to_method ( const std::string &  str)
static

Converts a given http method string into its enum representation. If the string is an unknown or unsupported http method the http method enum UNKNOWN is returned

Parameters
strString to convert
Returns
The converted http method

◆ to_request_string()

static OOS_HTTP_API std::string matador::http::http::to_request_string ( status_t  status)
static

Converts a http status enum value into a request string i.e. "HTTP/1.1 200 OK \r\n"

Parameters
statusHttp status enum to convert
Returns
The request string representing the http status code

◆ to_status()

static OOS_HTTP_API status_t matador::http::http::to_status ( const std::string &  str)
static

Converts a string representation of a http status into its enum value

Parameters
strString to convert
Returns
The converted http status

◆ to_string() [1/2]

static OOS_HTTP_API std::string matador::http::http::to_string ( method_t  m)
static

Converts a given http method into a string

Parameters
mHttp method to convert
Returns
The string representation og the http method

◆ to_string() [2/2]

static OOS_HTTP_API std::string matador::http::http::to_string ( status_t  status)
static

Converts a http status enum value into a string

Parameters
statusHttp status enum to convert
Returns
The string representing the http status code

The documentation for this class was generated from the following file:
  • matador/http/http.hpp