mirror of
https://git.gnunet.org/libmicrohttpd.git
synced 2026-09-25 04:09:31 +03:00
Fixed early response with digest auth in tests, examples, and documentation
This commit is contained in:
@@ -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)
|
||||
|
||||
@@ -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)
|
||||
{
|
||||
|
||||
@@ -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")) )
|
||||
|
||||
@@ -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")) )
|
||||
|
||||
Reference in New Issue
Block a user