Skip to content

Conversation

@etr
Copy link
Owner

@etr etr commented Jan 29, 2026

Summary

Fixes #232: Linking libhttpserver fails when libmicrohttpd has digest auth disabled.

When libmicrohttpd is built with --disable-dauth, the digest auth functions (MHD_digest_auth_get_username, MHD_digest_auth_check, MHD_queue_auth_fail_response) are not available, causing linker errors.

This PR detects digest auth availability at configure time and conditionally compiles the digest auth code, following the existing pattern used for GnuTLS support.

Changes

  • Add AC_CHECK_LIB detection for MHD_queue_auth_fail_response in configure.ac
  • Add HAVE_DAUTH preprocessor flag when digest auth is available
  • Wrap digest auth code in #ifdef HAVE_DAUTH guards:
    • src/http_request.cpp - check_digest_auth() and get_digested_user()
    • src/httpserver/http_request.hpp - method declarations and cache member
    • src/digest_auth_fail_response.cpp - entire implementation
    • src/httpserver/digest_auth_fail_response.hpp - class definition
    • src/httpserver.hpp - conditional include
    • test/integ/authentication.cpp - digest auth tests
  • Show digest auth status in configure summary
  • Add CI job to test build against libmicrohttpd without digest auth

Test plan

  • Build with digest auth enabled (default) - all tests pass
  • Verify configure output shows Digest Auth: yes
  • CI: New no-dauth job builds libmicrohttpd with --disable-dauth and verifies libhttpserver builds and tests pass

etr added 3 commits January 29, 2026 10:54
When libmicrohttpd is built with --disable-dauth, the digest auth
functions (MHD_digest_auth_get_username, MHD_digest_auth_check,
MHD_queue_auth_fail_response) are not available, causing linker errors.

This change detects digest auth availability at configure time and
conditionally compiles the digest auth code, following the existing
pattern used for GnuTLS support.

Changes:
- Add AC_CHECK_LIB detection for MHD_queue_auth_fail_response
- Add HAVE_DAUTH preprocessor flag when digest auth is available
- Wrap digest auth code in #ifdef HAVE_DAUTH guards
- Show digest auth status in configure summary
Build the digest_authentication example only when HAVE_DAUTH is defined,
consistent with the conditional digest auth support added in the library.
When libmicrohttpd is built with --disable-dauth, passing
MHD_OPTION_NONCE_NC_SIZE or MHD_OPTION_DIGEST_AUTH_RANDOM to
MHD_create_daemon() causes daemon creation to fail. This fixes
the ws_start_stop test failure in the no-dauth CI build.
@etr etr merged commit 1ac17bb into master Jan 29, 2026
39 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG] linking libhttpserver might fail depending on configuration of libmicrohttpd

2 participants