coreHTTP v3.1.0
HTTP/1.1 Client Library
 
Loading...
Searching...
No Matches
core_http_client_private.h File Reference

Internal definitions to the HTTP Client library. More...

#include "llhttp.h"

Go to the source code of this file.

Data Structures

struct  findHeaderContext_t
 An aggregator that represents the user-provided parameters to the HTTPClient_ReadHeader API function. This will be used as context parameter for the parsing callbacks used by the API function. More...
 
struct  HTTPParsingContext_t
 The HTTP response parsing context for a response fresh from the server. This context is passed into the http-parser registered callbacks. The registered callbacks are private functions of the form httpParserXXXXCallbacks(). More...
 

Macros

#define HTTP_PROTOCOL_VERSION   "HTTP/1.1"
 The HTTP protocol version of this library is HTTP/1.1.
 
#define HTTP_PROTOCOL_VERSION_LEN   ( sizeof( HTTP_PROTOCOL_VERSION ) - 1U )
 
#define HTTP_EMPTY_PATH   "/"
 Default value when pRequestInfo->pPath == NULL.
 
#define HTTP_EMPTY_PATH_LEN   ( sizeof( HTTP_EMPTY_PATH ) - 1U )
 
#define HTTP_HEADER_LINE_SEPARATOR   "\r\n"
 
#define HTTP_HEADER_LINE_SEPARATOR_LEN   ( sizeof( HTTP_HEADER_LINE_SEPARATOR ) - 1U )
 
#define HTTP_HEADER_END_INDICATOR   "\r\n\r\n"
 
#define HTTP_HEADER_END_INDICATOR_LEN   ( sizeof( HTTP_HEADER_END_INDICATOR ) - 1U )
 
#define HTTP_HEADER_FIELD_SEPARATOR   ": "
 
#define HTTP_HEADER_FIELD_SEPARATOR_LEN   ( sizeof( HTTP_HEADER_FIELD_SEPARATOR ) - 1U )
 
#define SPACE_CHARACTER   ' '
 
#define SPACE_CHARACTER_LEN   ( 1U )
 
#define DASH_CHARACTER   '-'
 
#define DASH_CHARACTER_LEN   ( 1U )
 
#define CARRIAGE_RETURN_CHARACTER   '\r'
 
#define LINEFEED_CHARACTER   '\n'
 
#define COLON_CHARACTER   ':'
 
#define HTTP_HEADER_STRNCPY_IS_VALUE   0U
 Indicator for function httpHeaderStrncpy that the pSrc parameter is a header value.
 
#define HTTP_HEADER_STRNCPY_IS_FIELD   1U
 Indicator for function httpHeaderStrncpy that the pSrc parameter is a header field.
 
#define HTTP_USER_AGENT_FIELD   "User-Agent"
 
#define HTTP_USER_AGENT_FIELD_LEN   ( sizeof( HTTP_USER_AGENT_FIELD ) - 1U )
 
#define HTTP_HOST_FIELD   "Host"
 
#define HTTP_HOST_FIELD_LEN   ( sizeof( HTTP_HOST_FIELD ) - 1U )
 
#define HTTP_USER_AGENT_VALUE_LEN   ( sizeof( HTTP_USER_AGENT_VALUE ) - 1U )
 
#define HTTP_CONNECTION_FIELD   "Connection"
 
#define HTTP_CONNECTION_FIELD_LEN   ( sizeof( HTTP_CONNECTION_FIELD ) - 1U )
 
#define HTTP_CONTENT_LENGTH_FIELD   "Content-Length"
 
#define HTTP_CONTENT_LENGTH_FIELD_LEN   ( sizeof( HTTP_CONTENT_LENGTH_FIELD ) - 1U )
 
#define HTTP_CONNECTION_KEEP_ALIVE_VALUE   "keep-alive"
 
#define HTTP_CONNECTION_KEEP_ALIVE_VALUE_LEN   ( sizeof( HTTP_CONNECTION_KEEP_ALIVE_VALUE ) - 1U )
 
#define HTTP_RANGE_REQUEST_HEADER_FIELD   "Range"
 
#define HTTP_RANGE_REQUEST_HEADER_FIELD_LEN   ( sizeof( HTTP_RANGE_REQUEST_HEADER_FIELD ) - 1U )
 
#define HTTP_RANGE_REQUEST_HEADER_VALUE_PREFIX   "bytes="
 
#define HTTP_RANGE_REQUEST_HEADER_VALUE_PREFIX_LEN   ( sizeof( HTTP_RANGE_REQUEST_HEADER_VALUE_PREFIX ) - 1U )
 
#define MAX_INT32_NO_OF_DECIMAL_DIGITS   10U
 Maximum value of a 32 bit signed integer is 2,147,483,647.
 
