commit cd6b50055aa9483d85c60503bab2f98d7db53902
parent eb10702659af7a11679422633d8baa4f4a18594e
Author: Evgeny Grin (Karlson2k) <k2k@drgrin.dev>
Date: Mon, 6 Jul 2026 15:10:51 +0200
Compacted MHD_action_basic_auth_challenge_{p,a} public macros
Diffstat:
2 files changed, 74 insertions(+), 78 deletions(-)
diff --git a/src/include/microhttpd2.h b/src/include/microhttpd2.h
@@ -8679,68 +8679,66 @@ MHD_STATIC_INLINE_END_
/**
* Create action to reply with Basic Authentication "challenge".
*
- * The @a response must have #MHD_HTTP_STATUS_UNAUTHORIZED status code.
+ * The @a r response must have #MHD_HTTP_STATUS_UNAUTHORIZED status code.
*
- * If the @a response object cannot be extended with the "challenge",
- * the @a response will be used to reply without the "challenge".
+ * If the @a r response object cannot be extended with the "challenge",
+ * the @a r response will be used to reply without the "challenge".
*
- * @param request the request to create the action for
- * @param realm the realm presented to the client
- * @param prefer_utf8 if not set to #MHD_NO, parameter'charset="UTF-8"' will
- * be added, indicating for client that UTF-8 encoding
- * is preferred
- * @param response the reply to send; should contain the "access denied"
- * body;
- * note: this function adds the "WWW Authenticate" header in
- * the response and the caller should not set this header;
- * the response must have #MHD_HTTP_STATUS_UNAUTHORIZED status
- * code;
- * the NULL is tolerated (the result is
- * #MHD_action_abort_request())
+ * @param rq the request to create the action for
+ * @param l the realm presented to the client
+ * @param u if not set to #MHD_NO, parameter'charset="UTF-8"' will
+ * be added, indicating for client that UTF-8 encoding
+ * is preferred
+ * @param r the reply to send; should contain the "access denied"
+ * body;
+ * note: this function adds the "WWW Authenticate" header in
+ * the response and the caller should not set this header;
+ * the response must have #MHD_HTTP_STATUS_UNAUTHORIZED status
+ * code;
+ * the NULL is tolerated (the result is
+ * #MHD_action_abort_request())
* @return pointer to the action, the action must be consumed
* otherwise response object may leak;
* NULL if failed or if any action has been already created for
- * the @a request;
+ * the @a rq request;
* when failed the response object is consumed and need not
* to be "destroyed"
* @ingroup authentication
*/
-#define MHD_action_basic_auth_challenge_p(request,realm,prefer_utf8,response) \
- MHD_action_basic_auth_challenge ((request), (realm), (prefer_utf8), \
- (response), MHD_NO)
+#define MHD_action_basic_auth_challenge_p(rq, l, u, r) \
+ MHD_action_basic_auth_challenge ((rq), (l), (u), (r), MHD_NO)
/**
* Create action to reply with Basic Authentication "challenge".
*
- * The @a response must have #MHD_HTTP_STATUS_UNAUTHORIZED status code.
+ * The @a r response must have #MHD_HTTP_STATUS_UNAUTHORIZED status code.
*
- * If the @a response object cannot be extended with the "challenge",
+ * If the @a r response object cannot be extended with the "challenge",
* the request will be aborted.
*
- * @param request the request to create the action for
- * @param realm the realm presented to the client
- * @param prefer_utf8 if not set to #MHD_NO, parameter'charset="UTF-8"' will
- * be added, indicating for client that UTF-8 encoding
- * is preferred
- * @param response the reply to send; should contain the "access denied"
- * body;
- * note: this function adds the "WWW Authenticate" header in
- * the response and the caller should not set this header;
- * the response must have #MHD_HTTP_STATUS_UNAUTHORIZED status
- * code;
- * the NULL is tolerated (the result is
- * #MHD_action_abort_request())
+ * @param rq the request to create the action for
+ * @param l the realm presented to the client
+ * @param u if not set to #MHD_NO, parameter'charset="UTF-8"' will
+ * be added, indicating for client that UTF-8 encoding
+ * is preferred
+ * @param r the reply to send; should contain the "access denied"
+ * body;
+ * note: this function adds the "WWW Authenticate" header in
+ * the response and the caller should not set this header;
+ * the response must have #MHD_HTTP_STATUS_UNAUTHORIZED status
+ * code;
+ * the NULL is tolerated (the result is
+ * #MHD_action_abort_request())
* @return pointer to the action, the action must be consumed
* otherwise response object may leak;
* NULL if failed or if any action has been already created for
- * the @a request;
+ * the @a rq request;
* when failed the response object is consumed and need not
* to be "destroyed"
* @ingroup authentication
*/
-#define MHD_action_basic_auth_challenge_a(request,realm,prefer_utf8,response) \
- MHD_action_basic_auth_challenge ((request), (realm), (prefer_utf8), \
- (response), MHD_YES)
+#define MHD_action_basic_auth_challenge_a(rq, l, u, r) \
+ MHD_action_basic_auth_challenge ((rq), (l), (u), (r), MHD_YES)
#endif /* ! MHD_NO_STATIC_INLINE */
diff --git a/src/include/microhttpd2_main.h.in b/src/include/microhttpd2_main.h.in
@@ -3761,68 +3761,66 @@ MHD_STATIC_INLINE_END_
/**
* Create action to reply with Basic Authentication "challenge".
*
- * The @a response must have #MHD_HTTP_STATUS_UNAUTHORIZED status code.
+ * The @a r response must have #MHD_HTTP_STATUS_UNAUTHORIZED status code.
*
- * If the @a response object cannot be extended with the "challenge",
- * the @a response will be used to reply without the "challenge".
+ * If the @a r response object cannot be extended with the "challenge",
+ * the @a r response will be used to reply without the "challenge".
*
- * @param request the request to create the action for
- * @param realm the realm presented to the client
- * @param prefer_utf8 if not set to #MHD_NO, parameter'charset="UTF-8"' will
- * be added, indicating for client that UTF-8 encoding
- * is preferred
- * @param response the reply to send; should contain the "access denied"
- * body;
- * note: this function adds the "WWW Authenticate" header in
- * the response and the caller should not set this header;
- * the response must have #MHD_HTTP_STATUS_UNAUTHORIZED status
- * code;
- * the NULL is tolerated (the result is
- * #MHD_action_abort_request())
+ * @param rq the request to create the action for
+ * @param l the realm presented to the client
+ * @param u if not set to #MHD_NO, parameter'charset="UTF-8"' will
+ * be added, indicating for client that UTF-8 encoding
+ * is preferred
+ * @param r the reply to send; should contain the "access denied"
+ * body;
+ * note: this function adds the "WWW Authenticate" header in
+ * the response and the caller should not set this header;
+ * the response must have #MHD_HTTP_STATUS_UNAUTHORIZED status
+ * code;
+ * the NULL is tolerated (the result is
+ * #MHD_action_abort_request())
* @return pointer to the action, the action must be consumed
* otherwise response object may leak;
* NULL if failed or if any action has been already created for
- * the @a request;
+ * the @a rq request;
* when failed the response object is consumed and need not
* to be "destroyed"
* @ingroup authentication
*/
-#define MHD_action_basic_auth_challenge_p(request,realm,prefer_utf8,response) \
- MHD_action_basic_auth_challenge ((request), (realm), (prefer_utf8), \
- (response), MHD_NO)
+#define MHD_action_basic_auth_challenge_p(rq, l, u, r) \
+ MHD_action_basic_auth_challenge ((rq), (l), (u), (r), MHD_NO)
/**
* Create action to reply with Basic Authentication "challenge".
*
- * The @a response must have #MHD_HTTP_STATUS_UNAUTHORIZED status code.
+ * The @a r response must have #MHD_HTTP_STATUS_UNAUTHORIZED status code.
*
- * If the @a response object cannot be extended with the "challenge",
+ * If the @a r response object cannot be extended with the "challenge",
* the request will be aborted.
*
- * @param request the request to create the action for
- * @param realm the realm presented to the client
- * @param prefer_utf8 if not set to #MHD_NO, parameter'charset="UTF-8"' will
- * be added, indicating for client that UTF-8 encoding
- * is preferred
- * @param response the reply to send; should contain the "access denied"
- * body;
- * note: this function adds the "WWW Authenticate" header in
- * the response and the caller should not set this header;
- * the response must have #MHD_HTTP_STATUS_UNAUTHORIZED status
- * code;
- * the NULL is tolerated (the result is
- * #MHD_action_abort_request())
+ * @param rq the request to create the action for
+ * @param l the realm presented to the client
+ * @param u if not set to #MHD_NO, parameter'charset="UTF-8"' will
+ * be added, indicating for client that UTF-8 encoding
+ * is preferred
+ * @param r the reply to send; should contain the "access denied"
+ * body;
+ * note: this function adds the "WWW Authenticate" header in
+ * the response and the caller should not set this header;
+ * the response must have #MHD_HTTP_STATUS_UNAUTHORIZED status
+ * code;
+ * the NULL is tolerated (the result is
+ * #MHD_action_abort_request())
* @return pointer to the action, the action must be consumed
* otherwise response object may leak;
* NULL if failed or if any action has been already created for
- * the @a request;
+ * the @a rq request;
* when failed the response object is consumed and need not
* to be "destroyed"
* @ingroup authentication
*/
-#define MHD_action_basic_auth_challenge_a(request,realm,prefer_utf8,response) \
- MHD_action_basic_auth_challenge ((request), (realm), (prefer_utf8), \
- (response), MHD_YES)
+#define MHD_action_basic_auth_challenge_a(rq, l, u, r) \
+ MHD_action_basic_auth_challenge ((rq), (l), (u), (r), MHD_YES)
#endif /* ! MHD_NO_STATIC_INLINE */