gnunet-svn
[Top][All Lists]
Advanced

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

[libmicrohttpd] 01/02: Renamed one new basic auth function, improved dox


From: gnunet
Subject: [libmicrohttpd] 01/02: Renamed one new basic auth function, improved doxy
Date: Fri, 06 Oct 2023 16:59:45 +0200

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

karlson2k pushed a commit to branch master
in repository libmicrohttpd.

commit ce38b0fa79f0f0fc537163d39c1db0d76d616eb0
Author: Evgeny Grin (Karlson2k) <k2k@narod.ru>
AuthorDate: Fri Oct 6 14:11:55 2023 +0300

    Renamed one new basic auth function, improved doxy
---
 doc/examples/basicauthentication.c   | 16 +++++------
 doc/examples/tlsauthentication.c     |  8 +++---
 src/examples/authorization_example.c |  8 +++---
 src/include/microhttpd.h             | 53 +++++++++++++++++++-----------------
 src/microhttpd/basicauth.c           | 18 ++++++------
 src/testcurl/test_basicauth.c        |  6 ++--
 6 files changed, 56 insertions(+), 53 deletions(-)

diff --git a/doc/examples/basicauthentication.c 
b/doc/examples/basicauthentication.c
index 6e1493a3..e3f96d96 100644
--- a/doc/examples/basicauthentication.c
+++ b/doc/examples/basicauthentication.c
@@ -45,10 +45,10 @@ answer_to_connection (void *cls, struct MHD_Connection 
*connection,
     static const char *page =
       "<html><body>Authorization required</body></html>";
     response = MHD_create_response_from_buffer_static (strlen (page), page);
-    ret = MHD_queue_basic_auth_fail_response3 (connection,
-                                               "admins",
-                                               MHD_YES,
-                                               response);
+    ret = MHD_queue_basic_auth_required_response3 (connection,
+                                                   "admins",
+                                                   MHD_YES,
+                                                   response);
   }
   else if ((strlen ("root") != auth_info->username_len) ||
            (0 != memcmp (auth_info->username, "root",
@@ -63,10 +63,10 @@ answer_to_connection (void *cls, struct MHD_Connection 
*connection,
     static const char *page =
       "<html><body>Wrong username or password</body></html>";
     response = MHD_create_response_from_buffer_static (strlen (page), page);
-    ret = MHD_queue_basic_auth_fail_response3 (connection,
-                                               "admins",
-                                               MHD_YES,
-                                               response);
+    ret = MHD_queue_basic_auth_required_response3 (connection,
+                                                   "admins",
+                                                   MHD_YES,
+                                                   response);
   }
   else
   {
diff --git a/doc/examples/tlsauthentication.c b/doc/examples/tlsauthentication.c
index 0cd6c4e6..0f0795b6 100644
--- a/doc/examples/tlsauthentication.c
+++ b/doc/examples/tlsauthentication.c
@@ -89,10 +89,10 @@ ask_for_authentication (struct MHD_Connection *connection, 
const char *realm)
   if (! response)
     return MHD_NO;
 
-  ret = MHD_queue_basic_auth_fail_response3 (connection,
-                                             realm,
-                                             MHD_YES,
-                                             response);
+  ret = MHD_queue_basic_auth_required_response3 (connection,
+                                                 realm,
+                                                 MHD_YES,
+                                                 response);
   MHD_destroy_response (response);
   return ret;
 }
diff --git a/src/examples/authorization_example.c 
b/src/examples/authorization_example.c
index fab6bd45..3851c746 100644
--- a/src/examples/authorization_example.c
+++ b/src/examples/authorization_example.c
@@ -87,10 +87,10 @@ ahc_echo (void *cls,
     response =
       MHD_create_response_from_buffer_static (strlen (DENIED),
                                               (const void *) DENIED);
-    ret = MHD_queue_basic_auth_fail_response3 (connection,
-                                               "TestRealm",
-                                               MHD_NO,
-                                               response);
+    ret = MHD_queue_basic_auth_required_response3 (connection,
+                                                   "TestRealm",
+                                                   MHD_NO,
+                                                   response);
   }
   else
   {
diff --git a/src/include/microhttpd.h b/src/include/microhttpd.h
index 32d0bd31..e8057ae5 100644
--- a/src/include/microhttpd.h
+++ b/src/include/microhttpd.h
@@ -96,7 +96,7 @@ extern "C"
  * they are parsed as decimal numbers.
  * Example: 0x01093001 = 1.9.30-1.
  */
-#define MHD_VERSION 0x00097703
+#define MHD_VERSION 0x00097704
 
 /* If generic headers don't work on your platform, include headers
    which define 'va_list', 'size_t', 'ssize_t', 'intptr_t', 'off_t',
@@ -5794,7 +5794,9 @@ MHD_queue_auth_fail_response (struct MHD_Connection 
*connection,
 struct MHD_BasicAuthInfo
 {
   /**
-   * The username, cannot be NULL
+   * The username, cannot be NULL.
+   * The buffer pointed by the @a username becomes invalid when the pointer
+   * to the structure is freed by #MHD_free().
    */
   char *username;
 
@@ -5804,7 +5806,9 @@ struct MHD_BasicAuthInfo
   size_t username_len;
 
   /**
-   * The password, may be NULL if password is not encoded by the client
+   * The password, may be NULL if password is not encoded by the client.
+   * The buffer pointed by the @a password becomes invalid when the pointer
+   * to the structure is freed by #MHD_free().
    */
   char *password;
 
@@ -5830,21 +5834,6 @@ struct MHD_BasicAuthInfo
 _MHD_EXTERN struct MHD_BasicAuthInfo *
 MHD_basic_auth_get_username_password3 (struct MHD_Connection *connection);
 
-/**
- * Get the username and password from the basic authorization header sent by 
the client
- *
- * @param connection The MHD connection structure
- * @param[out] password a pointer for the password, free using #MHD_free().
- * @return NULL if no username could be found, a pointer
- *      to the username if found, free using #MHD_free().
- * @deprecated use #MHD_basic_auth_get_username_password3()
- * @ingroup authentication
- */
-_MHD_EXTERN char *
-MHD_basic_auth_get_username_password (struct MHD_Connection *connection,
-                                      char **password);
-
-
 /**
  * Queues a response to request basic authentication from the client.
  *
@@ -5857,7 +5846,7 @@ MHD_basic_auth_get_username_password (struct 
MHD_Connection *connection,
  * The @a response is modified by this function. The modified response object
  * can be used to respond subsequent requests by #MHD_queue_response()
  * function with status code #MHD_HTTP_UNAUTHORIZED and must not be used again
- * with MHD_queue_basic_auth_fail_response3() function. The response could
+ * with MHD_queue_basic_auth_required_response3() function. The response could
  * be destroyed right after call of this function.
  *
  * @param connection the MHD connection structure
@@ -5868,14 +5857,28 @@ MHD_basic_auth_get_username_password (struct 
MHD_Connection *connection,
  * @param response the response object to modify and queue; the NULL
  *                 is tolerated
  * @return #MHD_YES on success, #MHD_NO otherwise
- * @note Available since #MHD_VERSION 0x00097701
+ * @note Available since #MHD_VERSION 0x00097704
  * @ingroup authentication
  */
 _MHD_EXTERN enum MHD_Result
-MHD_queue_basic_auth_fail_response3 (struct MHD_Connection *connection,
-                                     const char *realm,
-                                     int prefer_utf8,
-                                     struct MHD_Response *response);
+MHD_queue_basic_auth_required_response3 (struct MHD_Connection *connection,
+                                         const char *realm,
+                                         int prefer_utf8,
+                                         struct MHD_Response *response);
+
+/**
+ * Get the username and password from the basic authorization header sent by 
the client
+ *
+ * @param connection The MHD connection structure
+ * @param[out] password a pointer for the password, free using #MHD_free().
+ * @return NULL if no username could be found, a pointer
+ *      to the username if found, free using #MHD_free().
+ * @deprecated use #MHD_basic_auth_get_username_password3()
+ * @ingroup authentication
+ */
+_MHD_EXTERN char *
+MHD_basic_auth_get_username_password (struct MHD_Connection *connection,
+                                      char **password);
 
 
 /**
@@ -5888,7 +5891,7 @@ MHD_queue_basic_auth_fail_response3 (struct 
MHD_Connection *connection,
  * @param realm the realm presented to the client
  * @param response response object to modify and queue; the NULL is tolerated
  * @return #MHD_YES on success, #MHD_NO otherwise
- * @deprecated use MHD_queue_basic_auth_fail_response3()
+ * @deprecated use MHD_queue_basic_auth_required_response3()
  * @ingroup authentication
  */
 _MHD_EXTERN enum MHD_Result
diff --git a/src/microhttpd/basicauth.c b/src/microhttpd/basicauth.c
index de2cd45c..78ce2c8e 100644
--- a/src/microhttpd/basicauth.c
+++ b/src/microhttpd/basicauth.c
@@ -205,7 +205,7 @@ MHD_basic_auth_get_username_password (struct MHD_Connection 
*connection,
  * The @a response is modified by this function. The modified response object
  * can be used to respond subsequent requests by #MHD_queue_response()
  * function with status code #MHD_HTTP_UNAUTHORIZED and must not be used again
- * with MHD_queue_basic_auth_fail_response3() function. The response could
+ * with MHD_queue_basic_auth_required_response3() function. The response could
  * be destroyed right after call of this function.
  *
  * @param connection the MHD connection structure
@@ -216,14 +216,14 @@ MHD_basic_auth_get_username_password (struct 
MHD_Connection *connection,
  * @param response the response object to modify and queue; the NULL
  *                 is tolerated
  * @return #MHD_YES on success, #MHD_NO otherwise
- * @note Available since #MHD_VERSION 0x00097701
+ * @note Available since #MHD_VERSION 0x00097704
  * @ingroup authentication
  */
 _MHD_EXTERN enum MHD_Result
-MHD_queue_basic_auth_fail_response3 (struct MHD_Connection *connection,
-                                     const char *realm,
-                                     int prefer_utf8,
-                                     struct MHD_Response *response)
+MHD_queue_basic_auth_required_response3 (struct MHD_Connection *connection,
+                                         const char *realm,
+                                         int prefer_utf8,
+                                         struct MHD_Response *response)
 {
   static const char prefix[] = "Basic realm=\"";
   static const char suff_charset[] = "\", charset=\"UTF-8\"";
@@ -306,7 +306,7 @@ MHD_queue_basic_auth_fail_response3 (struct MHD_Connection 
*connection,
  * @param realm the realm presented to the client
  * @param response response object to modify and queue; the NULL is tolerated
  * @return #MHD_YES on success, #MHD_NO otherwise
- * @deprecated use MHD_queue_basic_auth_fail_response3()
+ * @deprecated use MHD_queue_basic_auth_required_response3()
  * @ingroup authentication
  */
 _MHD_EXTERN enum MHD_Result
@@ -314,8 +314,8 @@ MHD_queue_basic_auth_fail_response (struct MHD_Connection 
*connection,
                                     const char *realm,
                                     struct MHD_Response *response)
 {
-  return MHD_queue_basic_auth_fail_response3 (connection, realm, MHD_NO,
-                                              response);
+  return MHD_queue_basic_auth_required_response3 (connection, realm, MHD_NO,
+                                                  response);
 }
 
 
diff --git a/src/testcurl/test_basicauth.c b/src/testcurl/test_basicauth.c
index 378ffd28..732c1ec1 100644
--- a/src/testcurl/test_basicauth.c
+++ b/src/testcurl/test_basicauth.c
@@ -366,10 +366,10 @@ ahc_echo (void *cls,
                                                 (const void *) DENIED);
       if (NULL == response)
         mhdErrorExitDesc ("Response creation failed");
-      ret = MHD_queue_basic_auth_fail_response3 (connection, REALM, MHD_YES,
-                                                 response);
+      ret = MHD_queue_basic_auth_required_response3 (connection, REALM, 
MHD_YES,
+                                                     response);
       if (MHD_YES != ret)
-        mhdErrorExitDesc ("'MHD_queue_basic_auth_fail_response3()' failed");
+        mhdErrorExitDesc ("'MHD_queue_basic_auth_required_response3()' 
failed");
     }
   }
   else

-- 
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]