HttpCommon.h File Reference
#include "WString.h"
#include <Data/WebConstants.h>
#include "../Url.h"
#include "Data/Stream/ReadWriteStream.h"
#include "Data/ObjectMap.h"
#include "http-parser/http_parser.h"
Include dependency graph for HttpCommon.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define ENABLE_HTTP_REQUEST_AUTH   1
 
#define HTTP_MAX_HEADER_SIZE   (8 * 1024)
 
#define HTTP_REQUEST_POOL_SIZE   20
 
#define XX(num, name, string)   name = num,
 
#define XX(num, name, string)   constexpr HttpMethod HTTP_##name = HttpMethod::name;
 
#define XX(num, name, string)   name = num,
 
#define XX(num, name, string)   constexpr HttpStatus HTTP_STATUS_##name = HttpStatus::name;
 
#define XX(n, s)   n,
 
#define XX(n, s)   constexpr HttpError HPE_##n = HttpError::n;
 
#define HTTP_PARSER_ERRNO(p)   HttpError((p)->http_errno)
 

Typedefs

using HttpFiles = ObjectMap< String, ReadWriteStream >
 

Enumerations

enum class  HttpMethod { XX }
 Strongly-typed enum which shadows http_method from http_parser library. More...
 
enum class  HttpStatus { XX }
 HTTP status code. More...
 
enum class  HttpError { XX }
 HTTP error codes. More...
 
enum  HttpConnectionState {
  eHCS_Ready = 0 , eHCS_StartSending , eHCS_SendingHeaders , eHCS_StartBody ,
  eHCS_SendingBody , eHCS_Sent , eHCS_WaitResponse
}
 Identifies current state for an HTTP connection. More...
 

Functions

String toString (HttpError err)
 Return a descriptive string for the given error. More...
 
String httpGetErrorDescription (HttpError err)
 Return a descriptive string for the given error. More...
 
String toString (HttpStatus code)
 Return a descriptive string for an HTTP status code. More...
 
String httpGetStatusText (unsigned code)
 Return a descriptive string for an HTTP status code. More...
 
String toString (HttpMethod method)
 Return text for an HTTP method. More...
 

Macro Definition Documentation

◆ ENABLE_HTTP_REQUEST_AUTH

#define ENABLE_HTTP_REQUEST_AUTH   1

◆ HTTP_MAX_HEADER_SIZE

#define HTTP_MAX_HEADER_SIZE   (8 * 1024)

◆ HTTP_PARSER_ERRNO

#define HTTP_PARSER_ERRNO (   p)    HttpError((p)->http_errno)

◆ HTTP_REQUEST_POOL_SIZE

#define HTTP_REQUEST_POOL_SIZE   20

◆ XX [1/6]

#define XX (   n,
 
)    n,

◆ XX [2/6]

#define XX (   n,
 
)    constexpr HttpError HPE_##n = HttpError::n;

◆ XX [3/6]

#define XX (   num,
  name,
  string 
)    name = num,

◆ XX [4/6]

#define XX (   num,
  name,
  string 
)    constexpr HttpMethod HTTP_##name = HttpMethod::name;

◆ XX [5/6]

#define XX (   num,
  name,
  string 
)    name = num,

◆ XX [6/6]

#define XX (   num,
  name,
  string 
)    constexpr HttpStatus HTTP_STATUS_##name = HttpStatus::name;

Typedef Documentation

◆ HttpFiles

Enumeration Type Documentation

◆ HttpConnectionState

Identifies current state for an HTTP connection.

Enumerator
eHCS_Ready 
eHCS_StartSending 
eHCS_SendingHeaders 
eHCS_StartBody 
eHCS_SendingBody 
eHCS_Sent 
eHCS_WaitResponse 

◆ HttpError

enum HttpError
strong

HTTP error codes.

Enumerator
XX 

◆ HttpMethod

enum HttpMethod
strong

Strongly-typed enum which shadows http_method from http_parser library.

{

Enumerator
XX 

◆ HttpStatus

enum HttpStatus
strong

HTTP status code.

Enumerator
XX 

Function Documentation

◆ httpGetErrorDescription()

String httpGetErrorDescription ( HttpError  err)

Return a descriptive string for the given error.

◆ httpGetStatusText()

String httpGetStatusText ( unsigned  code)
inline

Return a descriptive string for an HTTP status code.

◆ toString() [1/3]

String toString ( HttpError  err)

Return a descriptive string for the given error.

◆ toString() [2/3]

String toString ( HttpMethod  method)
inline

Return text for an HTTP method.

◆ toString() [3/3]

String toString ( HttpStatus  code)

Return a descriptive string for an HTTP status code.