aboutsummaryrefslogtreecommitdiff
path: root/src/testcurl/test_digestauth_sha256.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/testcurl/test_digestauth_sha256.c')
-rw-r--r--src/testcurl/test_digestauth_sha256.c20
1 files changed, 10 insertions, 10 deletions
diff --git a/src/testcurl/test_digestauth_sha256.c b/src/testcurl/test_digestauth_sha256.c
index b34dff9f..dfaf1ec8 100644
--- a/src/testcurl/test_digestauth_sha256.c
+++ b/src/testcurl/test_digestauth_sha256.c
@@ -94,7 +94,7 @@ ahc_echo (void *cls,
94 const char *password = "testpass"; 94 const char *password = "testpass";
95 const char *realm = "test@example.com"; 95 const char *realm = "test@example.com";
96 enum MHD_Result ret; 96 enum MHD_Result ret;
97 enum MHD_DigestAuthResult ret_e; 97 int ret_i;
98 static int already_called_marker; 98 static int already_called_marker;
99 (void) cls; (void) url; /* Unused. Silent compiler warning. */ 99 (void) cls; (void) url; /* Unused. Silent compiler warning. */
100 (void) method; (void) version; (void) upload_data; /* Unused. Silent compiler warning. */ 100 (void) method; (void) version; (void) upload_data; /* Unused. Silent compiler warning. */
@@ -122,14 +122,14 @@ ahc_echo (void *cls,
122 MHD_destroy_response (response); 122 MHD_destroy_response (response);
123 return ret; 123 return ret;
124 } 124 }
125 ret_e = MHD_digest_auth_check3 (connection, 125 ret_i = MHD_digest_auth_check2 (connection,
126 realm, 126 realm,
127 username, 127 username,
128 password, 128 password,
129 300, 129 300,
130 MHD_DIGEST_ALG_SHA256); 130 MHD_DIGEST_ALG_SHA256);
131 MHD_free (username); 131 MHD_free (username);
132 if (ret_e != MHD_DAUTH_OK) 132 if (ret_i != MHD_YES)
133 { 133 {
134 response = MHD_create_response_from_buffer_static (strlen (DENIED), 134 response = MHD_create_response_from_buffer_static (strlen (DENIED),
135 DENIED); 135 DENIED);
@@ -139,7 +139,7 @@ ahc_echo (void *cls,
139 realm, 139 realm,
140 MY_OPAQUE, 140 MY_OPAQUE,
141 response, 141 response,
142 (MHD_DAUTH_NONCE_STALE == ret_e) ? 142 (MHD_INVALID_NONCE == ret_i) ?
143 MHD_YES : MHD_NO, 143 MHD_YES : MHD_NO,
144 MHD_DIGEST_ALG_SHA256); 144 MHD_DIGEST_ALG_SHA256);
145 MHD_destroy_response (response); 145 MHD_destroy_response (response);
@@ -155,8 +155,8 @@ ahc_echo (void *cls,
155} 155}
156 156
157 157
158static int 158static unsigned int
159testDigestAuth () 159testDigestAuth (void)
160{ 160{
161 CURL *c; 161 CURL *c;
162 CURLcode errornum; 162 CURLcode errornum;
@@ -164,7 +164,7 @@ testDigestAuth ()
164 struct CBC cbc; 164 struct CBC cbc;
165 char buf[2048]; 165 char buf[2048];
166 char rnd[8]; 166 char rnd[8];
167 int port; 167 uint16_t port;
168 char url[128]; 168 char url[128];
169#ifndef WINDOWS 169#ifndef WINDOWS
170 int fd; 170 int fd;
@@ -239,7 +239,7 @@ testDigestAuth ()
239#endif 239#endif
240 d = MHD_start_daemon (MHD_USE_INTERNAL_POLLING_THREAD | MHD_USE_ERROR_LOG, 240 d = MHD_start_daemon (MHD_USE_INTERNAL_POLLING_THREAD | MHD_USE_ERROR_LOG,
241 port, NULL, NULL, 241 port, NULL, NULL,
242 &ahc_echo, PAGE, 242 &ahc_echo, NULL,
243 MHD_OPTION_DIGEST_AUTH_RANDOM, sizeof (rnd), rnd, 243 MHD_OPTION_DIGEST_AUTH_RANDOM, sizeof (rnd), rnd,
244 MHD_OPTION_NONCE_NC_SIZE, 300, 244 MHD_OPTION_NONCE_NC_SIZE, 300,
245 MHD_OPTION_END); 245 MHD_OPTION_END);
@@ -257,12 +257,12 @@ testDigestAuth ()
257 MHD_stop_daemon (d); 257 MHD_stop_daemon (d);
258 return 32; 258 return 32;
259 } 259 }
260 port = (int) dinfo->port; 260 port = dinfo->port;
261 } 261 }
262 snprintf (url, 262 snprintf (url,
263 sizeof (url), 263 sizeof (url),
264 "http://127.0.0.1:%d/bar%%20foo?key=value", 264 "http://127.0.0.1:%d/bar%%20foo?key=value",
265 port); 265 (int) port);
266 c = curl_easy_init (); 266 c = curl_easy_init ();
267 curl_easy_setopt (c, CURLOPT_URL, url); 267 curl_easy_setopt (c, CURLOPT_URL, url);
268 curl_easy_setopt (c, CURLOPT_WRITEFUNCTION, &copyBuffer); 268 curl_easy_setopt (c, CURLOPT_WRITEFUNCTION, &copyBuffer);