aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEvgeny Grin (Karlson2k) <k2k@narod.ru>2022-01-27 19:13:37 +0300
committerEvgeny Grin (Karlson2k) <k2k@narod.ru>2022-01-27 19:13:37 +0300
commit1a7e4a5a5be438726de9e9c9a55e23c021b62d47 (patch)
treee3b862e439a0d50abdf2190d3adef9d942f78c2a
parentf20f9b5b95ab2e3c5b942fbce8ddaffc707c72ca (diff)
downloadlibmicrohttpd-1a7e4a5a5be438726de9e9c9a55e23c021b62d47.tar.gz
libmicrohttpd-1a7e4a5a5be438726de9e9c9a55e23c021b62d47.zip
Updated docs, test, and example to use correct digest auth API
-rw-r--r--doc/libmicrohttpd.texi2
-rw-r--r--src/examples/digest_auth_example.c20
-rw-r--r--src/testcurl/test_digestauth_sha256.c2
-rw-r--r--src/testcurl/test_digestauth_with_arguments.c22
4 files changed, 25 insertions, 21 deletions
diff --git a/doc/libmicrohttpd.texi b/doc/libmicrohttpd.texi
index 46eed3b0..dfe8a686 100644
--- a/doc/libmicrohttpd.texi
+++ b/doc/libmicrohttpd.texi
@@ -3332,7 +3332,7 @@ ahc_echo (void *cls,
3332 password, 3332 password,
3333 300, 3333 300,
3334 MHD_DIGEST_ALG_SHA256); 3334 MHD_DIGEST_ALG_SHA256);
3335 free(username); 3335 MHD_free(username);
3336 if ( (ret == MHD_INVALID_NONCE) || 3336 if ( (ret == MHD_INVALID_NONCE) ||
3337 (ret == MHD_NO) ) 3337 (ret == MHD_NO) )
3338 @{ 3338 @{
diff --git a/src/examples/digest_auth_example.c b/src/examples/digest_auth_example.c
index ea3da19a..68d13c84 100644
--- a/src/examples/digest_auth_example.c
+++ b/src/examples/digest_auth_example.c
@@ -70,10 +70,11 @@ ahc_echo (void *cls,
70 response = MHD_create_response_from_buffer (strlen (DENIED), 70 response = MHD_create_response_from_buffer (strlen (DENIED),
71 DENIED, 71 DENIED,
72 MHD_RESPMEM_PERSISTENT); 72 MHD_RESPMEM_PERSISTENT);
73 ret = MHD_queue_auth_fail_response (connection, realm, 73 ret = MHD_queue_auth_fail_response2 (connection, realm,
74 MY_OPAQUE_STR, 74 MY_OPAQUE_STR,
75 response, 75 response,
76 MHD_NO); 76 MHD_NO,
77 MHD_DIGEST_ALG_MD5);
77 MHD_destroy_response (response); 78 MHD_destroy_response (response);
78 return ret; 79 return ret;
79 } 80 }
@@ -90,11 +91,12 @@ ahc_echo (void *cls,
90 MHD_RESPMEM_PERSISTENT); 91 MHD_RESPMEM_PERSISTENT);
91 if (NULL == response) 92 if (NULL == response)
92 return MHD_NO; 93 return MHD_NO;
93 ret = MHD_queue_auth_fail_response (connection, realm, 94 ret = MHD_queue_auth_fail_response2 (connection, realm,
94 MY_OPAQUE_STR, 95 MY_OPAQUE_STR,
95 response, 96 response,
96 (res == MHD_INVALID_NONCE) ? MHD_YES : 97 (res == MHD_INVALID_NONCE) ? MHD_YES :
97 MHD_NO); 98 MHD_NO,
99 MHD_DIGEST_ALG_MD5);
98 MHD_destroy_response (response); 100 MHD_destroy_response (response);
99 return ret; 101 return ret;
100 } 102 }
diff --git a/src/testcurl/test_digestauth_sha256.c b/src/testcurl/test_digestauth_sha256.c
index fff3a1d7..f6df664e 100644
--- a/src/testcurl/test_digestauth_sha256.c
+++ b/src/testcurl/test_digestauth_sha256.c
@@ -129,7 +129,7 @@ ahc_echo (void *cls,
129 password, 129 password,
130 300, 130 300,
131 MHD_DIGEST_ALG_SHA256); 131 MHD_DIGEST_ALG_SHA256);
132 free (username); 132 MHD_free (username);
133 if ( (ret_i == MHD_INVALID_NONCE) || 133 if ( (ret_i == MHD_INVALID_NONCE) ||
134 (ret_i == MHD_NO) ) 134 (ret_i == MHD_NO) )
135 { 135 {
diff --git a/src/testcurl/test_digestauth_with_arguments.c b/src/testcurl/test_digestauth_with_arguments.c
index 91f2dd67..ac1aed56 100644
--- a/src/testcurl/test_digestauth_with_arguments.c
+++ b/src/testcurl/test_digestauth_with_arguments.c
@@ -107,10 +107,11 @@ ahc_echo (void *cls,
107 response = MHD_create_response_from_buffer (strlen (DENIED), 107 response = MHD_create_response_from_buffer (strlen (DENIED),
108 DENIED, 108 DENIED,
109 MHD_RESPMEM_PERSISTENT); 109 MHD_RESPMEM_PERSISTENT);
110 ret = MHD_queue_auth_fail_response (connection, realm, 110 ret = MHD_queue_auth_fail_response2 (connection, realm,
111 MY_OPAQUE, 111 MY_OPAQUE,
112 response, 112 response,
113 MHD_NO); 113 MHD_NO,
114 MHD_DIGEST_ALG_MD5);
114 MHD_destroy_response (response); 115 MHD_destroy_response (response);
115 return ret; 116 return ret;
116 } 117 }
@@ -118,7 +119,7 @@ ahc_echo (void *cls,
118 username, 119 username,
119 password, 120 password,
120 300); 121 300);
121 free (username); 122 MHD_free (username);
122 if ( (ret_i == MHD_INVALID_NONCE) || 123 if ( (ret_i == MHD_INVALID_NONCE) ||
123 (ret_i == MHD_NO) ) 124 (ret_i == MHD_NO) )
124 { 125 {
@@ -127,11 +128,12 @@ ahc_echo (void *cls,
127 MHD_RESPMEM_PERSISTENT); 128 MHD_RESPMEM_PERSISTENT);
128 if (NULL == response) 129 if (NULL == response)
129 return MHD_NO; 130 return MHD_NO;
130 ret = MHD_queue_auth_fail_response (connection, realm, 131 ret = MHD_queue_auth_fail_response2 (connection, realm,
131 MY_OPAQUE, 132 MY_OPAQUE,
132 response, 133 response,
133 (ret_i == MHD_INVALID_NONCE) ? 134 (ret_i == MHD_INVALID_NONCE) ?
134 MHD_YES : MHD_NO); 135 MHD_YES : MHD_NO,
136 MHD_DIGEST_ALG_MD5);
135 MHD_destroy_response (response); 137 MHD_destroy_response (response);
136 return ret; 138 return ret;
137 } 139 }