aboutsummaryrefslogtreecommitdiff
path: root/src/microhttpd/test_auth_parse.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/microhttpd/test_auth_parse.c')
-rw-r--r--src/microhttpd/test_auth_parse.c460
1 files changed, 347 insertions, 113 deletions
diff --git a/src/microhttpd/test_auth_parse.c b/src/microhttpd/test_auth_parse.c
index b9507f97..8c11499b 100644
--- a/src/microhttpd/test_auth_parse.c
+++ b/src/microhttpd/test_auth_parse.c
@@ -956,13 +956,15 @@ cmp_dauth_param (const char *pname, const struct MHD_RqDAuthParam *param,
956 if (0 != ret) 956 if (0 != ret)
957 { 957 {
958 fprintf (stderr, "Parameter '%s' parsed incorrectly:\n", pname); 958 fprintf (stderr, "Parameter '%s' parsed incorrectly:\n", pname);
959 fprintf (stderr, "\tRESULT :\tvalue.str: %s", 959 fprintf (stderr, "\tRESULT :\tvalue.str: %.*s",
960 (int) (param->value.str ? param->value.len : 6),
960 param->value.str ? param->value.str : "(NULL)"); 961 param->value.str ? param->value.str : "(NULL)");
961 fprintf (stderr, "\tvalue.len: %u", 962 fprintf (stderr, "\tvalue.len: %u",
962 (unsigned) param->value.len); 963 (unsigned) param->value.len);
963 fprintf (stderr, "\tquoted: %s\n", 964 fprintf (stderr, "\tquoted: %s\n",
964 (unsigned) param->quoted ? "true" : "false"); 965 (unsigned) param->quoted ? "true" : "false");
965 fprintf (stderr, "\tEXPECTED:\tvalue.str: %s", 966 fprintf (stderr, "\tEXPECTED:\tvalue.str: %.*s",
967 (int) (expected_value ? expected_len : 6),
966 expected_value ? expected_value : "(NULL)"); 968 expected_value ? expected_value : "(NULL)");
967 fprintf (stderr, "\tvalue.len: %u", 969 fprintf (stderr, "\tvalue.len: %u",
968 (unsigned) expected_len); 970 (unsigned) expected_len);
@@ -977,13 +979,14 @@ cmp_dauth_param (const char *pname, const struct MHD_RqDAuthParam *param,
977static unsigned int 979static unsigned int
978expect_digest_n (const char *hdr, size_t hdr_len, 980expect_digest_n (const char *hdr, size_t hdr_len,
979 const char *nonce, 981 const char *nonce,
980 const char *algorithm, 982 enum MHD_DigestAuthAlgo3 algo3,
981 const char *response, 983 const char *response,
982 const char *username, 984 const char *username,
983 const char *username_ext, 985 const char *username_ext,
984 const char *realm, 986 const char *realm,
985 const char *uri, 987 const char *uri,
986 const char *qop, 988 const char *qop_raw,
989 enum MHD_DigestAuthQOP qop,
987 const char *cnonce, 990 const char *cnonce,
988 const char *nc, 991 const char *nc,
989 int userhash, 992 int userhash,
@@ -1003,14 +1006,31 @@ expect_digest_n (const char *hdr, size_t hdr_len,
1003 ret = 0; 1006 ret = 0;
1004 1007
1005 ret += cmp_dauth_param ("nonce", &h->nonce, nonce); 1008 ret += cmp_dauth_param ("nonce", &h->nonce, nonce);
1006 ret += cmp_dauth_param ("algorithm", &h->algorithm, algorithm); 1009 if (h->algo3 != algo3)
1010 {
1011 ret += 1;
1012 fprintf (stderr, "Parameter 'algorithm' detected incorrectly:\n");
1013 fprintf (stderr, "\tRESULT :\t%u\n",
1014 (unsigned) h->algo3);
1015 fprintf (stderr, "\tEXPECTED:\t%u\n",
1016 (unsigned) algo3);
1017 }
1007 ret += cmp_dauth_param ("response", &h->response, response); 1018 ret += cmp_dauth_param ("response", &h->response, response);
1008 ret += cmp_dauth_param ("username", &h->username, username); 1019 ret += cmp_dauth_param ("username", &h->username, username);
1009 ret += cmp_dauth_param ("username_ext", &h->username_ext, 1020 ret += cmp_dauth_param ("username_ext", &h->username_ext,
1010 username_ext); 1021 username_ext);
1011 ret += cmp_dauth_param ("realm", &h->realm, realm); 1022 ret += cmp_dauth_param ("realm", &h->realm, realm);
1012 ret += cmp_dauth_param ("uri", &h->uri, uri); 1023 ret += cmp_dauth_param ("uri", &h->uri, uri);
1013 ret += cmp_dauth_param ("qop", &h->qop, qop); 1024 ret += cmp_dauth_param ("qop", &h->qop_raw, qop_raw);
1025 if (h->qop != qop)
1026 {
1027 ret += 1;
1028 fprintf (stderr, "Parameter 'qop' detected incorrectly:\n");
1029 fprintf (stderr, "\tRESULT :\t%u\n",
1030 (unsigned) h->qop);
1031 fprintf (stderr, "\tEXPECTED:\t%u\n",
1032 (unsigned) qop);
1033 }
1014 ret += cmp_dauth_param ("cnonce", &h->cnonce, cnonce); 1034 ret += cmp_dauth_param ("cnonce", &h->cnonce, cnonce);
1015 ret += cmp_dauth_param ("nc", &h->nc, nc); 1035 ret += cmp_dauth_param ("nc", &h->nc, nc);
1016 if (h->userhash != ! (! userhash)) 1036 if (h->userhash != ! (! userhash))
@@ -1035,102 +1055,286 @@ expect_digest_n (const char *hdr, size_t hdr_len,
1035} 1055}
1036 1056
1037 1057
1038#define expect_digest(h,no,a,rs,un,ux,rm,ur,q,c,nc,uh) \ 1058#define expect_digest(h,no,a,rs,un,ux,rm,ur,qr,qe,c,nc,uh) \
1039 expect_digest_n(h,MHD_STATICSTR_LEN_(h),\ 1059 expect_digest_n(h,MHD_STATICSTR_LEN_(h),\
1040 no,a,rs,un,ux,rm,ur,q,c,nc,uh,__LINE__) 1060 no,a,rs,un,ux,rm,ur,qr,qe,c,nc,uh,__LINE__)
1041 1061
1042static unsigned int 1062static unsigned int
1043check_digest (void) 1063check_digest (void)
1044{ 1064{
1045 unsigned int r = 0; /**< The number of errors */ 1065 unsigned int r = 0; /**< The number of errors */
1046 1066
1047 r += expect_digest ("Digest", NULL, NULL, NULL, NULL, NULL, NULL, \ 1067 r += expect_digest ("Digest", NULL, MHD_DIGEST_AUTH_ALGO3_MD5, \
1048 NULL, NULL, NULL, NULL, 0); 1068 NULL, NULL, NULL, NULL, NULL, \
1049 r += expect_digest ("Digest nc=1", NULL, NULL, NULL, NULL, NULL, NULL, \ 1069 NULL, MHD_DIGEST_AUTH_QOP_NONE, NULL, NULL, 0);
1050 NULL, NULL, NULL, "1", 0); 1070 r += expect_digest ("Digest nc=1", NULL, MHD_DIGEST_AUTH_ALGO3_MD5, \
1051 r += expect_digest ("Digest nc=\"1\"", NULL, NULL, NULL, NULL, NULL, NULL, \ 1071 NULL, NULL, NULL, NULL, NULL, NULL, \
1052 NULL, NULL, NULL, "1", 0); 1072 MHD_DIGEST_AUTH_QOP_NONE, NULL, "1", 0);
1053 r += expect_digest ("Digest nc=\"1\" ", NULL, NULL, NULL, NULL, NULL, \ 1073 r += expect_digest ("Digest nc=\"1\"", NULL, MHD_DIGEST_AUTH_ALGO3_MD5, \
1054 NULL, NULL, NULL, NULL, "1", 0); 1074 NULL, NULL, NULL, NULL, NULL, \
1055 r += expect_digest ("Digest ,nc=\"1\" ", NULL, NULL, NULL, NULL, NULL, \ 1075 NULL, MHD_DIGEST_AUTH_QOP_NONE, NULL, "1", 0);
1056 NULL, NULL, NULL, NULL, "1", 0); 1076 r += expect_digest ("Digest nc=\"1\" ", NULL, MHD_DIGEST_AUTH_ALGO3_MD5, \
1057 r += expect_digest ("Digest nc=\"1\", ", NULL, NULL, NULL, NULL, NULL, \ 1077 NULL, NULL, NULL, NULL, NULL, \
1058 NULL, NULL, NULL, NULL, "1", 0); 1078 NULL, MHD_DIGEST_AUTH_QOP_NONE, NULL, "1", 0);
1059 r += expect_digest ("Digest nc=\"1\" , ", NULL, NULL, NULL, NULL, NULL, \ 1079 r += expect_digest ("Digest ,nc=\"1\" ", NULL, MHD_DIGEST_AUTH_ALGO3_MD5, \
1060 NULL, NULL, NULL, NULL, "1", 0); 1080 NULL, NULL, NULL, NULL, NULL, \
1061 r += expect_digest ("Digest nc=1, ", NULL, NULL, NULL, NULL, NULL, NULL, \ 1081 NULL, MHD_DIGEST_AUTH_QOP_NONE, NULL, "1", 0);
1062 NULL, NULL, NULL, "1", 0); 1082 r += expect_digest ("Digest nc=\"1\", ", NULL, MHD_DIGEST_AUTH_ALGO3_MD5, \
1063 r += expect_digest ("Digest nc=1 , ", NULL, NULL, NULL, NULL, NULL, NULL, \ 1083 NULL, NULL, NULL, NULL, NULL, \
1064 NULL, NULL, NULL, "1", 0); 1084 NULL, MHD_DIGEST_AUTH_QOP_NONE, NULL, "1", 0);
1065 r += expect_digest ("Digest ,,,nc=1, ", NULL, NULL, NULL, NULL, NULL, \ 1085 r += expect_digest ("Digest nc=\"1\" , ", NULL, MHD_DIGEST_AUTH_ALGO3_MD5, \
1066 NULL, NULL, NULL, NULL, "1", 0); 1086 NULL, NULL, NULL, NULL, NULL, \
1067 r += expect_digest ("Digest ,,,nc=1 , ", NULL, NULL, NULL, NULL, NULL, \ 1087 NULL, MHD_DIGEST_AUTH_QOP_NONE, NULL, "1", 0);
1068 NULL, NULL, NULL, NULL, "1", 0); 1088 r += expect_digest ("Digest nc=1, ", NULL, MHD_DIGEST_AUTH_ALGO3_MD5, \
1069 r += expect_digest ("Digest ,,,nc=\"1 \", ", NULL, NULL, NULL, NULL, \ 1089 NULL, NULL, NULL, NULL, NULL, \
1070 NULL, NULL, NULL, NULL, NULL, "1 ", 0); 1090 NULL, MHD_DIGEST_AUTH_QOP_NONE, NULL, "1", 0);
1071 r += expect_digest ("Digest nc=\"1 \"", NULL, NULL, NULL, NULL, NULL, NULL, \ 1091 r += expect_digest ("Digest nc=1 , ", NULL, MHD_DIGEST_AUTH_ALGO3_MD5, \
1072 NULL, NULL, NULL, "1 ", 0); 1092 NULL, NULL, NULL, NULL, NULL, \
1073 r += expect_digest ("Digest nc=\"1 \" ,", NULL, NULL, NULL, NULL, NULL, \ 1093 NULL, MHD_DIGEST_AUTH_QOP_NONE, NULL, "1", 0);
1074 NULL, NULL, NULL, NULL, "1 ", 0); 1094 r += expect_digest ("Digest ,,,nc=1, ", NULL, MHD_DIGEST_AUTH_ALGO3_MD5, \
1075 r += expect_digest ("Digest nc=\"1 \", ", NULL, NULL, NULL, NULL, NULL, \ 1095 NULL, NULL, NULL, NULL, NULL, \
1076 NULL, NULL, NULL, NULL, "1 ", 0); 1096 NULL, MHD_DIGEST_AUTH_QOP_NONE, NULL, "1", 0);
1077 r += expect_digest ("Digest nc=\"1;\", ", NULL, NULL, NULL, NULL, NULL, \ 1097 r += expect_digest ("Digest ,,,nc=1 , ", NULL, MHD_DIGEST_AUTH_ALGO3_MD5, \
1078 NULL, NULL, NULL, NULL, "1;", 0); 1098 NULL, NULL, NULL, NULL, NULL, \
1079 r += expect_digest ("Digest nc=\"1\\;\", ", NULL, NULL, NULL, NULL, NULL, \ 1099 NULL, MHD_DIGEST_AUTH_QOP_NONE, NULL, "1", 0);
1080 NULL, NULL, NULL, NULL, "1\\;", 0); 1100 r += expect_digest ("Digest ,,,nc=\"1 \", ", NULL, \
1081 1101 MHD_DIGEST_AUTH_ALGO3_MD5, \
1082 r += expect_digest ("Digest userhash=false", NULL, NULL, NULL, NULL, NULL, \ 1102 NULL, NULL, NULL, NULL, NULL, \
1083 NULL, NULL, NULL, NULL, NULL, 0); 1103 NULL, MHD_DIGEST_AUTH_QOP_NONE, NULL, "1 ", 0);
1084 r += expect_digest ("Digest userhash=\"false\"", NULL, NULL, NULL, NULL, NULL, \ 1104 r += expect_digest ("Digest nc=\"1 \"", NULL, MHD_DIGEST_AUTH_ALGO3_MD5, \
1085 NULL, NULL, NULL, NULL, NULL, 0); 1105 NULL, NULL, NULL, NULL, NULL, \
1086 r += expect_digest ("Digest userhash=foo", NULL, NULL, NULL, NULL, NULL, \ 1106 NULL, MHD_DIGEST_AUTH_QOP_NONE, NULL, "1 ", 0);
1087 NULL, NULL, NULL, NULL, NULL, 0); 1107 r += expect_digest ("Digest nc=\"1 \" ,", NULL, MHD_DIGEST_AUTH_ALGO3_MD5, \
1088 r += expect_digest ("Digest userhash=true", NULL, NULL, NULL, NULL, NULL, \ 1108 NULL, NULL, NULL, NULL, NULL, \
1089 NULL, NULL, NULL, NULL, NULL, 1); 1109 NULL, MHD_DIGEST_AUTH_QOP_NONE, NULL, "1 ", 0);
1090 r += expect_digest ("Digest userhash=\"true\"", NULL, NULL, NULL, NULL, NULL, \ 1110 r += expect_digest ("Digest nc=\"1 \", ", NULL, MHD_DIGEST_AUTH_ALGO3_MD5, \
1091 NULL, NULL, NULL, NULL, NULL, 1); 1111 NULL, NULL, NULL, NULL, NULL, \
1092 r += expect_digest ("Digest userhash=\"\\t\\r\\u\\e\"", NULL, NULL, NULL, \ 1112 NULL, MHD_DIGEST_AUTH_QOP_NONE, NULL, "1 ", 0);
1093 NULL, NULL, NULL, NULL, NULL, NULL, NULL, 1); 1113 r += expect_digest ("Digest nc=\"1;\", ", NULL, MHD_DIGEST_AUTH_ALGO3_MD5, \
1094 r += expect_digest ("Digest userhash=TRUE", NULL, NULL, NULL, NULL, NULL, \ 1114 NULL, NULL, NULL, NULL, NULL, \
1095 NULL, NULL, NULL, NULL, NULL, 1); 1115 NULL, MHD_DIGEST_AUTH_QOP_NONE, NULL, "1;", 0);
1096 r += expect_digest ("Digest userhash=True", NULL, NULL, NULL, NULL, NULL, \ 1116 r += expect_digest ("Digest nc=\"1\\;\", ", NULL, MHD_DIGEST_AUTH_ALGO3_MD5, \
1097 NULL, NULL, NULL, NULL, NULL, 1); 1117 NULL, NULL, NULL, NULL, NULL, \
1098 r += expect_digest ("Digest userhash = true", NULL, NULL, NULL, NULL, \ 1118 NULL, MHD_DIGEST_AUTH_QOP_NONE, NULL, "1\\;", 0);
1099 NULL, NULL, NULL, NULL, NULL, NULL, 1); 1119
1100 r += expect_digest ("Digest userhash=True2", NULL, NULL, NULL, NULL, NULL, \ 1120 r += expect_digest ("Digest userhash=false", NULL, \
1101 NULL, NULL, NULL, NULL, NULL, 0); 1121 MHD_DIGEST_AUTH_ALGO3_MD5, \
1102 r += expect_digest ("Digest userhash=\" true\"", NULL, NULL, NULL, NULL, \ 1122 NULL, NULL, NULL, NULL, NULL, \
1103 NULL, NULL, NULL, NULL, NULL, NULL, 0); 1123 NULL, MHD_DIGEST_AUTH_QOP_NONE, NULL, NULL, 0);
1124 r += expect_digest ("Digest userhash=\"false\"", NULL, \
1125 MHD_DIGEST_AUTH_ALGO3_MD5, \
1126 NULL, NULL, NULL, NULL, NULL, \
1127 NULL, MHD_DIGEST_AUTH_QOP_NONE, NULL, NULL, 0);
1128 r += expect_digest ("Digest userhash=foo", NULL, \
1129 MHD_DIGEST_AUTH_ALGO3_MD5, \
1130 NULL, NULL, NULL, NULL, NULL, \
1131 NULL, MHD_DIGEST_AUTH_QOP_NONE, NULL, NULL, 0);
1132 r += expect_digest ("Digest userhash=true", NULL, \
1133 MHD_DIGEST_AUTH_ALGO3_MD5, \
1134 NULL, NULL, NULL, NULL, NULL, \
1135 NULL, MHD_DIGEST_AUTH_QOP_NONE, NULL, NULL, 1);
1136 r += expect_digest ("Digest userhash=\"true\"", NULL, \
1137 MHD_DIGEST_AUTH_ALGO3_MD5, \
1138 NULL, NULL, NULL, NULL, NULL, \
1139 NULL, MHD_DIGEST_AUTH_QOP_NONE, NULL, NULL, 1);
1140 r += expect_digest ("Digest userhash=\"\\t\\r\\u\\e\"", NULL, \
1141 MHD_DIGEST_AUTH_ALGO3_MD5, \
1142 NULL, NULL, NULL, NULL, NULL, \
1143 NULL, MHD_DIGEST_AUTH_QOP_NONE, NULL, NULL, 1);
1144 r += expect_digest ("Digest userhash=TRUE", NULL, \
1145 MHD_DIGEST_AUTH_ALGO3_MD5, \
1146 NULL, NULL, NULL, NULL, NULL, \
1147 NULL, MHD_DIGEST_AUTH_QOP_NONE, NULL, NULL, 1);
1148 r += expect_digest ("Digest userhash=True", NULL, \
1149 MHD_DIGEST_AUTH_ALGO3_MD5, \
1150 NULL, NULL, NULL, NULL, NULL, \
1151 NULL, MHD_DIGEST_AUTH_QOP_NONE, NULL, NULL, 1);
1152 r += expect_digest ("Digest userhash = true", NULL, \
1153 MHD_DIGEST_AUTH_ALGO3_MD5, \
1154 NULL, NULL, NULL, NULL, NULL, \
1155 NULL, MHD_DIGEST_AUTH_QOP_NONE, NULL, NULL, 1);
1156 r += expect_digest ("Digest userhash=True2", NULL, \
1157 MHD_DIGEST_AUTH_ALGO3_MD5, \
1158 NULL, NULL, NULL, NULL, NULL, \
1159 NULL, MHD_DIGEST_AUTH_QOP_NONE, NULL, NULL, 0);
1160 r += expect_digest ("Digest userhash=\" true\"", NULL, \
1161 MHD_DIGEST_AUTH_ALGO3_MD5, \
1162 NULL, NULL, NULL, NULL, NULL, \
1163 NULL, MHD_DIGEST_AUTH_QOP_NONE, NULL, NULL, 0);
1164
1165 r += expect_digest ("Digest algorithm=MD5", NULL, \
1166 MHD_DIGEST_AUTH_ALGO3_MD5, \
1167 NULL, NULL, NULL, NULL, NULL, \
1168 NULL, MHD_DIGEST_AUTH_QOP_NONE, NULL, NULL, 0);
1169 r += expect_digest ("Digest algorithm=md5", NULL, \
1170 MHD_DIGEST_AUTH_ALGO3_MD5, \
1171 NULL, NULL, NULL, NULL, NULL, \
1172 NULL, MHD_DIGEST_AUTH_QOP_NONE, NULL, NULL, 0);
1173 r += expect_digest ("Digest algorithm=Md5", NULL, \
1174 MHD_DIGEST_AUTH_ALGO3_MD5, \
1175 NULL, NULL, NULL, NULL, NULL, \
1176 NULL, MHD_DIGEST_AUTH_QOP_NONE, NULL, NULL, 0);
1177 r += expect_digest ("Digest algorithm=mD5", NULL, \
1178 MHD_DIGEST_AUTH_ALGO3_MD5, \
1179 NULL, NULL, NULL, NULL, NULL, \
1180 NULL, MHD_DIGEST_AUTH_QOP_NONE, NULL, NULL, 0);
1181 r += expect_digest ("Digest algorithm=\"MD5\"", NULL, \
1182 MHD_DIGEST_AUTH_ALGO3_MD5, \
1183 NULL, NULL, NULL, NULL, NULL, \
1184 NULL, MHD_DIGEST_AUTH_QOP_NONE, NULL, NULL, 0);
1185 r += expect_digest ("Digest algorithm=\"\\M\\D\\5\"", NULL, \
1186 MHD_DIGEST_AUTH_ALGO3_MD5, \
1187 NULL, NULL, NULL, NULL, NULL, \
1188 NULL, MHD_DIGEST_AUTH_QOP_NONE, NULL, NULL, 0);
1189 r += expect_digest ("Digest algorithm=\"\\m\\d\\5\"", NULL, \
1190 MHD_DIGEST_AUTH_ALGO3_MD5, \
1191 NULL, NULL, NULL, NULL, NULL, \
1192 NULL, MHD_DIGEST_AUTH_QOP_NONE, NULL, NULL, 0);
1193 r += expect_digest ("Digest algorithm=SHA-256", NULL, \
1194 MHD_DIGEST_AUTH_ALGO3_SHA256, \
1195 NULL, NULL, NULL, NULL, NULL, \
1196 NULL, MHD_DIGEST_AUTH_QOP_NONE, NULL, NULL, 0);
1197 r += expect_digest ("Digest algorithm=sha-256", NULL, \
1198 MHD_DIGEST_AUTH_ALGO3_SHA256, \
1199 NULL, NULL, NULL, NULL, NULL, \
1200 NULL, MHD_DIGEST_AUTH_QOP_NONE, NULL, NULL, 0);
1201 r += expect_digest ("Digest algorithm=Sha-256", NULL, \
1202 MHD_DIGEST_AUTH_ALGO3_SHA256, \
1203 NULL, NULL, NULL, NULL, NULL, \
1204 NULL, MHD_DIGEST_AUTH_QOP_NONE, NULL, NULL, 0);
1205 r += expect_digest ("Digest algorithm=\"SHA-256\"", NULL, \
1206 MHD_DIGEST_AUTH_ALGO3_SHA256, \
1207 NULL, NULL, NULL, NULL, NULL, \
1208 NULL, MHD_DIGEST_AUTH_QOP_NONE, NULL, NULL, 0);
1209 r += expect_digest ("Digest algorithm=\"SHA\\-25\\6\"", NULL, \
1210 MHD_DIGEST_AUTH_ALGO3_SHA256, \
1211 NULL, NULL, NULL, NULL, NULL, \
1212 NULL, MHD_DIGEST_AUTH_QOP_NONE, NULL, NULL, 0);
1213 r += expect_digest ("Digest algorithm=\"shA-256\"", NULL, \
1214 MHD_DIGEST_AUTH_ALGO3_SHA256, \
1215 NULL, NULL, NULL, NULL, NULL, \
1216 NULL, MHD_DIGEST_AUTH_QOP_NONE, NULL, NULL, 0);
1217 r += expect_digest ("Digest algorithm=MD5-sess", NULL, \
1218 MHD_DIGEST_AUTH_ALGO3_MD5_SESSION, \
1219 NULL, NULL, NULL, NULL, NULL, \
1220 NULL, MHD_DIGEST_AUTH_QOP_NONE, NULL, NULL, 0);
1221 r += expect_digest ("Digest algorithm=MD5-SESS", NULL, \
1222 MHD_DIGEST_AUTH_ALGO3_MD5_SESSION, \
1223 NULL, NULL, NULL, NULL, NULL, \
1224 NULL, MHD_DIGEST_AUTH_QOP_NONE, NULL, NULL, 0);
1225 r += expect_digest ("Digest algorithm=md5-Sess", NULL, \
1226 MHD_DIGEST_AUTH_ALGO3_MD5_SESSION, \
1227 NULL, NULL, NULL, NULL, NULL, \
1228 NULL, MHD_DIGEST_AUTH_QOP_NONE, NULL, NULL, 0);
1229 r += expect_digest ("Digest algorithm=SHA-256-seSS", NULL, \
1230 MHD_DIGEST_AUTH_ALGO3_SHA256_SESSION, \
1231 NULL, NULL, NULL, NULL, NULL, \
1232 NULL, MHD_DIGEST_AUTH_QOP_NONE, NULL, NULL, 0);
1233 r += expect_digest ("Digest algorithm=SHA-512-256", NULL, \
1234 MHD_DIGEST_AUTH_ALGO3_SHA512_256, \
1235 NULL, NULL, NULL, NULL, NULL, \
1236 NULL, MHD_DIGEST_AUTH_QOP_NONE, NULL, NULL, 0);
1237 r += expect_digest ("Digest algorithm=SHA-512-256-sess", NULL, \
1238 MHD_DIGEST_AUTH_ALGO3_SHA512_256_SESSION, \
1239 NULL, NULL, NULL, NULL, NULL, \
1240 NULL, MHD_DIGEST_AUTH_QOP_NONE, NULL, NULL, 0);
1241 r += expect_digest ("Digest algorithm=MD5-2", NULL, \
1242 MHD_DIGEST_AUTH_ALGO3_INVALID, \
1243 NULL, NULL, NULL, NULL, NULL, \
1244 NULL, MHD_DIGEST_AUTH_QOP_NONE, NULL, NULL, 0);
1245 r += expect_digest ("Digest algorithm=MD5-sess2", NULL, \
1246 MHD_DIGEST_AUTH_ALGO3_INVALID, \
1247 NULL, NULL, NULL, NULL, NULL, \
1248 NULL, MHD_DIGEST_AUTH_QOP_NONE, NULL, NULL, 0);
1249 r += expect_digest ("Digest algorithm=SHA-256-512", NULL, \
1250 MHD_DIGEST_AUTH_ALGO3_INVALID, \
1251 NULL, NULL, NULL, NULL, NULL, \
1252 NULL, MHD_DIGEST_AUTH_QOP_NONE, NULL, NULL, 0);
1253 r += expect_digest ("Digest algorithm=", NULL, \
1254 MHD_DIGEST_AUTH_ALGO3_INVALID, \
1255 NULL, NULL, NULL, NULL, NULL, \
1256 NULL, MHD_DIGEST_AUTH_QOP_NONE, NULL, NULL, 0);
1257
1258 r += expect_digest ("Digest qop=auth", NULL, \
1259 MHD_DIGEST_AUTH_ALGO3_MD5, \
1260 NULL, NULL, NULL, NULL, NULL, \
1261 "auth", MHD_DIGEST_AUTH_QOP_AUTH, NULL, NULL, 0);
1262 r += expect_digest ("Digest qop=\"auth\"", NULL, \
1263 MHD_DIGEST_AUTH_ALGO3_MD5, \
1264 NULL, NULL, NULL, NULL, NULL, \
1265 "auth", MHD_DIGEST_AUTH_QOP_AUTH, NULL, NULL, 0);
1266 r += expect_digest ("Digest qop=Auth", NULL, \
1267 MHD_DIGEST_AUTH_ALGO3_MD5, \
1268 NULL, NULL, NULL, NULL, NULL, \
1269 "Auth", MHD_DIGEST_AUTH_QOP_AUTH, NULL, NULL, 0);
1270 r += expect_digest ("Digest qop=AUTH", NULL, \
1271 MHD_DIGEST_AUTH_ALGO3_MD5, \
1272 NULL, NULL, NULL, NULL, NULL, \
1273 "AUTH", MHD_DIGEST_AUTH_QOP_AUTH, NULL, NULL, 0);
1274 r += expect_digest ("Digest qop=\"\\A\\ut\\H\"", NULL, \
1275 MHD_DIGEST_AUTH_ALGO3_MD5, \
1276 NULL, NULL, NULL, NULL, NULL, \
1277 "\\A\\ut\\H", MHD_DIGEST_AUTH_QOP_AUTH, NULL, NULL, 0);
1278 r += expect_digest ("Digest qop=\"auth \"", NULL, \
1279 MHD_DIGEST_AUTH_ALGO3_MD5, \
1280 NULL, NULL, NULL, NULL, NULL, \
1281 "auth ", MHD_DIGEST_AUTH_QOP_INVALID, NULL, NULL, 0);
1282 r += expect_digest ("Digest qop=auth-int", NULL, \
1283 MHD_DIGEST_AUTH_ALGO3_MD5, \
1284 NULL, NULL, NULL, NULL, NULL, \
1285 "auth-int", MHD_DIGEST_AUTH_QOP_AUTH_INT, NULL, NULL, 0);
1286 r += expect_digest ("Digest qop=\"auth-int\"", NULL, \
1287 MHD_DIGEST_AUTH_ALGO3_MD5, \
1288 NULL, NULL, NULL, NULL, NULL, \
1289 "auth-int", MHD_DIGEST_AUTH_QOP_AUTH_INT, NULL, NULL, 0);
1290 r += expect_digest ("Digest qop=\"auTh-iNt\"", NULL, \
1291 MHD_DIGEST_AUTH_ALGO3_MD5, \
1292 NULL, NULL, NULL, NULL, NULL, \
1293 "auTh-iNt", MHD_DIGEST_AUTH_QOP_AUTH_INT, NULL, NULL, 0);
1294 r += expect_digest ("Digest qop=\"auTh-iNt2\"", NULL, \
1295 MHD_DIGEST_AUTH_ALGO3_MD5, \
1296 NULL, NULL, NULL, NULL, NULL, \
1297 "auTh-iNt2", MHD_DIGEST_AUTH_QOP_INVALID, NULL, NULL, 0);
1104 1298
1105 r += expect_digest ("Digest username=\"test@example.com\", " \ 1299 r += expect_digest ("Digest username=\"test@example.com\", " \
1106 "realm=\"users@example.com\", nonce=\"32141232413abcde\", " \ 1300 "realm=\"users@example.com\", " \
1107 "uri=\"/example\", qop=auth, nc=00000001, cnonce=\"0a4f113b\", " \ 1301 "nonce=\"32141232413abcde\", " \
1302 "uri=\"/example\", qop=auth, nc=00000001, " \
1303 "cnonce=\"0a4f113b\", " \
1108 "response=\"6629fae49393a05397450978507c4ef1\", " \ 1304 "response=\"6629fae49393a05397450978507c4ef1\", " \
1109 "opaque=\"sadfljk32sdaf\"", "32141232413abcde", NULL, \ 1305 "opaque=\"sadfljk32sdaf\"", "32141232413abcde", \
1306 MHD_DIGEST_AUTH_ALGO3_MD5, \
1110 "6629fae49393a05397450978507c4ef1", "test@example.com", \ 1307 "6629fae49393a05397450978507c4ef1", "test@example.com", \
1111 NULL, "users@example.com", "/example", "auth", \ 1308 NULL, "users@example.com", "/example", \
1309 "auth", MHD_DIGEST_AUTH_QOP_AUTH, \
1112 "0a4f113b", "00000001", 0); 1310 "0a4f113b", "00000001", 0);
1113 r += expect_digest ("Digest username=\"test@example.com\", " \ 1311 r += expect_digest ("Digest username=\"test@example.com\", " \
1114 "realm=\"users@example.com\", algorithm=SHA-256, " \ 1312 "realm=\"users@example.com\", algorithm=SHA-256, " \
1115 "nonce=\"32141232413abcde\", " \ 1313 "nonce=\"32141232413abcde\", " \
1116 "username*=UTF-8''%c2%a3%20and%20%e2%82%ac%20rates, " \ 1314 "username*=UTF-8''%c2%a3%20and%20%e2%82%ac%20rates, " \
1117 "uri=\"/example\", qop=auth, nc=00000001, cnonce=\"0a4f113b\", " \ 1315 "uri=\"/example\", qop=auth, nc=00000001, " \
1316 "cnonce=\"0a4f113b\", " \
1118 "response=\"6629fae49393a05397450978507c4ef1\", " \ 1317 "response=\"6629fae49393a05397450978507c4ef1\", " \
1119 "opaque=\"sadfljk32sdaf\"", "32141232413abcde", "SHA-256", \ 1318 "opaque=\"sadfljk32sdaf\"", "32141232413abcde", \
1319 MHD_DIGEST_AUTH_ALGO3_SHA256, \
1120 "6629fae49393a05397450978507c4ef1", "test@example.com", \ 1320 "6629fae49393a05397450978507c4ef1", "test@example.com", \
1121 "UTF-8''%c2%a3%20and%20%e2%82%ac%20rates", \ 1321 "UTF-8''%c2%a3%20and%20%e2%82%ac%20rates", \
1122 "users@example.com", "/example", "auth", "0a4f113b", \ 1322 "users@example.com", "/example", \
1323 "auth", MHD_DIGEST_AUTH_QOP_AUTH, "0a4f113b", \
1123 "00000001", 0); 1324 "00000001", 0);
1124 r += expect_digest ("Digest username=test@example.com, " \ 1325 r += expect_digest ("Digest username=test@example.com, " \
1125 "realm=users@example.com, algorithm=\"SHA-256\", " \ 1326 "realm=users@example.com, algorithm=\"SHA-256-sess\", " \
1126 "nonce=32141232413abcde, " \ 1327 "nonce=32141232413abcde, " \
1127 "username*=UTF-8''%c2%a3%20and%20%e2%82%ac%20rates, " \ 1328 "username*=UTF-8''%c2%a3%20and%20%e2%82%ac%20rates, " \
1128 "uri=/example, qop=\"auth\", nc=\"00000001\", cnonce=0a4f113b, " \ 1329 "uri=/example, qop=\"auth\", nc=\"00000001\", " \
1330 "cnonce=0a4f113b, " \
1129 "response=6629fae49393a05397450978507c4ef1, " \ 1331 "response=6629fae49393a05397450978507c4ef1, " \
1130 "opaque=sadfljk32sdaf", "32141232413abcde", "SHA-256", \ 1332 "opaque=sadfljk32sdaf", "32141232413abcde", \
1333 MHD_DIGEST_AUTH_ALGO3_SHA256_SESSION, \
1131 "6629fae49393a05397450978507c4ef1", "test@example.com", \ 1334 "6629fae49393a05397450978507c4ef1", "test@example.com", \
1132 "UTF-8''%c2%a3%20and%20%e2%82%ac%20rates", \ 1335 "UTF-8''%c2%a3%20and%20%e2%82%ac%20rates", \
1133 "users@example.com", "/example", "auth", "0a4f113b", \ 1336 "users@example.com", "/example", \
1337 "auth", MHD_DIGEST_AUTH_QOP_AUTH, "0a4f113b", \
1134 "00000001", 0); 1338 "00000001", 0);
1135 r += expect_digest ("Digest username = \"test@example.com\", " \ 1339 r += expect_digest ("Digest username = \"test@example.com\", " \
1136 "realm\t=\t\"users@example.com\", algorithm\t= SHA-256, " \ 1340 "realm\t=\t\"users@example.com\", algorithm\t= SHA-256, " \
@@ -1140,21 +1344,25 @@ check_digest (void)
1140 "cnonce\t\t\t= \"0a4f113b\", " \ 1344 "cnonce\t\t\t= \"0a4f113b\", " \
1141 "response =\"6629fae49393a05397450978507c4ef1\", " \ 1345 "response =\"6629fae49393a05397450978507c4ef1\", " \
1142 "opaque=\t\t\"sadfljk32sdaf\"", "32141232413abcde", \ 1346 "opaque=\t\t\"sadfljk32sdaf\"", "32141232413abcde", \
1143 "SHA-256", \ 1347 MHD_DIGEST_AUTH_ALGO3_SHA256, \
1144 "6629fae49393a05397450978507c4ef1", "test@example.com", \ 1348 "6629fae49393a05397450978507c4ef1", "test@example.com", \
1145 "UTF-8''%c2%a3%20and%20%e2%82%ac%20rates", \ 1349 "UTF-8''%c2%a3%20and%20%e2%82%ac%20rates", \
1146 "users@example.com", "/example", "auth", "0a4f113b", \ 1350 "users@example.com", "/example", \
1351 "auth", MHD_DIGEST_AUTH_QOP_AUTH, "0a4f113b", \
1147 "00000001", 0); 1352 "00000001", 0);
1148 r += expect_digest ("Digest username=\"test@example.com\"," \ 1353 r += expect_digest ("Digest username=\"test@example.com\"," \
1149 "realm=\"users@example.com\",algorithm=SHA-256," \ 1354 "realm=\"users@example.com\",algorithm=SHA-512-256," \
1150 "nonce=\"32141232413abcde\"," \ 1355 "nonce=\"32141232413abcde\"," \
1151 "username*=UTF-8''%c2%a3%20and%20%e2%82%ac%20rates," \ 1356 "username*=UTF-8''%c2%a3%20and%20%e2%82%ac%20rates," \
1152 "uri=\"/example\",qop=auth,nc=00000001,cnonce=\"0a4f113b\"," \ 1357 "uri=\"/example\",qop=auth,nc=00000001," \
1358 "cnonce=\"0a4f113b\"," \
1153 "response=\"6629fae49393a05397450978507c4ef1\"," \ 1359 "response=\"6629fae49393a05397450978507c4ef1\"," \
1154 "opaque=\"sadfljk32sdaf\"", "32141232413abcde", "SHA-256", \ 1360 "opaque=\"sadfljk32sdaf\"", "32141232413abcde", \
1361 MHD_DIGEST_AUTH_ALGO3_SHA512_256, \
1155 "6629fae49393a05397450978507c4ef1", "test@example.com", \ 1362 "6629fae49393a05397450978507c4ef1", "test@example.com", \
1156 "UTF-8''%c2%a3%20and%20%e2%82%ac%20rates", \ 1363 "UTF-8''%c2%a3%20and%20%e2%82%ac%20rates", \
1157 "users@example.com", "/example", "auth", "0a4f113b", \ 1364 "users@example.com", "/example", \
1365 "auth", MHD_DIGEST_AUTH_QOP_AUTH, "0a4f113b", \
1158 "00000001", 0); 1366 "00000001", 0);
1159 r += expect_digest ("Digest username=\"test@example.com\"," \ 1367 r += expect_digest ("Digest username=\"test@example.com\"," \
1160 "realm=\"users@example.com\",algorithm=SHA-256," \ 1368 "realm=\"users@example.com\",algorithm=SHA-256," \
@@ -1162,107 +1370,128 @@ check_digest (void)
1162 "username*=UTF-8''%c2%a3%20and%20%e2%82%ac%20rates," \ 1370 "username*=UTF-8''%c2%a3%20and%20%e2%82%ac%20rates," \
1163 "uri=\"/example\",qop=auth,nc=00000001,cnonce=\"0a4f113b\"," \ 1371 "uri=\"/example\",qop=auth,nc=00000001,cnonce=\"0a4f113b\"," \
1164 "response=\"6629fae49393a05397450978507c4ef1\"," \ 1372 "response=\"6629fae49393a05397450978507c4ef1\"," \
1165 "opaque=\"sadfljk32sdaf\"", "32141232413abcde", "SHA-256", \ 1373 "opaque=\"sadfljk32sdaf\"", "32141232413abcde", \
1374 MHD_DIGEST_AUTH_ALGO3_SHA256, \
1166 "6629fae49393a05397450978507c4ef1", "test@example.com", \ 1375 "6629fae49393a05397450978507c4ef1", "test@example.com", \
1167 "UTF-8''%c2%a3%20and%20%e2%82%ac%20rates", \ 1376 "UTF-8''%c2%a3%20and%20%e2%82%ac%20rates", \
1168 "users@example.com", "/example", "auth", "0a4f113b", \ 1377 "users@example.com", "/example", \
1378 "auth", MHD_DIGEST_AUTH_QOP_AUTH, "0a4f113b", \
1169 "00000001", 0); 1379 "00000001", 0);
1170 r += expect_digest ("Digest abc=zyx, username=\"test@example.com\", " \ 1380 r += expect_digest ("Digest abc=zyx, username=\"test@example.com\", " \
1171 "realm=\"users@example.com\", algorithm=SHA-256, " \ 1381 "realm=\"users@example.com\", algorithm=SHA-256, " \
1172 "nonce=\"32141232413abcde\", " \ 1382 "nonce=\"32141232413abcde\", " \
1173 "username*=UTF-8''%c2%a3%20and%20%e2%82%ac%20rates, " \ 1383 "username*=UTF-8''%c2%a3%20and%20%e2%82%ac%20rates, " \
1174 "uri=\"/example\", qop=auth, nc=00000001, cnonce=\"0a4f113b\", " \ 1384 "uri=\"/example\", qop=auth, nc=00000001, " \
1385 "cnonce=\"0a4f113b\", " \
1175 "response=\"6629fae49393a05397450978507c4ef1\", " \ 1386 "response=\"6629fae49393a05397450978507c4ef1\", " \
1176 "opaque=\"sadfljk32sdaf\"", "32141232413abcde", "SHA-256", \ 1387 "opaque=\"sadfljk32sdaf\"", "32141232413abcde", \
1388 MHD_DIGEST_AUTH_ALGO3_SHA256, \
1177 "6629fae49393a05397450978507c4ef1", "test@example.com", \ 1389 "6629fae49393a05397450978507c4ef1", "test@example.com", \
1178 "UTF-8''%c2%a3%20and%20%e2%82%ac%20rates", \ 1390 "UTF-8''%c2%a3%20and%20%e2%82%ac%20rates", \
1179 "users@example.com", "/example", "auth", "0a4f113b", \ 1391 "users@example.com", "/example", \
1392 "auth", MHD_DIGEST_AUTH_QOP_AUTH, "0a4f113b", \
1180 "00000001", 0); 1393 "00000001", 0);
1181 r += expect_digest ("Digest abc=zyx,,,,,,,username=\"test@example.com\", " \ 1394 r += expect_digest ("Digest abc=zyx,,,,,,,username=\"test@example.com\", " \
1182 "realm=\"users@example.com\", algorithm=SHA-256, " \ 1395 "realm=\"users@example.com\", algorithm=SHA-256, " \
1183 "nonce=\"32141232413abcde\", " \ 1396 "nonce=\"32141232413abcde\", " \
1184 "username*=UTF-8''%c2%a3%20and%20%e2%82%ac%20rates, " \ 1397 "username*=UTF-8''%c2%a3%20and%20%e2%82%ac%20rates, " \
1185 "uri=\"/example\", qop=auth, nc=00000001, cnonce=\"0a4f113b\", " \ 1398 "uri=\"/example\", qop=auth, nc=00000001, " \
1399 "cnonce=\"0a4f113b\", " \
1186 "response=\"6629fae49393a05397450978507c4ef1\", " \ 1400 "response=\"6629fae49393a05397450978507c4ef1\", " \
1187 "opaque=\"sadfljk32sdaf\"", "32141232413abcde", "SHA-256", \ 1401 "opaque=\"sadfljk32sdaf\"", "32141232413abcde",
1402 MHD_DIGEST_AUTH_ALGO3_SHA256, \
1188 "6629fae49393a05397450978507c4ef1", "test@example.com", \ 1403 "6629fae49393a05397450978507c4ef1", "test@example.com", \
1189 "UTF-8''%c2%a3%20and%20%e2%82%ac%20rates", \ 1404 "UTF-8''%c2%a3%20and%20%e2%82%ac%20rates", \
1190 "users@example.com", "/example", "auth", "0a4f113b", \ 1405 "users@example.com", "/example", \
1406 "auth", MHD_DIGEST_AUTH_QOP_AUTH, "0a4f113b", \
1191 "00000001", 0); 1407 "00000001", 0);
1192 r += expect_digest ("Digest abc=zyx,,,,,,,username=\"test@example.com\", " \ 1408 r += expect_digest ("Digest abc=zyx,,,,,,,username=\"test@example.com\", " \
1193 "realm=\"users@example.com\", algorithm=SHA-256, " \ 1409 "realm=\"users@example.com\", algorithm=SHA-256, " \
1194 "nonce=\"32141232413abcde\", " \ 1410 "nonce=\"32141232413abcde\", " \
1195 "username*=UTF-8''%c2%a3%20and%20%e2%82%ac%20rates, " \ 1411 "username*=UTF-8''%c2%a3%20and%20%e2%82%ac%20rates, " \
1196 "uri=\"/example\", qop=auth, nc=00000001, cnonce=\"0a4f113b\", " \ 1412 "uri=\"/example\", qop=auth, nc=00000001, "
1413 "cnonce=\"0a4f113b\", " \
1197 "response=\"6629fae49393a05397450978507c4ef1\", " \ 1414 "response=\"6629fae49393a05397450978507c4ef1\", " \
1198 "opaque=\"sadfljk32sdaf\",,,,,", "32141232413abcde", \ 1415 "opaque=\"sadfljk32sdaf\",,,,,", "32141232413abcde", \
1199 "SHA-256", \ 1416 MHD_DIGEST_AUTH_ALGO3_SHA256, \
1200 "6629fae49393a05397450978507c4ef1", "test@example.com", \ 1417 "6629fae49393a05397450978507c4ef1", "test@example.com", \
1201 "UTF-8''%c2%a3%20and%20%e2%82%ac%20rates", \ 1418 "UTF-8''%c2%a3%20and%20%e2%82%ac%20rates", \
1202 "users@example.com", "/example", "auth", "0a4f113b", \ 1419 "users@example.com", "/example", \
1420 "auth", MHD_DIGEST_AUTH_QOP_AUTH, "0a4f113b", \
1203 "00000001", 0); 1421 "00000001", 0);
1204 r += expect_digest ("Digest abc=zyx,,,,,,,username=\"test@example.com\", " \ 1422 r += expect_digest ("Digest abc=zyx,,,,,,,username=\"test@example.com\", " \
1205 "realm=\"users@example.com\", algorithm=SHA-256, " \ 1423 "realm=\"users@example.com\", algorithm=SHA-256, " \
1206 "nonce=\"32141232413abcde\", " \ 1424 "nonce=\"32141232413abcde\", " \
1207 "username*=UTF-8''%c2%a3%20and%20%e2%82%ac%20rates, " \ 1425 "username*=UTF-8''%c2%a3%20and%20%e2%82%ac%20rates, " \
1208 "uri=\"/example\", qop=auth, nc=00000001, cnonce=\"0a4f113b\", " \ 1426 "uri=\"/example\", qop=auth, nc=00000001, " \
1427 "cnonce=\"0a4f113b\", " \
1209 "response=\"6629fae49393a05397450978507c4ef1\", " \ 1428 "response=\"6629fae49393a05397450978507c4ef1\", " \
1210 "opaque=\"sadfljk32sdaf\",foo=bar", "32141232413abcde", \ 1429 "opaque=\"sadfljk32sdaf\",foo=bar", "32141232413abcde", \
1211 "SHA-256", \ 1430 MHD_DIGEST_AUTH_ALGO3_SHA256, \
1212 "6629fae49393a05397450978507c4ef1", "test@example.com", \ 1431 "6629fae49393a05397450978507c4ef1", "test@example.com", \
1213 "UTF-8''%c2%a3%20and%20%e2%82%ac%20rates", \ 1432 "UTF-8''%c2%a3%20and%20%e2%82%ac%20rates", \
1214 "users@example.com", "/example", "auth", "0a4f113b", \ 1433 "users@example.com", "/example", \
1434 "auth", MHD_DIGEST_AUTH_QOP_AUTH, "0a4f113b", \
1215 "00000001", 0); 1435 "00000001", 0);
1216 r += expect_digest ("Digest abc=\"zyx\", username=\"test@example.com\", " \ 1436 r += expect_digest ("Digest abc=\"zyx\", username=\"test@example.com\", " \
1217 "realm=\"users@example.com\", algorithm=SHA-256, " \ 1437 "realm=\"users@example.com\", algorithm=SHA-256, " \
1218 "nonce=\"32141232413abcde\", " \ 1438 "nonce=\"32141232413abcde\", " \
1219 "username*=UTF-8''%c2%a3%20and%20%e2%82%ac%20rates, " \ 1439 "username*=UTF-8''%c2%a3%20and%20%e2%82%ac%20rates, " \
1220 "uri=\"/example\", qop=auth, nc=00000001, cnonce=\"0a4f113b\", " \ 1440 "uri=\"/example\", qop=auth, nc=00000001, "
1441 "cnonce=\"0a4f113b\", " \
1221 "response=\"6629fae49393a05397450978507c4ef1\", " \ 1442 "response=\"6629fae49393a05397450978507c4ef1\", " \
1222 "opaque=\"sadfljk32sdaf\",foo=bar", "32141232413abcde", \ 1443 "opaque=\"sadfljk32sdaf\",foo=bar", "32141232413abcde", \
1223 "SHA-256", \ 1444 MHD_DIGEST_AUTH_ALGO3_SHA256, \
1224 "6629fae49393a05397450978507c4ef1", "test@example.com", \ 1445 "6629fae49393a05397450978507c4ef1", "test@example.com", \
1225 "UTF-8''%c2%a3%20and%20%e2%82%ac%20rates", \ 1446 "UTF-8''%c2%a3%20and%20%e2%82%ac%20rates", \
1226 "users@example.com", "/example", "auth", "0a4f113b", \ 1447 "users@example.com", "/example", \
1448 "auth", MHD_DIGEST_AUTH_QOP_AUTH, "0a4f113b", \
1227 "00000001", 0); 1449 "00000001", 0);
1228 r += expect_digest ("Digest abc=\"zyx, abc\", " \ 1450 r += expect_digest ("Digest abc=\"zyx, abc\", " \
1229 "username=\"test@example.com\", " \ 1451 "username=\"test@example.com\", " \
1230 "realm=\"users@example.com\", algorithm=SHA-256, " \ 1452 "realm=\"users@example.com\", algorithm=SHA-256, " \
1231 "nonce=\"32141232413abcde\", " \ 1453 "nonce=\"32141232413abcde\", " \
1232 "username*=UTF-8''%c2%a3%20and%20%e2%82%ac%20rates, " \ 1454 "username*=UTF-8''%c2%a3%20and%20%e2%82%ac%20rates, " \
1233 "uri=\"/example\", qop=auth, nc=00000001, cnonce=\"0a4f113b\", " \ 1455 "uri=\"/example\", qop=auth, nc=00000001, "
1456 "cnonce=\"0a4f113b\", " \
1234 "response=\"6629fae49393a05397450978507c4ef1\", " \ 1457 "response=\"6629fae49393a05397450978507c4ef1\", " \
1235 "opaque=\"sadfljk32sdaf\",foo=bar", "32141232413abcde", \ 1458 "opaque=\"sadfljk32sdaf\",foo=bar", "32141232413abcde", \
1236 "SHA-256", \ 1459 MHD_DIGEST_AUTH_ALGO3_SHA256, \
1237 "6629fae49393a05397450978507c4ef1", "test@example.com", \ 1460 "6629fae49393a05397450978507c4ef1", "test@example.com", \
1238 "UTF-8''%c2%a3%20and%20%e2%82%ac%20rates", \ 1461 "UTF-8''%c2%a3%20and%20%e2%82%ac%20rates", \
1239 "users@example.com", "/example", "auth", "0a4f113b", \ 1462 "users@example.com", "/example", \
1463 "auth", MHD_DIGEST_AUTH_QOP_AUTH, "0a4f113b", \
1240 "00000001", 0); 1464 "00000001", 0);
1241 r += expect_digest ("Digest abc=\"zyx, abc=cde\", " \ 1465 r += expect_digest ("Digest abc=\"zyx, abc=cde\", " \
1242 "username=\"test@example.com\", " \ 1466 "username=\"test@example.com\", " \
1243 "realm=\"users@example.com\", algorithm=SHA-256, " \ 1467 "realm=\"users@example.com\", algorithm=SHA-256, " \
1244 "nonce=\"32141232413abcde\", " \ 1468 "nonce=\"32141232413abcde\", " \
1245 "username*=UTF-8''%c2%a3%20and%20%e2%82%ac%20rates, " \ 1469 "username*=UTF-8''%c2%a3%20and%20%e2%82%ac%20rates, " \
1246 "uri=\"/example\", qop=auth, nc=00000001, cnonce=\"0a4f113b\", " \ 1470 "uri=\"/example\", qop=auth, nc=00000001, " \
1471 "cnonce=\"0a4f113b\", " \
1247 "response=\"6629fae49393a05397450978507c4ef1\", " \ 1472 "response=\"6629fae49393a05397450978507c4ef1\", " \
1248 "opaque=\"sadfljk32sdaf\",foo=bar", "32141232413abcde", \ 1473 "opaque=\"sadfljk32sdaf\",foo=bar", "32141232413abcde", \
1249 "SHA-256", \ 1474 MHD_DIGEST_AUTH_ALGO3_SHA256, \
1250 "6629fae49393a05397450978507c4ef1", "test@example.com", \ 1475 "6629fae49393a05397450978507c4ef1", "test@example.com", \
1251 "UTF-8''%c2%a3%20and%20%e2%82%ac%20rates", \ 1476 "UTF-8''%c2%a3%20and%20%e2%82%ac%20rates", \
1252 "users@example.com", "/example", "auth", "0a4f113b", \ 1477 "users@example.com", "/example", \
1478 "auth", MHD_DIGEST_AUTH_QOP_AUTH, "0a4f113b", \
1253 "00000001", 0); 1479 "00000001", 0);
1254 r += expect_digest ("Digest abc=\"zyx, abc=cde\", " \ 1480 r += expect_digest ("Digest abc=\"zyx, abc=cde\", " \
1255 "username=\"test@example.com\", " \ 1481 "username=\"test@example.com\", " \
1256 "realm=\"users@example.com\", algorithm=SHA-256, " \ 1482 "realm=\"users@example.com\", algorithm=SHA-256, " \
1257 "nonce=\"32141232413abcde\", " \ 1483 "nonce=\"32141232413abcde\", " \
1258 "username*=UTF-8''%c2%a3%20and%20%e2%82%ac%20rates, " \ 1484 "username*=UTF-8''%c2%a3%20and%20%e2%82%ac%20rates, " \
1259 "uri=\"/example\", qop=auth, nc=00000001, cnonce=\"0a4f113b\", " \ 1485 "uri=\"/example\", qop=auth, nc=00000001, " \
1486 "cnonce=\"0a4f113b\", " \
1260 "response=\"6629fae49393a05397450978507c4ef1\", " \ 1487 "response=\"6629fae49393a05397450978507c4ef1\", " \
1261 "opaque=\"sadfljk32sdaf\", foo=\"bar1, bar2\"", \ 1488 "opaque=\"sadfljk32sdaf\", foo=\"bar1, bar2\"", \
1262 "32141232413abcde", "SHA-256", \ 1489 "32141232413abcde", \
1490 MHD_DIGEST_AUTH_ALGO3_SHA256, \
1263 "6629fae49393a05397450978507c4ef1", "test@example.com", \ 1491 "6629fae49393a05397450978507c4ef1", "test@example.com", \
1264 "UTF-8''%c2%a3%20and%20%e2%82%ac%20rates", \ 1492 "UTF-8''%c2%a3%20and%20%e2%82%ac%20rates", \
1265 "users@example.com", "/example", "auth", "0a4f113b", \ 1493 "users@example.com", "/example", \
1494 "auth", MHD_DIGEST_AUTH_QOP_AUTH, "0a4f113b", \
1266 "00000001", 0); 1495 "00000001", 0);
1267 r += expect_digest ("Digest abc=\"zyx, \\\\\"abc=cde\\\\\"\", " \ 1496 r += expect_digest ("Digest abc=\"zyx, \\\\\"abc=cde\\\\\"\", " \
1268 "username=\"test@example.com\", " \ 1497 "username=\"test@example.com\", " \
@@ -1272,23 +1501,28 @@ check_digest (void)
1272 "uri=\"/example\", qop=auth, nc=00000001, cnonce=\"0a4f113b\", " \ 1501 "uri=\"/example\", qop=auth, nc=00000001, cnonce=\"0a4f113b\", " \
1273 "response=\"6629fae49393a05397450978507c4ef1\", " \ 1502 "response=\"6629fae49393a05397450978507c4ef1\", " \
1274 "opaque=\"sadfljk32sdaf\", foo=\"bar1, bar2\"", \ 1503 "opaque=\"sadfljk32sdaf\", foo=\"bar1, bar2\"", \
1275 "32141232413abcde", "SHA-256", \ 1504 "32141232413abcde",
1505 MHD_DIGEST_AUTH_ALGO3_SHA256, \
1276 "6629fae49393a05397450978507c4ef1", "test@example.com", \ 1506 "6629fae49393a05397450978507c4ef1", "test@example.com", \
1277 "UTF-8''%c2%a3%20and%20%e2%82%ac%20rates", \ 1507 "UTF-8''%c2%a3%20and%20%e2%82%ac%20rates", \
1278 "users@example.com", "/example", "auth", "0a4f113b", \ 1508 "users@example.com", "/example", \
1509 "auth", MHD_DIGEST_AUTH_QOP_AUTH, "0a4f113b", \
1279 "00000001", 0); 1510 "00000001", 0);
1280 r += expect_digest ("Digest abc=\"zyx, \\\\\"abc=cde\\\\\"\", " \ 1511 r += expect_digest ("Digest abc=\"zyx, \\\\\"abc=cde\\\\\"\", " \
1281 "username=\"test@example.com\", " \ 1512 "username=\"test@example.com\", " \
1282 "realm=\"users@example.com\", algorithm=SHA-256, " \ 1513 "realm=\"users@example.com\", algorithm=SHA-256, " \
1283 "nonce=\"32141232413abcde\", " \ 1514 "nonce=\"32141232413abcde\", " \
1284 "username*=UTF-8''%c2%a3%20and%20%e2%82%ac%20rates, " \ 1515 "username*=UTF-8''%c2%a3%20and%20%e2%82%ac%20rates, " \
1285 "uri=\"/example\", qop=auth, nc=00000001, cnonce=\"0a4f113b\", " \ 1516 "uri=\"/example\", qop=auth, nc=00000001, "
1517 "cnonce=\"0a4f113b\", " \
1286 "response=\"6629fae49393a05397450978507c4ef1\", " \ 1518 "response=\"6629fae49393a05397450978507c4ef1\", " \
1287 "opaque=\"sadfljk32sdaf\", foo=\",nc=02\"", 1519 "opaque=\"sadfljk32sdaf\", foo=\",nc=02\"",
1288 "32141232413abcde", "SHA-256", \ 1520 "32141232413abcde", \
1521 MHD_DIGEST_AUTH_ALGO3_SHA256, \
1289 "6629fae49393a05397450978507c4ef1", "test@example.com", \ 1522 "6629fae49393a05397450978507c4ef1", "test@example.com", \
1290 "UTF-8''%c2%a3%20and%20%e2%82%ac%20rates", \ 1523 "UTF-8''%c2%a3%20and%20%e2%82%ac%20rates", \
1291 "users@example.com", "/example", "auth", "0a4f113b", \ 1524 "users@example.com", "/example", \
1525 "auth", MHD_DIGEST_AUTH_QOP_AUTH, "0a4f113b", \
1292 "00000001", 0); 1526 "00000001", 0);
1293 1527
1294 return r; 1528 return r;