aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEvgeny Grin (Karlson2k) <k2k@narod.ru>2022-05-15 15:46:28 +0300
committerEvgeny Grin (Karlson2k) <k2k@narod.ru>2022-05-15 16:02:37 +0300
commit8643dc6bb903f605520543d15fe9bab05c006910 (patch)
tree491882d2dd6080c5544f35d9b2aed350c7496133
parentc4b0c4bc95d328f66a0c86544fc2a3b4100fb4d0 (diff)
downloadlibmicrohttpd-8643dc6bb903f605520543d15fe9bab05c006910.tar.gz
libmicrohttpd-8643dc6bb903f605520543d15fe9bab05c006910.zip
test_parse_cookies: updated to better match RFC 6265
The equal sign ('=') is allowed in cookie value.
-rw-r--r--src/testcurl/test_parse_cookies.c24
1 files changed, 13 insertions, 11 deletions
diff --git a/src/testcurl/test_parse_cookies.c b/src/testcurl/test_parse_cookies.c
index d124b3a9..af86f14f 100644
--- a/src/testcurl/test_parse_cookies.c
+++ b/src/testcurl/test_parse_cookies.c
@@ -113,6 +113,12 @@ ahc_echo (void *cls,
113 fprintf (stderr, "'name4' cookie decoded incorrectly.\n"); 113 fprintf (stderr, "'name4' cookie decoded incorrectly.\n");
114 exit (11); 114 exit (11);
115 } 115 }
116 hdr = MHD_lookup_connection_value (connection, MHD_COOKIE_KIND, "name5");
117 if ((hdr == NULL) || (0 != strcmp (hdr, "var_with_=_char")))
118 {
119 fprintf (stderr, "'name5' cookie decoded incorrectly.\n");
120 exit (11);
121 }
116 if (4 != MHD_get_connection_values_n (connection, MHD_COOKIE_KIND, 122 if (4 != MHD_get_connection_values_n (connection, MHD_COOKIE_KIND,
117 NULL, NULL)) 123 NULL, NULL))
118 { 124 {
@@ -193,36 +199,32 @@ testExternalGet (int use_invalid)
193 if (0 == use_invalid) 199 if (0 == use_invalid)
194 { 200 {
195 curl_easy_setopt (c, CURLOPT_COOKIE, 201 curl_easy_setopt (c, CURLOPT_COOKIE,
196 "name1=var1; name2=var2,name3 ;" \ 202 "name1=var1; name2=var2; name3=; " \
197 "name4=\"var4 with spaces\";" \ 203 "name4=\"var4 with spaces\"; " \
204 "name5=var_with_=_char" \
198 " ; ;; ;"); 205 " ; ;; ;");
199 } 206 }
200 else if (1 == use_invalid) 207 else if (1 == use_invalid)
201 { 208 {
202 curl_easy_setopt (c, CURLOPT_COOKIE, 209 curl_easy_setopt (c, CURLOPT_COOKIE,
203 "var1=value1=");
204 }
205 else if (2 == use_invalid)
206 {
207 curl_easy_setopt (c, CURLOPT_COOKIE,
208 "var1=value1;=;"); 210 "var1=value1;=;");
209 } 211 }
210 else if (3 == use_invalid) 212 else if (2 == use_invalid)
211 { 213 {
212 curl_easy_setopt (c, CURLOPT_COOKIE, 214 curl_easy_setopt (c, CURLOPT_COOKIE,
213 "="); 215 "=");
214 } 216 }
215 else if (4 == use_invalid) 217 else if (3 == use_invalid)
216 { 218 {
217 curl_easy_setopt (c, CURLOPT_COOKIE, 219 curl_easy_setopt (c, CURLOPT_COOKIE,
218 ";="); 220 ";=");
219 } 221 }
220 else if (5 == use_invalid) 222 else if (4 == use_invalid)
221 { 223 {
222 curl_easy_setopt (c, CURLOPT_COOKIE, 224 curl_easy_setopt (c, CURLOPT_COOKIE,
223 "=;"); 225 "=;");
224 } 226 }
225 else if (6 == use_invalid) 227 else if (5 == use_invalid)
226 { 228 {
227 curl_easy_setopt (c, CURLOPT_COOKIE, 229 curl_easy_setopt (c, CURLOPT_COOKIE,
228 "a=b,d=c"); 230 "a=b,d=c");