diff options
Diffstat (limited to 'src/include/microhttpd.h')
-rw-r--r-- | src/include/microhttpd.h | 79 |
1 files changed, 59 insertions, 20 deletions
diff --git a/src/include/microhttpd.h b/src/include/microhttpd.h index 7b72dfa6..c545ecc3 100644 --- a/src/include/microhttpd.h +++ b/src/include/microhttpd.h | |||
@@ -96,7 +96,7 @@ extern "C" | |||
96 | * they are parsed as decimal numbers. | 96 | * they are parsed as decimal numbers. |
97 | * Example: 0x01093001 = 1.9.30-1. | 97 | * Example: 0x01093001 = 1.9.30-1. |
98 | */ | 98 | */ |
99 | #define MHD_VERSION 0x00097536 | 99 | #define MHD_VERSION 0x00097537 |
100 | 100 | ||
101 | /* If generic headers don't work on your platform, include headers | 101 | /* If generic headers don't work on your platform, include headers |
102 | which define 'va_list', 'size_t', 'ssize_t', 'intptr_t', 'off_t', | 102 | which define 'va_list', 'size_t', 'ssize_t', 'intptr_t', 'off_t', |
@@ -4738,7 +4738,16 @@ MHD_digest_auth_calc_userhash_hex (enum MHD_DigestAuthAlgo3 algo3, | |||
4738 | /** | 4738 | /** |
4739 | * The type of username used by client in Digest Authorization header | 4739 | * The type of username used by client in Digest Authorization header |
4740 | * | 4740 | * |
4741 | * @note Available since #MHD_VERSION 0x00097519 | 4741 | * Values are sorted so simplified checks could be used. |
4742 | * For example: | ||
4743 | * * (value <= MHD_DIGEST_AUTH_UNAME_TYPE_INVALID) is true if not valid username | ||
4744 | * is provided by the client | ||
4745 | * * (value >= MHD_DIGEST_AUTH_UNAME_TYPE_USERHASH) is true if username is | ||
4746 | * provided in any form | ||
4747 | * * (value >= MHD_DIGEST_AUTH_UNAME_TYPE_STANDARD) is true if username is | ||
4748 | * provided in clear text (not userhash matching is needed) | ||
4749 | * | ||
4750 | * @note Available since #MHD_VERSION 0x00097537 | ||
4742 | */ | 4751 | */ |
4743 | enum MHD_DigestAuthUsernameType | 4752 | enum MHD_DigestAuthUsernameType |
4744 | { | 4753 | { |
@@ -4751,7 +4760,7 @@ enum MHD_DigestAuthUsernameType | |||
4751 | /** | 4760 | /** |
4752 | * The 'username' parameter is used to specify the username. | 4761 | * The 'username' parameter is used to specify the username. |
4753 | */ | 4762 | */ |
4754 | MHD_DIGEST_AUTH_UNAME_TYPE_STANDARD = 1, | 4763 | MHD_DIGEST_AUTH_UNAME_TYPE_STANDARD = (1 << 2), |
4755 | 4764 | ||
4756 | /** | 4765 | /** |
4757 | * The username is specified by 'username*' parameter with | 4766 | * The username is specified by 'username*' parameter with |
@@ -4759,14 +4768,14 @@ enum MHD_DigestAuthUsernameType | |||
4759 | * The only difference between standard and extended types is | 4768 | * The only difference between standard and extended types is |
4760 | * the way how username value is encoded in the header. | 4769 | * the way how username value is encoded in the header. |
4761 | */ | 4770 | */ |
4762 | MHD_DIGEST_AUTH_UNAME_TYPE_EXTENDED = 2, | 4771 | MHD_DIGEST_AUTH_UNAME_TYPE_EXTENDED = (1 << 3), |
4763 | 4772 | ||
4764 | /** | 4773 | /** |
4765 | * The username provided in form of 'userhash' as | 4774 | * The username provided in form of 'userhash' as |
4766 | * specified by RFC 7616 #section-3.4.4. | 4775 | * specified by RFC 7616 #section-3.4.4. |
4767 | * @sa #MHD_digest_auth_calc_userhash_hex(), #MHD_digest_auth_calc_userhash() | 4776 | * @sa #MHD_digest_auth_calc_userhash_hex(), #MHD_digest_auth_calc_userhash() |
4768 | */ | 4777 | */ |
4769 | MHD_DIGEST_AUTH_UNAME_TYPE_USERHASH = 3, | 4778 | MHD_DIGEST_AUTH_UNAME_TYPE_USERHASH = (1 << 1), |
4770 | 4779 | ||
4771 | /** | 4780 | /** |
4772 | * The invalid combination of username parameters are used by client. | 4781 | * The invalid combination of username parameters are used by client. |
@@ -4776,7 +4785,7 @@ enum MHD_DigestAuthUsernameType | |||
4776 | * * 'username*' used with invalid extended notation | 4785 | * * 'username*' used with invalid extended notation |
4777 | * * 'username' is not hexadecimal digits, while 'userhash' set to 'true' | 4786 | * * 'username' is not hexadecimal digits, while 'userhash' set to 'true' |
4778 | */ | 4787 | */ |
4779 | MHD_DIGEST_AUTH_UNAME_TYPE_INVALID = 15 | 4788 | MHD_DIGEST_AUTH_UNAME_TYPE_INVALID = (1 << 0) |
4780 | } _MHD_FIXED_ENUM; | 4789 | } _MHD_FIXED_ENUM; |
4781 | 4790 | ||
4782 | /** | 4791 | /** |
@@ -4883,7 +4892,7 @@ enum MHD_DigestAuthMultiQOP | |||
4883 | * | 4892 | * |
4884 | * Application may modify buffers as needed until #MHD_free() is called for | 4893 | * Application may modify buffers as needed until #MHD_free() is called for |
4885 | * pointer to this structure | 4894 | * pointer to this structure |
4886 | * @note Available since #MHD_VERSION 0x00097533 | 4895 | * @note Available since #MHD_VERSION 0x00097537 |
4887 | */ | 4896 | */ |
4888 | struct MHD_DigestAuthInfo | 4897 | struct MHD_DigestAuthInfo |
4889 | { | 4898 | { |
@@ -4902,14 +4911,12 @@ struct MHD_DigestAuthInfo | |||
4902 | 4911 | ||
4903 | /** | 4912 | /** |
4904 | * The username string. | 4913 | * The username string. |
4905 | * Valid only if username is standard, extended, or userhash. | 4914 | * Used only if username type is standard or extended, always NULL otherwise. |
4906 | * For userhash this is unqoted string without decoding of the | ||
4907 | * hexadecimal digits (as provided by the client). | ||
4908 | * If extended notation is used, this string is pct-decoded string | 4915 | * If extended notation is used, this string is pct-decoded string |
4909 | * with charset and language tag removed (i.e. it is original username | 4916 | * with charset and language tag removed (i.e. it is original username |
4910 | * extracted from the extended notation). | 4917 | * extracted from the extended notation). |
4911 | * This can be NULL is username is missing or invalid. | 4918 | * When userhash is used by the client, this member is NULL and |
4912 | * @sa #MHD_digest_auth_calc_userhash_hex() | 4919 | * @a userhash_hex is set. |
4913 | */ | 4920 | */ |
4914 | char *username; | 4921 | char *username; |
4915 | 4922 | ||
@@ -4920,11 +4927,27 @@ struct MHD_DigestAuthInfo | |||
4920 | size_t username_len; | 4927 | size_t username_len; |
4921 | 4928 | ||
4922 | /** | 4929 | /** |
4930 | * The userhash string. | ||
4931 | * Valid only if username type is userhash. | ||
4932 | * This is unqoted string without decoding of the hexadecimal | ||
4933 | * digits (as provided by the client). | ||
4934 | * @sa #MHD_digest_auth_calc_userhash_hex() | ||
4935 | */ | ||
4936 | char *userhash_hex; | ||
4937 | |||
4938 | /** | ||
4939 | * The length of the @a userhash_hex in characters. | ||
4940 | * The valid size should be #MHD_digest_get_hash_size(algo3) * 2 characters. | ||
4941 | * When the @a userhash_hex is NULL, this member is always zero. | ||
4942 | */ | ||
4943 | size_t userhash_hex_len; | ||
4944 | |||
4945 | /** | ||
4923 | * The userhash decoded to binary form. | 4946 | * The userhash decoded to binary form. |
4924 | * Used only if username type is userhash, always NULL otherwise. | 4947 | * Used only if username type is userhash, always NULL otherwise. |
4925 | * When not NULL, this points to binary sequence @a username_len /2 bytes | 4948 | * When not NULL, this points to binary sequence @a userhash_hex_len /2 bytes |
4926 | * long. | 4949 | * long. |
4927 | * The valid size should be #MHD_digest_get_hash_size(algo) bytes. | 4950 | * The valid size should be #MHD_digest_get_hash_size(algo3) bytes. |
4928 | * @warning This is binary data, no zero termination. | 4951 | * @warning This is binary data, no zero termination. |
4929 | * @warning To avoid buffer overruns, always check the size of the data before | 4952 | * @warning To avoid buffer overruns, always check the size of the data before |
4930 | * use, because @a userhash_bin can point even to zero-sized | 4953 | * use, because @a userhash_bin can point even to zero-sized |
@@ -5007,7 +5030,7 @@ MHD_digest_auth_get_request_info3 (struct MHD_Connection *connection); | |||
5007 | * | 5030 | * |
5008 | * Application may modify buffers as needed until #MHD_free() is called for | 5031 | * Application may modify buffers as needed until #MHD_free() is called for |
5009 | * pointer to this structure | 5032 | * pointer to this structure |
5010 | * @note Available since #MHD_VERSION 0x00097534 | 5033 | * @note Available since #MHD_VERSION 0x00097537 |
5011 | */ | 5034 | */ |
5012 | struct MHD_DigestAuthUsernameInfo | 5035 | struct MHD_DigestAuthUsernameInfo |
5013 | { | 5036 | { |
@@ -5028,12 +5051,12 @@ struct MHD_DigestAuthUsernameInfo | |||
5028 | 5051 | ||
5029 | /** | 5052 | /** |
5030 | * The username string. | 5053 | * The username string. |
5031 | * For userhash this is unqoted string without decoding of the | 5054 | * Used only if username type is standard or extended, always NULL otherwise. |
5032 | * hexadecimal digits (as provided by client). | ||
5033 | * If extended notation is used, this string is pct-decoded string | 5055 | * If extended notation is used, this string is pct-decoded string |
5034 | * with charset and language tag removed (i.e. it is original username | 5056 | * with charset and language tag removed (i.e. it is original username |
5035 | * extracted from the extended notation). | 5057 | * extracted from the extended notation). |
5036 | * @sa #MHD_digest_auth_calc_userhash_hex() | 5058 | * When userhash is used by the client, this member is NULL and |
5059 | * @a userhash_hex is set. | ||
5037 | */ | 5060 | */ |
5038 | char *username; | 5061 | char *username; |
5039 | 5062 | ||
@@ -5044,11 +5067,27 @@ struct MHD_DigestAuthUsernameInfo | |||
5044 | size_t username_len; | 5067 | size_t username_len; |
5045 | 5068 | ||
5046 | /** | 5069 | /** |
5070 | * The userhash string. | ||
5071 | * Valid only if username type is userhash. | ||
5072 | * This is unqoted string without decoding of the hexadecimal | ||
5073 | * digits (as provided by the client). | ||
5074 | * @sa #MHD_digest_auth_calc_userhash_hex() | ||
5075 | */ | ||
5076 | char *userhash_hex; | ||
5077 | |||
5078 | /** | ||
5079 | * The length of the @a userhash_hex in characters. | ||
5080 | * The valid size should be #MHD_digest_get_hash_size(algo3) * 2 characters. | ||
5081 | * When the @a userhash_hex is NULL, this member is always zero. | ||
5082 | */ | ||
5083 | size_t userhash_hex_len; | ||
5084 | |||
5085 | /** | ||
5047 | * The userhash decoded to binary form. | 5086 | * The userhash decoded to binary form. |
5048 | * Used only if username type is userhash, always NULL otherwise. | 5087 | * Used only if username type is userhash, always NULL otherwise. |
5049 | * When not NULL, this points to binary sequence @a username_len /2 bytes | 5088 | * When not NULL, this points to binary sequence @a userhash_hex_len /2 bytes |
5050 | * long. | 5089 | * long. |
5051 | * The valid size should be #MHD_digest_get_hash_size(algo) bytes. | 5090 | * The valid size should be #MHD_digest_get_hash_size(algo3) bytes. |
5052 | * @warning This is binary data, no zero termination. | 5091 | * @warning This is binary data, no zero termination. |
5053 | * @warning To avoid buffer overruns, always check the size of the data before | 5092 | * @warning To avoid buffer overruns, always check the size of the data before |
5054 | * use, because @a userhash_bin can point even to zero-sized | 5093 | * use, because @a userhash_bin can point even to zero-sized |