aboutsummaryrefslogtreecommitdiff
path: root/src/microhttpd/mhd_str.h
diff options
context:
space:
mode:
authorEvgeny Grin (Karlson2k) <k2k@narod.ru>2016-01-16 19:23:00 +0000
committerEvgeny Grin (Karlson2k) <k2k@narod.ru>2016-01-16 19:23:00 +0000
commitad9b3c3814e92a2bb1ce1cd114328d5de741c33d (patch)
treeea1f1433119ed0d6c39df0233847f67519deca3b /src/microhttpd/mhd_str.h
parent56810e175c26cb40f8b7df2fdcf7a7defd6bbabe (diff)
downloadlibmicrohttpd-ad9b3c3814e92a2bb1ce1cd114328d5de741c33d.tar.gz
libmicrohttpd-ad9b3c3814e92a2bb1ce1cd114328d5de741c33d.zip
Use only US-ASCII charset when comparing stings as caseless as required by standard.
Comparisons for HTTP headers must not be affected by locale settings.
Diffstat (limited to 'src/microhttpd/mhd_str.h')
-rw-r--r--src/microhttpd/mhd_str.h62
1 files changed, 62 insertions, 0 deletions
diff --git a/src/microhttpd/mhd_str.h b/src/microhttpd/mhd_str.h
new file mode 100644
index 00000000..59902e80
--- /dev/null
+++ b/src/microhttpd/mhd_str.h
@@ -0,0 +1,62 @@
1/*
2 This file is part of libmicrohttpd
3 Copyright (C) 2015 Karlson2k (Evgeny Grin)
4
5 This library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Lesser General Public
7 License as published by the Free Software Foundation; either
8 version 2.1 of the License, or (at your option) any later version.
9
10 This library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Lesser General Public License for more details.
14
15 You should have received a copy of the GNU Lesser General Public
16 License along with this library; if not, write to the Free Software
17 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
18*/
19
20/**
21 * @file microhttpd/mhd_str.h
22 * @brief Header for string manipulating helpers
23 * @author Karlson2k (Evgeny Grin)
24 */
25
26#ifndef MHD_STR_H
27#define MHD_STR_H 1
28
29#include <stdint.h>
30
31/*
32 * Block of functions/macros that use US-ASCII charset as required by HTTP
33 * standards. Not affected by current locale settings.
34 */
35
36/**
37 * Check two string for equality, ignoring case of US-ASCII letters.
38 * @param str1 first string to compare
39 * @param str2 second string to compare
40 * @return non-zero if two strings are equal, zero otherwise.
41 */
42int
43MHD_str_equal_caseless_ (const char * str1,
44 const char * str2);
45
46
47/**
48 * Check two string for equality, ignoring case of US-ASCII letters and
49 * checking not more than @a maxlen characters.
50 * Compares up to first terminating null character, but not more than
51 * first @a maxlen characters.
52 * @param str1 first string to compare
53 * @param str2 second string to compare
54 * @patam maxlen maximum number of characters to compare
55 * @return non-zero if two strings are equal, zero otherwise.
56 */
57int
58MHD_str_equal_caseless_n_ (const char * const str1,
59 const char * const str2,
60 size_t maxlen);
61
62#endif /* MHD_STR_H */