#define HTTP_MAX_RANGE_REQUEST_VALUE_LEN
 Maximum buffer space for storing a Range Request Value.
 
#define LLHTTP_CONTINUE_PARSING   0
 Return value for llhttp registered callback to signal continuation of HTTP response parsing. Equal to HPE_OK.
 
#define LLHTTP_STOP_PARSING   HPE_USER
 Return value for llhttp registered callback to signal halting further execution.
 
#define LLHTTP_PAUSE_PARSING   HPE_PAUSED
 Return value for llhttp registered callback to signal to pause further execution.
 
#define LLHTTP_STOP_PARSING_NO_BODY   1
 Return value for llhttp_t.on_headers_complete to signal that the HTTP response has no body and to halt further execution.
 
#define LLHTTP_STOP_PARSING_NO_HEADER   1
 Return value for llhttp_t.on_headers_complete to signal halting further execution. This is the same return value that indicates the HTTP response has no body, but unlike the -1 error code, gives consistent return values for llhttp_execute in both strict and non-strict modes.
 
#define HTTP_MINIMUM_REQUEST_LINE_LENGTH   16u
 The minimum request-line in the headers has a possible one character custom method and a single forward / or asterisk * for the path:
 

Enumerations

enum  HTTPParsingState_t { HTTP_PARSING_NONE = 0 , HTTP_PARSING_INCOMPLETE , HTTP_PARSING_COMPLETE }
 The state of the response message parsed after function parseHttpResponse returns. More...
 

Detailed Description

Internal definitions to the HTTP Client library.

Macro Definition Documentation

◆ HTTP_PROTOCOL_VERSION_LEN

#define HTTP_PROTOCOL_VERSION_LEN   ( sizeof( HTTP_PROTOCOL_VERSION ) - 1U )

The length of HTTP_PROTOCOL_VERSION.

◆ HTTP_EMPTY_PATH_LEN

#define HTTP_EMPTY_PATH_LEN   ( sizeof( HTTP_EMPTY_PATH ) - 1U )

The length of HTTP_EMPTY_PATH.

◆ HTTP_HEADER_LINE_SEPARATOR

#define HTTP_HEADER_LINE_SEPARATOR   "\r\n"

HTTP header field lines are separated by \r\n.

◆ HTTP_HEADER_LINE_SEPARATOR_LEN

#define HTTP_HEADER_LINE_SEPARATOR_LEN   ( sizeof( HTTP_HEADER_LINE_SEPARATOR ) - 1U )

◆ HTTP_HEADER_END_INDICATOR

#define HTTP_HEADER_END_INDICATOR   "\r\n\r\n"

The HTTP header is complete when \r\n\r\n is found.

◆ HTTP_HEADER_END_INDICATOR_LEN

#define HTTP_HEADER_END_INDICATOR_LEN   ( sizeof( HTTP_HEADER_END_INDICATOR ) - 1U )

The length of HTTP_HEADER_END_INDICATOR.

◆ HTTP_HEADER_FIELD_SEPARATOR

#define HTTP_HEADER_FIELD_SEPARATOR   ": "

HTTP header field and values are separated by ": ".

◆ HTTP_HEADER_FIELD_SEPARATOR_LEN

#define HTTP_HEADER_FIELD_SEPARATOR_LEN   ( sizeof( HTTP_HEADER_FIELD_SEPARATOR ) - 1U )

◆ SPACE_CHARACTER

#define SPACE_CHARACTER   ' '

A space character macro to help with serializing a request.

◆ SPACE_CHARACTER_LEN

#define SPACE_CHARACTER_LEN   ( 1U )

The length of SPACE_CHARACTER.

◆ DASH_CHARACTER

#define DASH_CHARACTER   '-'

A dash character macro to help with serializing a request.

◆ DASH_CHARACTER_LEN

#define DASH_CHARACTER_LEN   ( 1U )

The length of DASH_CHARACTER.

◆ CARRIAGE_RETURN_CHARACTER

#define CARRIAGE_RETURN_CHARACTER   '\r'

A carriage return character to help with header validation.

◆ LINEFEED_CHARACTER

#define LINEFEED_CHARACTER   '\n'

A linefeed character to help with header validation.

◆ COLON_CHARACTER

#define COLON_CHARACTER   ':'

A colon character to help with header validation.

◆ HTTP_USER_AGENT_FIELD

#define HTTP_USER_AGENT_FIELD   "User-Agent"

HTTP header field "User-Agent".

◆ HTTP_USER_AGENT_FIELD_LEN

#define HTTP_USER_AGENT_FIELD_LEN   ( sizeof( HTTP_USER_AGENT_FIELD ) - 1U )

The length of HTTP_USER_AGENT_FIELD.

◆ HTTP_HOST_FIELD

#define HTTP_HOST_FIELD   "Host"

HTTP header field "Host".

