gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[libmicrohttpd] branch master updated: Fixed early response with digest


From: gnunet
Subject: [libmicrohttpd] branch master updated: Fixed early response with digest auth in tests, examples, and documentation
Date: Tue, 18 Jan 2022 13:56:20 +0100

This is an automated email from the git hooks/post-receive script.

karlson2k pushed a commit to branch master
in repository libmicrohttpd.

The following commit(s) were added to refs/heads/master by this push:
     new 6ed5b52d Fixed early response with digest auth in tests, examples, and 
documentation
6ed5b52d is described below

commit 6ed5b52d3e41a706904e05277afad92087a54784
Author: Evgeny Grin (Karlson2k) <k2k@narod.ru>
AuthorDate: Tue Jan 18 15:56:09 2022 +0300

    Fixed early response with digest auth in tests, examples, and documentation
---
 doc/libmicrohttpd.texi                        | 8 ++++++++
 src/examples/digest_auth_example.c            | 8 ++++++++
 src/testcurl/test_digestauth.c                | 8 ++++++++
 src/testcurl/test_digestauth_sha256.c         | 8 ++++++++
 src/testcurl/test_digestauth_with_arguments.c | 8 ++++++++
 5 files changed, 40 insertions(+)

diff --git a/doc/libmicrohttpd.texi b/doc/libmicrohttpd.texi
index a14c28d3..46eed3b0 100644
--- a/doc/libmicrohttpd.texi
+++ b/doc/libmicrohttpd.texi
@@ -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)
diff --git a/src/examples/digest_auth_example.c 
b/src/examples/digest_auth_example.c
index 44faefeb..ea3da19a 100644
--- a/src/examples/digest_auth_example.c
+++ b/src/examples/digest_auth_example.c
@@ -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)
   {
diff --git a/src/testcurl/test_digestauth.c b/src/testcurl/test_digestauth.c
index 13c9c826..5dd9d466 100644
--- a/src/testcurl/test_digestauth.c
+++ b/src/testcurl/test_digestauth.c
@@ -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")) )
diff --git a/src/testcurl/test_digestauth_sha256.c 
b/src/testcurl/test_digestauth_sha256.c
index 7f8ebcd5..fff3a1d7 100644
--- a/src/testcurl/test_digestauth_sha256.c
+++ b/src/testcurl/test_digestauth_sha256.c
@@ -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")) )
diff --git a/src/testcurl/test_digestauth_with_arguments.c 
b/src/testcurl/test_digestauth_with_arguments.c
index ce4b8970..91f2dd67 100644
--- a/src/testcurl/test_digestauth_with_arguments.c
+++ b/src/testcurl/test_digestauth_with_arguments.c
@@ -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")) )

-- 
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]