Skip to content

Commit ae03b6c

Browse files
committed
Guard digest auth MHD options with HAVE_DAUTH (issue #232)
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.
1 parent c2b9f4a commit ae03b6c

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src/webserver.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -254,9 +254,11 @@ bool webserver::start(bool blocking) {
254254
iov.push_back(gen(MHD_OPTION_THREAD_STACK_SIZE, max_thread_stack_size));
255255
}
256256

257+
#ifdef HAVE_DAUTH
257258
if (nonce_nc_size != 0) {
258259
iov.push_back(gen(MHD_OPTION_NONCE_NC_SIZE, nonce_nc_size));
259260
}
261+
#endif // HAVE_DAUTH
260262

261263
if (use_ssl) {
262264
// Need for const_cast to respect MHD interface that needs a void*
@@ -278,10 +280,12 @@ bool webserver::start(bool blocking) {
278280
iov.push_back(gen(MHD_OPTION_HTTPS_PRIORITIES, 0, reinterpret_cast<void*>(const_cast<char*>(https_priorities.c_str()))));
279281
}
280282

283+
#ifdef HAVE_DAUTH
281284
if (digest_auth_random != "") {
282285
// Need for const_cast to respect MHD interface that needs a char*
283286
iov.push_back(gen(MHD_OPTION_DIGEST_AUTH_RANDOM, digest_auth_random.size(), const_cast<char*>(digest_auth_random.c_str())));
284287
}
288+
#endif // HAVE_DAUTH
285289

286290
#ifdef HAVE_GNUTLS
287291
if (cred_type != http_utils::NONE) {

0 commit comments

Comments
 (0)