Fixed early response with digest auth in tests, examples, and documentation

This commit is contained in:
Evgeny Grin (Karlson2k)
2022-01-18 15:56:09 +03:00
parent 84a92e8a71
commit 6ed5b52d3e
5 changed files with 40 additions and 0 deletions
+8
View File
@@ -3302,6 +3302,14 @@ ahc_echo (void *cls,
const char *password = "testpass";
const char *realm = "test@@example.com";
int ret;
static int already_called_marker;
if (&already_called_marker != *req_cls)
@{ /* Called for the first time, request not fully read yet */
*req_cls = &already_called_marker;
/* Wait for complete request */
return MHD_YES;
@}
username = MHD_digest_auth_get_username (connection);
if (username == NULL)
+8
View File
@@ -48,6 +48,7 @@ ahc_echo (void *cls,
const char *realm = "test@example.com";
int res;
enum MHD_Result ret;
static int already_called_marker;
(void) cls; /* Unused. Silent compiler warning. */
(void) url; /* Unused. Silent compiler warning. */
(void) method; /* Unused. Silent compiler warning. */
@@ -56,6 +57,13 @@ ahc_echo (void *cls,
(void) upload_data_size; /* Unused. Silent compiler warning. */
(void) req_cls; /* Unused. Silent compiler warning. */
if (&already_called_marker != *req_cls)
{ /* Called for the first time, request not fully read yet */
*req_cls = &already_called_marker;
/* Wait for complete request */
return MHD_YES;
}
username = MHD_digest_auth_get_username (connection);
if (NULL == username)
{
+8
View File
@@ -94,10 +94,18 @@ ahc_echo (void *cls,
const char *realm = "test@example.com";
enum MHD_Result ret;
int ret_i;
static int already_called_marker;
(void) cls; (void) url; /* Unused. Silent compiler warning. */
(void) method; (void) version; (void) upload_data; /* Unused. Silent compiler warning. */
(void) upload_data_size; (void) req_cls; /* Unused. Silent compiler warning. */
if (&already_called_marker != *req_cls)
{ /* Called for the first time, request not fully read yet */
*req_cls = &already_called_marker;
/* Wait for complete request */
return MHD_YES;
}
username = MHD_digest_auth_get_username (connection);
if ( (username == NULL) ||
(0 != strcmp (username, "testuser")) )
+8
View File
@@ -95,10 +95,18 @@ ahc_echo (void *cls,
const char *realm = "test@example.com";
enum MHD_Result ret;
int ret_i;
static int already_called_marker;
(void) cls; (void) url; /* Unused. Silent compiler warning. */
(void) method; (void) version; (void) upload_data; /* Unused. Silent compiler warning. */
(void) upload_data_size; (void) req_cls; /* Unused. Silent compiler warning. */
if (&already_called_marker != *req_cls)
{ /* Called for the first time, request not fully read yet */
*req_cls = &already_called_marker;
/* Wait for complete request */
return MHD_YES;
}
username = MHD_digest_auth_get_username (connection);
if ( (username == NULL) ||
(0 != strcmp (username, "testuser")) )
@@ -88,10 +88,18 @@ ahc_echo (void *cls,
const char *realm = "test@example.com";
enum MHD_Result ret;
int ret_i;
static int already_called_marker;
(void) cls; (void) url; /* Unused. Silent compiler warning. */
(void) method; (void) version; (void) upload_data; /* Unused. Silent compiler warning. */
(void) upload_data_size; (void) req_cls; /* Unused. Silent compiler warning. */
if (&already_called_marker != *req_cls)
{ /* Called for the first time, request not fully read yet */
*req_cls = &already_called_marker;
/* Wait for complete request */
return MHD_YES;
}
username = MHD_digest_auth_get_username (connection);
if ( (username == NULL) ||
(0 != strcmp (username, "testuser")) )