httpmessage  0.4.0
HTTP message parsing library
Functions
General RFC 2616 grammar utility

Functions

HTTPMESSAGE_C_BEGIN HMAPI int httpmessage_text_is_CHAR (int c)
 Indicates if the given character is a character. More...
 
HMAPI int httpmessage_text_is_UPALPHA (int c)
 Indicates if the given character is an uppercase ASCII letter. More...
 
HMAPI int httpmessage_text_is_LUALPHA (int c)
 Indicates if the given character is a lowercase ASCII letter. More...
 
HMAPI int httpmessage_text_is_ALPHA (int c)
 Indicates if the given character is a ASCII letter. More...
 
HMAPI int httpmessage_text_is_DIGIT (int c)
 Indicates if the given character is a digit. More...
 
HMAPI int httpmessage_text_is_CTL (int c)
 Indicases if the given character is a control character. More...
 
HMAPI int httpmessage_text_is_LWS (int c)
 Indicates if the given character is a linear white space. More...
 
HMAPI int httpmessage_text_is_CRLF (const char *text, size_t length)
 Indicates if the given text is an end of line sequence. More...
 
int httpmessage_text_is_TEXT (int c)
 Indicates if the given character mathc the TEXT rule. More...
 
HMAPI int httpmessage_text_is_separator (int c)
 Indicates if the given character is a token separator. More...
 
HMAPI int httpmessage_text_is_token_char (int c)
 Indicates if the given character is a valid token character. More...
 
HMAPI int httpmessage_token_consume (const char **token, size_t *token_length, const char *text, size_t length)
 Read a RFC2616 token. More...
 
HMAPI ssize_t httpmessage_quoted_string_length (const char *text, size_t length)
 Get the unescaped string length of a quoted string. More...
 
HMAPI int httpmessage_quoted_string_consume (char *output, size_t output_size, const char *text, size_t length)
 Unescape a quoted string text. More...
 

Detailed Description

Function Documentation

◆ httpmessage_quoted_string_consume()

HMAPI int httpmessage_quoted_string_consume ( char *  output,
size_t  output_size,
const char *  text,
size_t  length 
)

Unescape a quoted string text.

quoted-string = ( <"> *(qdtext | quoted-pair ) <"> )
qdtext = <any TEXT except <">>
quoted-pair = "\" CHAR
See also
https://datatracker.ietf.org/doc/html/rfc2616#section-2.2
Parameters
outputUnescaped text output buffer
output_sizeOutput buffer size
textQuoted string input text
lengthOuoted string input text length
Returns
On success, the number of bytes consumed in text. On error, one of the httpmessage_result_code error codes
See also
httpmessage_result_code

◆ httpmessage_quoted_string_length()

HMAPI ssize_t httpmessage_quoted_string_length ( const char *  text,
size_t  length 
)

Get the unescaped string length of a quoted string.

quoted-string = ( <"> *(qdtext | quoted-pair ) <"> )
qdtext = <any TEXT except <">>
quoted-pair = "\" CHAR
See also
https://datatracker.ietf.org/doc/html/rfc2616#section-2.2
Parameters
textQuoted string text, including leading and trailing quote.
lengthQuoted string length
Returns
On success, length of the unescaped text. On error, one of the httpmessage_result_code error codes
See also
httpmessage_result_code

◆ httpmessage_text_is_ALPHA()

HMAPI int httpmessage_text_is_ALPHA ( int  c)

Indicates if the given character is a ASCII letter.

See also
https://datatracker.ietf.org/doc/html/rfc2616#section-2.2
Parameters
cCharacter to test
  • Returns
    Non-zero value if is a letter.

◆ httpmessage_text_is_CHAR()

HTTPMESSAGE_C_BEGIN HMAPI int httpmessage_text_is_CHAR ( int  c)

Indicates if the given character is a character.

See also
https://datatracker.ietf.org/doc/html/rfc2616#section-2.2
Parameters
cCharacter to test
  • Returns
    Non-zero value if is a character.

◆ httpmessage_text_is_CRLF()

HMAPI int httpmessage_text_is_CRLF ( const char *  text,
size_t  length 
)

Indicates if the given text is an end of line sequence.

CRLF = CR LF
See also
https://datatracker.ietf.org/doc/html/rfc2616#section-2.2
Parameters
textText to test
lengthText length
Returns
Non-zero value if text starts with CRLF sequence

◆ httpmessage_text_is_CTL()

HMAPI int httpmessage_text_is_CTL ( int  c)

Indicases if the given character is a control character.

CTL = <any US-ASCII control character
Parameters
cCharacter to test
Returns
Non-zero value if is a control character

◆ httpmessage_text_is_DIGIT()

HMAPI int httpmessage_text_is_DIGIT ( int  c)

Indicates if the given character is a digit.

See also
https://datatracker.ietf.org/doc/html/rfc2616#section-2.2
Parameters
cCharacter to test
Returns
Non-zero value if is a digit

◆ httpmessage_text_is_LUALPHA()

HMAPI int httpmessage_text_is_LUALPHA ( int  c)

Indicates if the given character is a lowercase ASCII letter.

See also
https://datatracker.ietf.org/doc/html/rfc2616#section-2.2
Parameters
cCharacter to test
  • Returns
    Non-zero value if is lowercase letter.

◆ httpmessage_text_is_LWS()

HMAPI int httpmessage_text_is_LWS ( int  c)

Indicates if the given character is a linear white space.

LWS = SP | HT
Parameters
cCharacter to test
Returns
Non-zero value if character is a white space

◆ httpmessage_text_is_separator()

HMAPI int httpmessage_text_is_separator ( int  c)

Indicates if the given character is a token separator.

separators = "(" | ")" | "<" | ">" | "@"
| "," | ";" | ":" | "\" | <">
| "/" | "[" | "]" | "?" | "="
| "{" | "}" | SP | HT
See also
https://datatracker.ietf.org/doc/html/rfc2616#section-2.2
Parameters
cCharacter to test
Returns
Non-zero value if is a token separator

◆ httpmessage_text_is_TEXT()

int httpmessage_text_is_TEXT ( int  c)

Indicates if the given character mathc the TEXT rule.

TEXT = <any OCTET except CTLs,
but including LWS>
Parameters
cCharacter to test
Returns
Non-zero value if character match the TEXT rule

◆ httpmessage_text_is_token_char()

HMAPI int httpmessage_text_is_token_char ( int  c)

Indicates if the given character is a valid token character.

token = 1*<any CHAR except CTLs or separators>
See also
https://datatracker.ietf.org/doc/html/rfc2616#section-2.2
Parameters
cCharacter to test
Returns
Non-zero value if is in the token character set

◆ httpmessage_text_is_UPALPHA()

HMAPI int httpmessage_text_is_UPALPHA ( int  c)

Indicates if the given character is an uppercase ASCII letter.

See also
https://datatracker.ietf.org/doc/html/rfc2616#section-2.2
Parameters
cCharacter to test
  • Returns
    Non-zero value if is an uppercase letter.

◆ httpmessage_token_consume()

HMAPI int httpmessage_token_consume ( const char **  token,
size_t *  token_length,
const char *  text,
size_t  length 
)

Read a RFC2616 token.

token = 1*<any CHAR except CTLs or separators>
See also
https://datatracker.ietf.org/doc/html/rfc2616#section-2.2
Parameters
tokenOutput buffer
token_lengthOutput buffer size
textInput text
lengthInput text length
Returns
On success, the number of bytes consumed in text. On error, one of the httpmessage_result_code error codes
See also
httpmessage_result_code