HttpCommon.h File Reference
#include "WString.h"
#include <Data/WebConstants.h>
#include "../Url.h"
#include "Data/Stream/ReadWriteStream.h"
#include "Data/ObjectMap.h"
#include <llhttp.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, ...)   name,
 
#define XX(num, name, ...)   constexpr HttpError HPE_##name = HttpError::name;
 
#define HTTP_PARSER_ERRNO(p)   HttpError((p)->error)
 
#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;
 

Typedefs

using http_parser_type = llhttp_type
 
using http_parser = llhttp_t
 
using http_parser_settings = llhttp_settings_t
 
using http_method = llhttp_method
 
using HttpFiles = ObjectMap< String, ReadWriteStream >
 

Enumerations

enum class  HttpError { XX }
 HTTP error codes. More...
 
enum class  HttpMethod { XX }
 Strongly-typed enum which shadows llhttp_method from llhttp library. More...
 
enum class  HttpStatus { XX }
 HTTP status code. 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

const char * http_method_str (llhttp_method method)
 
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)->error)

◆ HTTP_REQUEST_POOL_SIZE

#define HTTP_REQUEST_POOL_SIZE   20

◆ XX [1/6]

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

◆ XX [2/6]

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

◆ XX [3/6]

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

◆ XX [4/6]

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

◆ XX [5/6]

#define XX (   num,
  name,
  ... 
)    name,

◆ XX [6/6]

#define XX (   num,
  name,
  ... 
)    constexpr HttpError HPE_##name = HttpError::name;

Typedef Documentation

◆ http_method

using http_method = llhttp_method

◆ http_parser

using http_parser = llhttp_t

◆ http_parser_settings

using http_parser_settings = llhttp_settings_t

◆ http_parser_type

using http_parser_type = llhttp_type

◆ 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 llhttp_method from llhttp library.

{

Enumerator
XX 

◆ HttpStatus

enum HttpStatus
strong

HTTP status code.

Enumerator
XX 

Function Documentation

◆ http_method_str()

const char* http_method_str ( llhttp_method  method)
inline

◆ httpGetErrorDescription()

String httpGetErrorDescription ( HttpError  err)

Return a descriptive string for the given error.

Deprecated:
Messages are not available in llhttp. Use toString(HttpError).

◆ 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.