GNU libmicrohttpd 0.9.77
|
Header for string manipulating helpers. More...
Go to the source code of this file.
Data Structures | |
struct | _MHD_str_w_len |
Macros | |
#define | MHD_STATICSTR_LEN_(macro) (sizeof(macro) / sizeof(char) - 1) |
#define | _MHD_S_STR_W_LEN(str) { str, MHD_STATICSTR_LEN_(str) } |
#define | MHD_str_has_s_token_caseless_(str, tkn) MHD_str_has_token_caseless_ ((str),(tkn),MHD_STATICSTR_LEN_ (tkn)) |
Header for string manipulating helpers.
Definition in file mhd_str.h.
#define _MHD_S_STR_W_LEN | ( | str | ) | { str, MHD_STATICSTR_LEN_(str) } |
Static string initialiser for struct _MHD_str_w_len
#define MHD_str_has_s_token_caseless_ | ( | str, | |
tkn | |||
) | MHD_str_has_token_caseless_ ((str),(tkn),MHD_STATICSTR_LEN_ (tkn)) |
Check whether str has case-insensitive static tkn. Token could be surrounded by spaces and tabs and delimited by comma. Match succeed if substring between start, end of string or comma contains only case-insensitive token and optional spaces and tabs.
str | the string to check |
tkn | the static string of token to find |
Check two strings for equality, ignoring case of US-ASCII letters.
str1 | first string to compare |
str2 | second string to compare |
Check two string for equality, ignoring case of US-ASCII letters.
str1 | first string to compare |
str2 | second string to compare |
Definition at line 346 of file mhd_str.c.
References charsequalcaseless, MHD_HTTP_OK, and toasciilower.
Referenced by build_header_response(), check_response_header_token_ci(), digest_calc_ha1_from_digest(), keepalive_possible(), method_string_to_enum(), MHD_add_response_header(), MHD_lookup_header_token_ci(), MHD_queue_response(), MHD_request_lookup_value(), MHD_response_get_header(), need_100_continue(), need_100_continue(), parse_connection_headers(), and parse_request_headers().
Check two string for equality, ignoring case of US-ASCII letters and checking exactly len characters. Compares exactly len characters, including binary zero characters.
str1 | first string to compare |
str2 | second string to compare |
len | number of characters to compare |
Definition at line 445 of file mhd_str.c.
References charsequalcaseless, and MHD_HTTP_OK.
Referenced by add_user_headers(), MHD_check_response_header_token_ci(), MHD_del_response_header(), MHD_get_response_element_n_(), MHD_get_response_header(), MHD_lookup_connection_value_n(), MHD_lookup_header_token_ci(), and MHD_str_remove_tokens_caseless_().
Check two string for equality, ignoring case of US-ASCII letters and checking not more than maxlen characters. Compares up to first terminating null character, but not more than first maxlen characters.
str1 | first string to compare |
str2 | second string to compare |
maxlen | maximum number of characters to compare |
Definition at line 378 of file mhd_str.c.
References charsequalcaseless, MHD_HTTP_OK, and toasciilower.
Referenced by add_user_headers(), lookup_sub_value(), MHD_create_post_processor(), MHD_post_process(), post_process_multipart(), process_multipart_headers(), and try_match_header().
Check whether str has case-insensitive token. Token could be surrounded by spaces and tabs and delimited by comma. Match succeed if substring between start, end of string or comma contains only case-insensitive token and optional spaces and tabs.
str | the string to check |
token | the token to find |
token_len | length of token, not including optional terminating null-character. |
Check whether str has case-insensitive token. Token could be surrounded by spaces and tabs and delimited by comma. Match succeed if substring between start, end (of string) or comma contains only case-insensitive token and optional spaces and tabs.
str | the string to check |
token | the token to find |
token_len | length of token, not including optional terminating null-character. |
Check whether str has case-insensitive token. Token could be surrounded by spaces and tabs and delimited by comma. Match succeed if substring between start, end (of string) or comma contains only case-insensitive token and optional spaces and tabs.
str | the string to check |
token | the token to find |
token_len | length of token, not including optional terminating null-character. |
Definition at line 412 of file mhd_str.c.
References charsequalcaseless, MHD_HTTP_OK, and toasciilower.
Referenced by check_response_header_token_ci(), MHD_check_response_header_token_ci(), MHD_lookup_header_token_ci(), and MHD_lookup_header_token_ci().
bool MHD_str_remove_token_caseless_ | ( | const char * | str, |
size_t | str_len, | ||
const char *const | token, | ||
const size_t | token_len, | ||
char * | buf, | ||
ssize_t * | buf_size | ||
) |
Remove case-insensitive token from the str and put result to the output buf.
Tokens in str could be surrounded by spaces and tabs and delimited by comma. The token match succeed if substring between start, end (of string) or comma contains only case-insensitive token and optional spaces and tabs. The quoted strings and comments are not supported by this function.
The output string is normalised: empty tokens and repeated whitespaces are removed, no whitespaces before commas, exactly one space is used after each comma.
str | the string to process | |
str_len | the length of the str, not including optional terminating null-character. | |
token | the token to find | |
token_len | the length of token, not including optional terminating null-character. | |
[out] | buf | the output buffer, not null-terminated. |
[in,out] | buf_size | pointer to the size variable, at input it is the size of allocated buffer, at output it is the size of the resulting string (can be up to 50% larger than input) or negative value if there is not enough space for the result |
< the "input" string / character
< the "output" string / character
< position of matched character in the token
< the first char of current token
Definition at line 553 of file mhd_str.c.
References charsequalcaseless, mhd_assert, MHD_HTTP_OK, and NULL.
Referenced by add_response_header_connection().
bool MHD_str_remove_tokens_caseless_ | ( | char * | str, |
size_t * | str_len, | ||
const char *const | tokens, | ||
const size_t | tokens_len | ||
) |
Perform in-place case-insensitive removal of tokens from the str.
Token could be surrounded by spaces and tabs and delimited by comma. The token match succeed if substring between start, end (of the string), or comma contains only case-insensitive token and optional spaces and tabs. The quoted strings and comments are not supported by this function.
The input string must be normalised: empty tokens and repeated whitespaces are removed, no whitespaces before commas, exactly one space is used after each comma. The string is updated in-place.
Behavior is undefined is the input string in not normalised.
[in,out] | str | the string to update |
[in,out] | str_len | the length of the str, not including optional terminating null-character, not null-terminated |
tokens | the token to find | |
tokens_len | the length of tokens, not including optional terminating null-character. |
< a short alias for tokens
< position in tokens
< the current token
< the 'read' position in the str
< the 'write' position in the str
Definition at line 720 of file mhd_str.c.
References mhd_assert, MHD_HTTP_OK, MHD_str_equal_caseless_bin_n_(), and NULL.
Referenced by add_response_header_connection(), and del_response_header_connection().
Convert decimal US-ASCII digits in string to number in uint64_t. Conversion stopped at first non-digit character.
str | string to convert |
out_val | pointer to uint64_t to store result of conversion |
Convert decimal US-ASCII digits in string to number in uint64_t. Conversion stopped at first non-digit character.
str | string to convert | |
[out] | out_val | pointer to uint64_t to store result of conversion |
Definition at line 473 of file mhd_str.c.
References isasciidigit, MHD_HTTP_OK, and UINT64_MAX.
Referenced by parse_request_headers().
Convert not more then maxlen decimal US-ASCII digits in string to number in uint64_t. Conversion stopped at first non-digit character or after maxlen digits.
str | string to convert |
maxlen | maximum number of characters to process |
out_val | pointer to uint64_t to store result of conversion |
Convert not more then maxlen decimal US-ASCII digits in string to number in uint64_t. Conversion stopped at first non-digit character or after maxlen digits.
str | string to convert | |
maxlen | maximum number of characters to process | |
[out] | out_val | pointer to uint64_t to store result of conversion |
Definition at line 515 of file mhd_str.c.
References isasciidigit, MHD_HTTP_OK, and UINT64_MAX.
Referenced by parse_connection_headers().
Convert hexadecimal US-ASCII digits in string to number in uint32_t. Conversion stopped at first non-digit character.
str | string to convert |
out_val | pointer to uint32_t to store result of conversion |
Convert hexadecimal US-ASCII digits in string to number in uint32_t. Conversion stopped at first non-digit character.
str | string to convert | |
[out] | out_val | pointer to uint32_t to store result of conversion |
Definition at line 558 of file mhd_str.c.
References MHD_HTTP_OK, toxdigitvalue, and UINT32_MAX.
Convert not more then maxlen hexadecimal US-ASCII digits in string to number in uint32_t. Conversion stopped at first non-digit character or after maxlen digits.
str | string to convert |
maxlen | maximum number of characters to process |
out_val | pointer to uint32_t to store result of conversion |
Convert not more then maxlen hexadecimal US-ASCII digits in string to number in uint32_t. Conversion stopped at first non-digit character or after maxlen digits.
str | string to convert | |
maxlen | maximum number of characters to process | |
[out] | out_val | pointer to uint32_t to store result of conversion |
Definition at line 605 of file mhd_str.c.
References MHD_HTTP_OK, toxdigitvalue, and UINT32_MAX.
Referenced by digest_auth_check_all(), and MHD_http_unescape().
Convert hexadecimal US-ASCII digits in string to number in uint64_t. Conversion stopped at first non-digit character.
str | string to convert |
out_val | pointer to uint64_t to store result of conversion |
Convert hexadecimal US-ASCII digits in string to number in uint64_t. Conversion stopped at first non-digit character.
str | string to convert | |
[out] | out_val | pointer to uint64_t to store result of conversion |
Definition at line 646 of file mhd_str.c.
References MHD_HTTP_OK, toxdigitvalue, and UINT64_MAX.
Convert not more then maxlen hexadecimal US-ASCII digits in string to number in uint64_t. Conversion stopped at first non-digit character or after maxlen digits.
str | string to convert |
maxlen | maximum number of characters to process |
out_val | pointer to uint64_t to store result of conversion |
Convert not more then maxlen hexadecimal US-ASCII digits in string to number in uint64_t. Conversion stopped at first non-digit character or after maxlen digits.
str | string to convert | |
maxlen | maximum number of characters to process | |
[out] | out_val | pointer to uint64_t to store result of conversion |
Definition at line 692 of file mhd_str.c.
References MHD_HTTP_OK, toxdigitvalue, and UINT64_MAX.
Referenced by digest_auth_check_all(), process_request_body(), and process_request_body().
Convert uint16_t value to decimal US-ASCII string.
val | the value to convert |
buf | the buffer to result to |
buf_size | size of the buffer |
< pointer to the current printed digit
Definition at line 1234 of file mhd_str.c.
References mhd_assert, and MHD_HTTP_OK.
Referenced by build_header_response(), and get_date_str().
Convert uint32_t value to hexdecimal US-ASCII string.
val | the value to convert |
buf | the buffer to result to |
buf_size | size of the buffer |
< position of the output character
zero-based, digit position in 'val'
Definition at line 1202 of file mhd_str.c.
References MHD_HTTP_OK.
Referenced by try_ready_chunked_body().
Convert uint64_t value to decimal US-ASCII string.
val | the value to convert |
buf | the buffer to result to |
buf_size | size of the buffer |
< pointer to the current printed digit
Definition at line 1275 of file mhd_str.c.
References mhd_assert, and MHD_HTTP_OK.
Referenced by build_header_response().
Convert uint16_t value to decimal US-ASCII string padded with zeros on the left side.
val | the value to convert |
min_digits | the minimal number of digits to print, output padded with zeros on the left side, 'zero' value is interpreted as 'one', valid values are 3, 2, 1, 0 |
buf | the buffer to result to |
buf_size | size of the buffer |
< the position of the current printed digit
Definition at line 1313 of file mhd_str.c.
References mhd_assert, and MHD_HTTP_OK.
Referenced by get_date_str().