◆ HTTP_HOST_FIELD_LEN

#define HTTP_HOST_FIELD_LEN   ( sizeof( HTTP_HOST_FIELD ) - 1U )

The length of HTTP_HOST_FIELD.

◆ HTTP_USER_AGENT_VALUE_LEN

#define HTTP_USER_AGENT_VALUE_LEN   ( sizeof( HTTP_USER_AGENT_VALUE ) - 1U )

The length of HTTP_USER_AGENT_VALUE.

◆ HTTP_CONNECTION_FIELD

#define HTTP_CONNECTION_FIELD   "Connection"

HTTP header field "Connection".

◆ HTTP_CONNECTION_FIELD_LEN

#define HTTP_CONNECTION_FIELD_LEN   ( sizeof( HTTP_CONNECTION_FIELD ) - 1U )

The length of HTTP_CONNECTION_FIELD.

◆ HTTP_CONTENT_LENGTH_FIELD

#define HTTP_CONTENT_LENGTH_FIELD   "Content-Length"

HTTP header field "Content-Length".

◆ HTTP_CONTENT_LENGTH_FIELD_LEN

#define HTTP_CONTENT_LENGTH_FIELD_LEN   ( sizeof( HTTP_CONTENT_LENGTH_FIELD ) - 1U )

The length of HTTP_CONTENT_LENGTH_FIELD.

◆ HTTP_CONNECTION_KEEP_ALIVE_VALUE

#define HTTP_CONNECTION_KEEP_ALIVE_VALUE   "keep-alive"

HTTP header value "keep-alive" for the "Connection" header field.

◆ HTTP_CONNECTION_KEEP_ALIVE_VALUE_LEN

#define HTTP_CONNECTION_KEEP_ALIVE_VALUE_LEN   ( sizeof( HTTP_CONNECTION_KEEP_ALIVE_VALUE ) - 1U )

◆ HTTP_RANGE_REQUEST_HEADER_FIELD

#define HTTP_RANGE_REQUEST_HEADER_FIELD   "Range"

HTTP header field "Range".

◆ HTTP_RANGE_REQUEST_HEADER_FIELD_LEN

#define HTTP_RANGE_REQUEST_HEADER_FIELD_LEN   ( sizeof( HTTP_RANGE_REQUEST_HEADER_FIELD ) - 1U )

◆ HTTP_RANGE_REQUEST_HEADER_VALUE_PREFIX

#define HTTP_RANGE_REQUEST_HEADER_VALUE_PREFIX   "bytes="

HTTP required header value prefix when specifying a byte range for partial content.

◆ HTTP_RANGE_REQUEST_HEADER_VALUE_PREFIX_LEN

#define HTTP_RANGE_REQUEST_HEADER_VALUE_PREFIX_LEN   ( sizeof( HTTP_RANGE_REQUEST_HEADER_VALUE_PREFIX ) - 1U )

◆ MAX_INT32_NO_OF_DECIMAL_DIGITS

#define MAX_INT32_NO_OF_DECIMAL_DIGITS   10U

Maximum value of a 32 bit signed integer is 2,147,483,647.

Used for calculating buffer space for ASCII representation of range values.

◆ HTTP_MAX_RANGE_REQUEST_VALUE_LEN

#define HTTP_MAX_RANGE_REQUEST_VALUE_LEN
Value:
1U /* Dash character '-' */ + MAX_INT32_NO_OF_DECIMAL_DIGITS )
#define MAX_INT32_NO_OF_DECIMAL_DIGITS
Maximum value of a 32 bit signed integer is 2,147,483,647.
Definition: core_http_client_private.h:145
#define HTTP_RANGE_REQUEST_HEADER_VALUE_PREFIX_LEN
Definition: core_http_client_private.h:138

Maximum buffer space for storing a Range Request Value.

The largest Range Request value is of the form: "bytes=<Max-Integer-Value>-<Max-Integer-Value>"

◆ HTTP_MINIMUM_REQUEST_LINE_LENGTH

#define HTTP_MINIMUM_REQUEST_LINE_LENGTH   16u

The minimum request-line in the headers has a possible one character custom method and a single forward / or asterisk * for the path:

<1 character custom method> <1 character / or *> HTTP/1.x\r\n\r\n

Therefore the minimum length is 16. If this minimum request-line is not satisfied, then the request headers to send are invalid.

Note that custom methods are allowed per: https://tools.ietf.org/html/rfc2616#section-5.1.1.

Enumeration Type Documentation

◆ HTTPParsingState_t

The state of the response message parsed after function parseHttpResponse returns.

Enumerator
HTTP_PARSING_NONE 

The parser has not started reading any response.

HTTP_PARSING_INCOMPLETE 

The parser found a partial response.

HTTP_PARSING_COMPLETE 

The parser found the entire response.