Web framework C++  2.0.0
Simple web framework on c++ designed to easily create web pages, etc
Public Types | Static Public Member Functions | List of all members
HTTP Class Reference

static class describes http method, version, and allow to convert it from/to string/enumeration More...

#include <http.h>

Collaboration diagram for HTTP:
Collaboration graph

Public Types

enum  Method {
  UNDEFINED, GET, HEAD, POST,
  PUT, DELETE, CONNECT, OPTIONS,
  TRACE, PATCH, ANY
}
 
enum  Version {
  HTTP_UNDEFINED, HTTP_0_9, HTTP_1_0, HTTP_1_1,
  HTTP_2_0, HTTP_ANY
}
 

Static Public Member Functions

static HTTP::Method getMethod (std::string &str)
 
static HTTP::Version getVersion (std::string &str)
 
static std::string getVersion (HTTP::Version version)
 
static std::string getReasonPhrase (int code)
 
static std::string getMimeType (std::string &extension)
 

Detailed Description

static class describes http method, version, and allow to convert it from/to string/enumeration

HTTP class describes Method, Version, ReasonPhrase of code in http

Member Enumeration Documentation

Flags to define combinations of HTTP Request methods

Enumerator
UNDEFINED 
GET 
HEAD 
POST 
PUT 
DELETE 
CONNECT 
OPTIONS 
TRACE 
PATCH 
ANY 

Flags to define combinations of HTTP Version

Enumerator
HTTP_UNDEFINED 
HTTP_0_9 
HTTP_1_0 
HTTP_1_1 
HTTP_2_0 
HTTP_ANY 

Member Function Documentation

static HTTP::Method HTTP::getMethod ( std::string &  str)
static

Parse input string to http method

Parameters
strinput string
Returns
parsed method from string, if string wasn't valid returns UNDEFINED
static std::string HTTP::getMimeType ( std::string &  extension)
static

Get mime-type of file by its extension

Parameters
extensionextension of file without a dot
Returns
mime-type of current file
static std::string HTTP::getReasonPhrase ( int  code)
static

Serialize status code to string

Parameters
codehttp status code
Returns
reason phrase for code as string, returns Not Found if code not found among values
static HTTP::Version HTTP::getVersion ( std::string &  str)
static

Parse input string to http version

Parameters
strinput string
Returns
parsed version from string, if string wasn't valid returns HTTP_UNDEFINED
static std::string HTTP::getVersion ( HTTP::Version  version)
static

Serialize HTTP::Version to string

Parameters
versionhttp version
Returns
version as string

The documentation for this class was generated from the following file: