aboutsummaryrefslogtreecommitdiff
path: root/src/microhttpd/mhd_str.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/microhttpd/mhd_str.h')
-rw-r--r--src/microhttpd/mhd_str.h59
1 files changed, 58 insertions, 1 deletions
diff --git a/src/microhttpd/mhd_str.h b/src/microhttpd/mhd_str.h
index 91219cba..dd74e602 100644
--- a/src/microhttpd/mhd_str.h
+++ b/src/microhttpd/mhd_str.h
@@ -144,6 +144,24 @@ MHD_str_equal_caseless_bin_n_ (const char *const str1,
144 144
145 145
146/** 146/**
147 * Check whether string is equal statically allocated another string,
148 * ignoring case of US-ASCII letters and checking not more than @a len bytes.
149 *
150 * If strings have different sizes (lengths) then macro returns boolean false
151 * without checking the content.
152 *
153 * Compares not more first than @a len bytes, including binary zero characters.
154 * Comparison stops at first unmatched byte.
155 * @param a the statically allocated string to compare
156 * @param s the string to compare
157 * @param len number of characters to compare
158 * @return non-zero if @a len bytes are equal, zero otherwise.
159 */
160#define MHD_str_equal_caseless_s_bin_n_(a,s,l) \
161 ((MHD_STATICSTR_LEN_(a) == (l)) \
162 && MHD_str_equal_caseless_bin_n_(a,s,l))
163
164/**
147 * Check whether @a str has case-insensitive @a token. 165 * Check whether @a str has case-insensitive @a token.
148 * Token could be surrounded by spaces and tabs and delimited by comma. 166 * Token could be surrounded by spaces and tabs and delimited by comma.
149 * Match succeed if substring between start, end (of string) or comma 167 * Match succeed if substring between start, end (of string) or comma
@@ -484,7 +502,7 @@ MHD_uint8_to_str_pad (uint8_t val,
484 * hexadecimal digits, zero-terminate the result. 502 * hexadecimal digits, zero-terminate the result.
485 * @param bin the pointer to the binary data to convert 503 * @param bin the pointer to the binary data to convert
486 * @param size the size in bytes of the binary data to convert 504 * @param size the size in bytes of the binary data to convert
487 * @param hex the output buffer, should be at least 2 * @a size + 1 505 * @param[out] hex the output buffer, should be at least 2 * @a size + 1
488 * @return The number of characters written to the output buffer, 506 * @return The number of characters written to the output buffer,
489 * not including terminating zero. 507 * not including terminating zero.
490 */ 508 */
@@ -631,6 +649,25 @@ MHD_str_equal_quoted_bin_n (const char *quoted,
631 size_t unquoted_len); 649 size_t unquoted_len);
632 650
633/** 651/**
652 * Check whether the string after "unquoting" equals static string.
653 *
654 * Null-termination for input string is not required, binary zeros compared
655 * like other characters.
656 *
657 * @param q the quoted string to compare, must NOT include leading and
658 * closing DQUOTE chars, does not need to be zero-terminated
659 * @param l the length in chars of the @a q string
660 * @param u the unquoted static string to compare
661 * @return zero if quoted form is broken (no character after the last escaping
662 * backslash), zero if strings are not equal after unquoting of the
663 * first string,
664 * non-zero if two strings are equal after unquoting of the
665 * first string.
666 */
667#define MHD_str_equal_quoted_s_bin_n(q,l,u) \
668 MHD_str_equal_quoted_bin_n(q,l,u,MHD_STATICSTR_LEN_(u))
669
670/**
634 * Check two strings for equality, "unquoting" the first string from quoted 671 * Check two strings for equality, "unquoting" the first string from quoted
635 * form as specified by RFC7230#section-3.2.6 and RFC7694#quoted.strings and 672 * form as specified by RFC7230#section-3.2.6 and RFC7694#quoted.strings and
636 * ignoring case of US-ASCII letters. 673 * ignoring case of US-ASCII letters.
@@ -657,6 +694,26 @@ MHD_str_equal_caseless_quoted_bin_n (const char *quoted,
657 size_t unquoted_len); 694 size_t unquoted_len);
658 695
659/** 696/**
697 * Check whether the string after "unquoting" equals static string, ignoring
698 * case of US-ASCII letters.
699 *
700 * Null-termination for input string is not required, binary zeros compared
701 * like other characters.
702 *
703 * @param q the quoted string to compare, must NOT include leading and
704 * closing DQUOTE chars, does not need to be zero-terminated
705 * @param l the length in chars of the @a q string
706 * @param u the unquoted static string to compare
707 * @return zero if quoted form is broken (no character after the last escaping
708 * backslash), zero if strings are not equal after unquoting of the
709 * first string,
710 * non-zero if two strings are caseless equal after unquoting of the
711 * first string.
712 */
713#define MHD_str_equal_caseless_quoted_s_bin_n(q,l,u) \
714 MHD_str_equal_caseless_quoted_bin_n(q,l,u,MHD_STATICSTR_LEN_(u))
715
716/**
660 * Convert string from quoted to unquoted form as specified by 717 * Convert string from quoted to unquoted form as specified by
661 * RFC7230#section-3.2.6 and RFC7694#quoted.strings. 718 * RFC7230#section-3.2.6 and RFC7694#quoted.strings.
662 * 719 *