diff options
author | Evgeny Grin (Karlson2k) <k2k@narod.ru> | 2019-05-01 22:10:38 +0300 |
---|---|---|
committer | Evgeny Grin (Karlson2k) <k2k@narod.ru> | 2019-05-01 22:12:24 +0300 |
commit | 8aa7d23219052cde065b93adf04c5ded067a1fea (patch) | |
tree | fbf947885f56dd3f3da17a330c39178291ad53a7 /src/include | |
parent | 08ea0cc894bfdd9aeddeb8bb113514c247d2c69e (diff) | |
download | libmicrohttpd-8aa7d23219052cde065b93adf04c5ded067a1fea.tar.gz libmicrohttpd-8aa7d23219052cde065b93adf04c5ded067a1fea.zip |
Partial revert of 1b610e5b13b7b96e7b3f372c8da1ec9d840f896a.
Implemented new functions for key and value with binary zero.
Significantly speedup search for key by using key size.
Diffstat (limited to 'src/include')
-rw-r--r-- | src/include/microhttpd.h | 42 |
1 files changed, 34 insertions, 8 deletions
diff --git a/src/include/microhttpd.h b/src/include/microhttpd.h index d4d17ebc..77e80354 100644 --- a/src/include/microhttpd.h +++ b/src/include/microhttpd.h | |||
@@ -128,7 +128,7 @@ typedef intptr_t ssize_t; | |||
128 | * Current version of the library. | 128 | * Current version of the library. |
129 | * 0x01093001 = 1.9.30-1. | 129 | * 0x01093001 = 1.9.30-1. |
130 | */ | 130 | */ |
131 | #define MHD_VERSION 0x00096302 | 131 | #define MHD_VERSION 0x00096303 |
132 | 132 | ||
133 | /** | 133 | /** |
134 | * MHD-internal return code for "YES". | 134 | * MHD-internal return code for "YES". |
@@ -2041,6 +2041,29 @@ typedef void | |||
2041 | * @param kind kind of the header we are looking at | 2041 | * @param kind kind of the header we are looking at |
2042 | * @param key key for the value, can be an empty string | 2042 | * @param key key for the value, can be an empty string |
2043 | * @param value corresponding value, can be NULL | 2043 | * @param value corresponding value, can be NULL |
2044 | * @return #MHD_YES to continue iterating, | ||
2045 | * #MHD_NO to abort the iteration | ||
2046 | * @ingroup request | ||
2047 | */ | ||
2048 | typedef int | ||
2049 | (*MHD_KeyValueIterator) (void *cls, | ||
2050 | enum MHD_ValueKind kind, | ||
2051 | const char *key, | ||
2052 | const char *value); | ||
2053 | |||
2054 | |||
2055 | /** | ||
2056 | * Iterator over key-value pairs with size parameters. | ||
2057 | * This iterator can be used to iterate over all of | ||
2058 | * the cookies, headers, or POST-data fields of a | ||
2059 | * request, and also to iterate over the headers that | ||
2060 | * have been added to a response. | ||
2061 | * @note Available since #MHD_VERSION 0x00096303 | ||
2062 | * | ||
2063 | * @param cls closure | ||
2064 | * @param kind kind of the header we are looking at | ||
2065 | * @param key key for the value, can be an empty string | ||
2066 | * @param value corresponding value, can be NULL | ||
2044 | * @param value_size number of bytes in @a value, NEW since #MHD_VERSION 0x00096301; | 2067 | * @param value_size number of bytes in @a value, NEW since #MHD_VERSION 0x00096301; |
2045 | * for C-strings, the length excludes the 0-terminator | 2068 | * for C-strings, the length excludes the 0-terminator |
2046 | * @return #MHD_YES to continue iterating, | 2069 | * @return #MHD_YES to continue iterating, |
@@ -2048,11 +2071,12 @@ typedef void | |||
2048 | * @ingroup request | 2071 | * @ingroup request |
2049 | */ | 2072 | */ |
2050 | typedef int | 2073 | typedef int |
2051 | (*MHD_KeyValueIterator) (void *cls, | 2074 | (*MHD_KeyValueIteratorN) (void *cls, |
2052 | enum MHD_ValueKind kind, | 2075 | enum MHD_ValueKind kind, |
2053 | const char *key, | 2076 | const char *key, |
2077 | size_t key_size, | ||
2054 | const char *value, | 2078 | const char *value, |
2055 | size_t value_size); | 2079 | size_t value_size); |
2056 | 2080 | ||
2057 | 2081 | ||
2058 | /** | 2082 | /** |
@@ -2531,6 +2555,7 @@ MHD_set_connection_value (struct MHD_Connection *connection, | |||
2531 | * value should be set | 2555 | * value should be set |
2532 | * @param kind kind of the value | 2556 | * @param kind kind of the value |
2533 | * @param key key for the value | 2557 | * @param key key for the value |
2558 | * @param key_size number of bytes in @a key (excluding 0-terminator for C-strings) | ||
2534 | * @param value the value itself | 2559 | * @param value the value itself |
2535 | * @param value_size number of bytes in @a value (excluding 0-terminator for C-strings) | 2560 | * @param value_size number of bytes in @a value (excluding 0-terminator for C-strings) |
2536 | * @return #MHD_NO if the operation could not be | 2561 | * @return #MHD_NO if the operation could not be |
@@ -2539,11 +2564,12 @@ MHD_set_connection_value (struct MHD_Connection *connection, | |||
2539 | * @ingroup request | 2564 | * @ingroup request |
2540 | */ | 2565 | */ |
2541 | int | 2566 | int |
2542 | MHD_set_connection_value2 (struct MHD_Connection *connection, | 2567 | MHD_set_connection_value_n (struct MHD_Connection *connection, |
2543 | enum MHD_ValueKind kind, | 2568 | enum MHD_ValueKind kind, |
2544 | const char *key, | 2569 | const char *key, |
2545 | const char *value, | 2570 | size_t key_size, |
2546 | size_t value_size); | 2571 | const char *value, |
2572 | size_t value_size); | ||
2547 | 2573 | ||
2548 | 2574 | ||
2549 | /** | 2575 | /** |