aboutsummaryrefslogtreecommitdiff
path: root/src/microhttpd/daemon.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/microhttpd/daemon.c')
-rw-r--r--src/microhttpd/daemon.c192
1 files changed, 96 insertions, 96 deletions
diff --git a/src/microhttpd/daemon.c b/src/microhttpd/daemon.c
index 8830c524..b9cebc43 100644
--- a/src/microhttpd/daemon.c
+++ b/src/microhttpd/daemon.c
@@ -131,7 +131,7 @@ mhd_panic_std (void *cls,
131 unsigned int line, 131 unsigned int line,
132 const char *reason) 132 const char *reason)
133{ 133{
134#if HAVE_MESSAGES 134#ifdef HAVE_MESSAGES
135 fprintf (stderr, 135 fprintf (stderr,
136 "Fatal error in GNU libmicrohttpd %s:%u: %s\n", 136 "Fatal error in GNU libmicrohttpd %s:%u: %s\n",
137 file, line, reason); 137 file, line, reason);
@@ -334,7 +334,7 @@ MHD_ip_limit_add (struct MHD_Daemon *daemon,
334 &daemon->per_ip_connection_count, 334 &daemon->per_ip_connection_count,
335 &MHD_ip_addr_compare))) 335 &MHD_ip_addr_compare)))
336 { 336 {
337#if HAVE_MESSAGES 337#ifdef HAVE_MESSAGES
338 MHD_DLOG (daemon, 338 MHD_DLOG (daemon,
339 "Failed to add IP connection count node\n"); 339 "Failed to add IP connection count node\n");
340#endif 340#endif
@@ -523,7 +523,7 @@ MHD_init_daemon_certificate (struct MHD_Daemon *daemon)
523 if (gnutls_certificate_set_x509_trust_mem (daemon->x509_cred, &cert, 523 if (gnutls_certificate_set_x509_trust_mem (daemon->x509_cred, &cert,
524 GNUTLS_X509_FMT_PEM) < 0) 524 GNUTLS_X509_FMT_PEM) < 0)
525 { 525 {
526#if HAVE_MESSAGES 526#ifdef HAVE_MESSAGES
527 MHD_DLOG(daemon, 527 MHD_DLOG(daemon,
528 "Bad trust certificate format\n"); 528 "Bad trust certificate format\n");
529#endif 529#endif
@@ -553,7 +553,7 @@ MHD_init_daemon_certificate (struct MHD_Daemon *daemon)
553 daemon->https_key_password, 553 daemon->https_key_password,
554 0); 554 0);
555#else 555#else
556#if HAVE_MESSAGES 556#ifdef HAVE_MESSAGES
557 MHD_DLOG (daemon, 557 MHD_DLOG (daemon,
558 "Failed to setup x509 certificate/key: pre 3.X.X version " \ 558 "Failed to setup x509 certificate/key: pre 3.X.X version " \
559 "of GnuTLS does not support setting key password"); 559 "of GnuTLS does not support setting key password");
@@ -565,7 +565,7 @@ MHD_init_daemon_certificate (struct MHD_Daemon *daemon)
565 ret = gnutls_certificate_set_x509_key_mem (daemon->x509_cred, 565 ret = gnutls_certificate_set_x509_key_mem (daemon->x509_cred,
566 &cert, &key, 566 &cert, &key,
567 GNUTLS_X509_FMT_PEM); 567 GNUTLS_X509_FMT_PEM);
568#if HAVE_MESSAGES 568#ifdef HAVE_MESSAGES
569 if (0 != ret) 569 if (0 != ret)
570 MHD_DLOG (daemon, 570 MHD_DLOG (daemon,
571 "GnuTLS failed to setup x509 certificate/key: %s\n", 571 "GnuTLS failed to setup x509 certificate/key: %s\n",
@@ -577,7 +577,7 @@ MHD_init_daemon_certificate (struct MHD_Daemon *daemon)
577 if (NULL != daemon->cert_callback) 577 if (NULL != daemon->cert_callback)
578 return 0; 578 return 0;
579#endif 579#endif
580#if HAVE_MESSAGES 580#ifdef HAVE_MESSAGES
581 MHD_DLOG (daemon, 581 MHD_DLOG (daemon,
582 "You need to specify a certificate and key location\n"); 582 "You need to specify a certificate and key location\n");
583#endif 583#endif
@@ -602,7 +602,7 @@ MHD_TLS_init (struct MHD_Daemon *daemon)
602 return GNUTLS_E_MEMORY_ERROR; 602 return GNUTLS_E_MEMORY_ERROR;
603 return MHD_init_daemon_certificate (daemon); 603 return MHD_init_daemon_certificate (daemon);
604 default: 604 default:
605#if HAVE_MESSAGES 605#ifdef HAVE_MESSAGES
606 MHD_DLOG (daemon, 606 MHD_DLOG (daemon,
607 "Error: invalid credentials type %d specified.\n", 607 "Error: invalid credentials type %d specified.\n",
608 daemon->cred_type); 608 daemon->cred_type);
@@ -762,7 +762,7 @@ MHD_get_fdset2 (struct MHD_Daemon *daemon,
762 } 762 }
763 } 763 }
764#if DEBUG_CONNECT 764#if DEBUG_CONNECT
765#if HAVE_MESSAGES 765#ifdef HAVE_MESSAGES
766 if (NULL != max_fd) 766 if (NULL != max_fd)
767 MHD_DLOG (daemon, 767 MHD_DLOG (daemon,
768 "Maximum socket in select set: %d\n", 768 "Maximum socket in select set: %d\n",
@@ -886,7 +886,7 @@ MHD_handle_connection (void *data)
886#endif 886#endif
887 if (0 != err_state) 887 if (0 != err_state)
888 { 888 {
889#if HAVE_MESSAGES 889#ifdef HAVE_MESSAGES
890 MHD_DLOG (con->daemon, 890 MHD_DLOG (con->daemon,
891 "Can't add FD to fd_set\n"); 891 "Can't add FD to fd_set\n");
892#endif 892#endif
@@ -898,7 +898,7 @@ MHD_handle_connection (void *data)
898 { 898 {
899 if (EINTR == MHD_socket_errno_) 899 if (EINTR == MHD_socket_errno_)
900 continue; 900 continue;
901#if HAVE_MESSAGES 901#ifdef HAVE_MESSAGES
902 MHD_DLOG (con->daemon, 902 MHD_DLOG (con->daemon,
903 "Error during select (%d): `%s'\n", 903 "Error during select (%d): `%s'\n",
904 MHD_socket_errno_, 904 MHD_socket_errno_,
@@ -971,7 +971,7 @@ MHD_handle_connection (void *data)
971 { 971 {
972 if (EINTR == MHD_socket_errno_) 972 if (EINTR == MHD_socket_errno_)
973 continue; 973 continue;
974#if HAVE_MESSAGES 974#ifdef HAVE_MESSAGES
975 MHD_DLOG (con->daemon, 975 MHD_DLOG (con->daemon,
976 "Error during poll: `%s'\n", 976 "Error during poll: `%s'\n",
977 MHD_socket_last_strerr_ ()); 977 MHD_socket_last_strerr_ ());
@@ -1003,7 +1003,7 @@ MHD_handle_connection (void *data)
1003 if (MHD_CONNECTION_IN_CLEANUP != con->state) 1003 if (MHD_CONNECTION_IN_CLEANUP != con->state)
1004 { 1004 {
1005#if DEBUG_CLOSE 1005#if DEBUG_CLOSE
1006#if HAVE_MESSAGES 1006#ifdef HAVE_MESSAGES
1007 MHD_DLOG (con->daemon, 1007 MHD_DLOG (con->daemon,
1008 "Processing thread terminating, closing connection\n"); 1008 "Processing thread terminating, closing connection\n");
1009#endif 1009#endif
@@ -1236,7 +1236,7 @@ create_thread (MHD_thread_handle_ *thread,
1236 pthread_attr_destroy (&attr); 1236 pthread_attr_destroy (&attr);
1237 return ret; 1237 return ret;
1238 ERR: 1238 ERR:
1239#if HAVE_MESSAGES 1239#ifdef HAVE_MESSAGES
1240 MHD_DLOG (daemon, 1240 MHD_DLOG (daemon,
1241 "Failed to set thread stack size\n"); 1241 "Failed to set thread stack size\n");
1242#endif 1242#endif
@@ -1325,7 +1325,7 @@ internal_add_connection (struct MHD_Daemon *daemon,
1325 if ( (client_socket >= FD_SETSIZE) && 1325 if ( (client_socket >= FD_SETSIZE) &&
1326 (0 == (daemon->options & (MHD_USE_POLL | MHD_USE_EPOLL_LINUX_ONLY))) ) 1326 (0 == (daemon->options & (MHD_USE_POLL | MHD_USE_EPOLL_LINUX_ONLY))) )
1327 { 1327 {
1328#if HAVE_MESSAGES 1328#ifdef HAVE_MESSAGES
1329 MHD_DLOG (daemon, 1329 MHD_DLOG (daemon,
1330 "Socket descriptor larger than FD_SETSIZE: %d > %d\n", 1330 "Socket descriptor larger than FD_SETSIZE: %d > %d\n",
1331 client_socket, 1331 client_socket,
@@ -1341,7 +1341,7 @@ internal_add_connection (struct MHD_Daemon *daemon,
1341#endif 1341#endif
1342 1342
1343 1343
1344#if HAVE_MESSAGES 1344#ifdef HAVE_MESSAGES
1345#if DEBUG_CONNECT 1345#if DEBUG_CONNECT
1346 MHD_DLOG (daemon, 1346 MHD_DLOG (daemon,
1347 "Accepted connection on socket %d\n", 1347 "Accepted connection on socket %d\n",
@@ -1352,7 +1352,7 @@ internal_add_connection (struct MHD_Daemon *daemon,
1352 (MHD_NO == MHD_ip_limit_add (daemon, addr, addrlen)) ) 1352 (MHD_NO == MHD_ip_limit_add (daemon, addr, addrlen)) )
1353 { 1353 {
1354 /* above connection limit - reject */ 1354 /* above connection limit - reject */
1355#if HAVE_MESSAGES 1355#ifdef HAVE_MESSAGES
1356 MHD_DLOG (daemon, 1356 MHD_DLOG (daemon,
1357 "Server reached connection limit (closing inbound connection)\n"); 1357 "Server reached connection limit (closing inbound connection)\n");
1358#endif 1358#endif
@@ -1370,7 +1370,7 @@ internal_add_connection (struct MHD_Daemon *daemon,
1370 addr, addrlen)) ) 1370 addr, addrlen)) )
1371 { 1371 {
1372#if DEBUG_CLOSE 1372#if DEBUG_CLOSE
1373#if HAVE_MESSAGES 1373#ifdef HAVE_MESSAGES
1374 MHD_DLOG (daemon, 1374 MHD_DLOG (daemon,
1375 "Connection rejected, closing connection\n"); 1375 "Connection rejected, closing connection\n");
1376#endif 1376#endif
@@ -1397,7 +1397,7 @@ internal_add_connection (struct MHD_Daemon *daemon,
1397 if (NULL == (connection = malloc (sizeof (struct MHD_Connection)))) 1397 if (NULL == (connection = malloc (sizeof (struct MHD_Connection))))
1398 { 1398 {
1399 eno = errno; 1399 eno = errno;
1400#if HAVE_MESSAGES 1400#ifdef HAVE_MESSAGES
1401 MHD_DLOG (daemon, 1401 MHD_DLOG (daemon,
1402 "Error allocating memory: %s\n", 1402 "Error allocating memory: %s\n",
1403 MHD_strerror_ (errno)); 1403 MHD_strerror_ (errno));
@@ -1414,7 +1414,7 @@ internal_add_connection (struct MHD_Daemon *daemon,
1414 connection->pool = MHD_pool_create (daemon->pool_size); 1414 connection->pool = MHD_pool_create (daemon->pool_size);
1415 if (NULL == connection->pool) 1415 if (NULL == connection->pool)
1416 { 1416 {
1417#if HAVE_MESSAGES 1417#ifdef HAVE_MESSAGES
1418 MHD_DLOG (daemon, 1418 MHD_DLOG (daemon,
1419 "Error allocating memory: %s\n", 1419 "Error allocating memory: %s\n",
1420 MHD_strerror_ (errno)); 1420 MHD_strerror_ (errno));
@@ -1433,7 +1433,7 @@ internal_add_connection (struct MHD_Daemon *daemon,
1433 if (NULL == (connection->addr = malloc (addrlen))) 1433 if (NULL == (connection->addr = malloc (addrlen)))
1434 { 1434 {
1435 eno = errno; 1435 eno = errno;
1436#if HAVE_MESSAGES 1436#ifdef HAVE_MESSAGES
1437 MHD_DLOG (daemon, 1437 MHD_DLOG (daemon,
1438 "Error allocating memory: %s\n", 1438 "Error allocating memory: %s\n",
1439 MHD_strerror_ (errno)); 1439 MHD_strerror_ (errno));
@@ -1473,7 +1473,7 @@ internal_add_connection (struct MHD_Daemon *daemon,
1473 if ( (-1 == flags) || 1473 if ( (-1 == flags) ||
1474 (0 != fcntl (connection->socket_fd, F_SETFL, flags | O_NONBLOCK)) ) 1474 (0 != fcntl (connection->socket_fd, F_SETFL, flags | O_NONBLOCK)) )
1475 { 1475 {
1476#if HAVE_MESSAGES 1476#ifdef HAVE_MESSAGES
1477 MHD_DLOG (daemon, 1477 MHD_DLOG (daemon,
1478 "Failed to make socket non-blocking: %s\n", 1478 "Failed to make socket non-blocking: %s\n",
1479 MHD_socket_last_strerr_ ()); 1479 MHD_socket_last_strerr_ ());
@@ -1483,7 +1483,7 @@ internal_add_connection (struct MHD_Daemon *daemon,
1483 unsigned long flags = 1; 1483 unsigned long flags = 1;
1484 if (0 != ioctlsocket (connection->socket_fd, FIONBIO, &flags)) 1484 if (0 != ioctlsocket (connection->socket_fd, FIONBIO, &flags))
1485 { 1485 {
1486#if HAVE_MESSAGES 1486#ifdef HAVE_MESSAGES
1487 MHD_DLOG (daemon, 1487 MHD_DLOG (daemon,
1488 "Failed to make socket non-blocking: %s\n", 1488 "Failed to make socket non-blocking: %s\n",
1489 MHD_socket_last_strerr_ ()); 1489 MHD_socket_last_strerr_ ());
@@ -1512,7 +1512,7 @@ internal_add_connection (struct MHD_Daemon *daemon,
1512 daemon->x509_cred); 1512 daemon->x509_cred);
1513 break; 1513 break;
1514 default: 1514 default:
1515#if HAVE_MESSAGES 1515#ifdef HAVE_MESSAGES
1516 MHD_DLOG (connection->daemon, 1516 MHD_DLOG (connection->daemon,
1517 "Failed to setup TLS credentials: unknown credential type %d\n", 1517 "Failed to setup TLS credentials: unknown credential type %d\n",
1518 daemon->cred_type); 1518 daemon->cred_type);
@@ -1570,7 +1570,7 @@ internal_add_connection (struct MHD_Daemon *daemon,
1570 if (0 != res_thread_create) 1570 if (0 != res_thread_create)
1571 { 1571 {
1572 eno = errno; 1572 eno = errno;
1573#if HAVE_MESSAGES 1573#ifdef HAVE_MESSAGES
1574 MHD_DLOG (daemon, 1574 MHD_DLOG (daemon,
1575 "Failed to create a thread: %s\n", 1575 "Failed to create a thread: %s\n",
1576 MHD_strerror_ (res_thread_create)); 1576 MHD_strerror_ (res_thread_create));
@@ -1583,7 +1583,7 @@ internal_add_connection (struct MHD_Daemon *daemon,
1583 (MHD_INVALID_PIPE_ != daemon->wpipe[1]) && 1583 (MHD_INVALID_PIPE_ != daemon->wpipe[1]) &&
1584 (1 != MHD_pipe_write_ (daemon->wpipe[1], "n", 1)) ) 1584 (1 != MHD_pipe_write_ (daemon->wpipe[1], "n", 1)) )
1585 { 1585 {
1586#if HAVE_MESSAGES 1586#ifdef HAVE_MESSAGES
1587 MHD_DLOG (daemon, 1587 MHD_DLOG (daemon,
1588 "failed to signal new connection via pipe"); 1588 "failed to signal new connection via pipe");
1589#endif 1589#endif
@@ -1603,7 +1603,7 @@ internal_add_connection (struct MHD_Daemon *daemon,
1603 &event)) 1603 &event))
1604 { 1604 {
1605 eno = errno; 1605 eno = errno;
1606#if HAVE_MESSAGES 1606#ifdef HAVE_MESSAGES
1607 MHD_DLOG (daemon, 1607 MHD_DLOG (daemon,
1608 "Call to epoll_ctl failed: %s\n", 1608 "Call to epoll_ctl failed: %s\n",
1609 MHD_socket_last_strerr_ ()); 1609 MHD_socket_last_strerr_ ());
@@ -1760,7 +1760,7 @@ MHD_resume_connection (struct MHD_Connection *connection)
1760 if ( (MHD_INVALID_PIPE_ != daemon->wpipe[1]) && 1760 if ( (MHD_INVALID_PIPE_ != daemon->wpipe[1]) &&
1761 (1 != MHD_pipe_write_ (daemon->wpipe[1], "r", 1)) ) 1761 (1 != MHD_pipe_write_ (daemon->wpipe[1], "r", 1)) )
1762 { 1762 {
1763#if HAVE_MESSAGES 1763#ifdef HAVE_MESSAGES
1764 MHD_DLOG (daemon, 1764 MHD_DLOG (daemon,
1765 "failed to signal resume via pipe"); 1765 "failed to signal resume via pipe");
1766#endif 1766#endif
@@ -1853,7 +1853,7 @@ make_nonblocking_noninheritable (struct MHD_Daemon *daemon,
1853 1853
1854 if (0 != ioctlsocket (sock, FIONBIO, &flags)) 1854 if (0 != ioctlsocket (sock, FIONBIO, &flags))
1855 { 1855 {
1856#if HAVE_MESSAGES 1856#ifdef HAVE_MESSAGES
1857 MHD_DLOG (daemon, 1857 MHD_DLOG (daemon,
1858 "Failed to make socket non-blocking: %s\n", 1858 "Failed to make socket non-blocking: %s\n",
1859 MHD_socket_last_strerr_ ()); 1859 MHD_socket_last_strerr_ ());
@@ -1863,7 +1863,7 @@ make_nonblocking_noninheritable (struct MHD_Daemon *daemon,
1863 ((dwFlags != (dwFlags & ~HANDLE_FLAG_INHERIT)) && 1863 ((dwFlags != (dwFlags & ~HANDLE_FLAG_INHERIT)) &&
1864 !SetHandleInformation ((HANDLE) sock, HANDLE_FLAG_INHERIT, 0))) 1864 !SetHandleInformation ((HANDLE) sock, HANDLE_FLAG_INHERIT, 0)))
1865 { 1865 {
1866#if HAVE_MESSAGES 1866#ifdef HAVE_MESSAGES
1867 MHD_DLOG (daemon, 1867 MHD_DLOG (daemon,
1868 "Failed to make socket non-inheritable: %u\n", 1868 "Failed to make socket non-inheritable: %u\n",
1869 (unsigned int) GetLastError ()); 1869 (unsigned int) GetLastError ());
@@ -1883,7 +1883,7 @@ make_nonblocking_noninheritable (struct MHD_Daemon *daemon,
1883 ( (flags != (flags | FD_CLOEXEC)) && 1883 ( (flags != (flags | FD_CLOEXEC)) &&
1884 (0 != fcntl (sock, F_SETFD, flags | nonblock | FD_CLOEXEC)) ) ) ) 1884 (0 != fcntl (sock, F_SETFD, flags | nonblock | FD_CLOEXEC)) ) ) )
1885 { 1885 {
1886#if HAVE_MESSAGES 1886#ifdef HAVE_MESSAGES
1887 MHD_DLOG (daemon, 1887 MHD_DLOG (daemon,
1888 "Failed to make socket non-inheritable: %s\n", 1888 "Failed to make socket non-inheritable: %s\n",
1889 MHD_socket_last_strerr_ ()); 1889 MHD_socket_last_strerr_ ());
@@ -1983,7 +1983,7 @@ MHD_accept_connection (struct MHD_Daemon *daemon)
1983#endif 1983#endif
1984 if ((MHD_INVALID_SOCKET == s) || (addrlen <= 0)) 1984 if ((MHD_INVALID_SOCKET == s) || (addrlen <= 0))
1985 { 1985 {
1986#if HAVE_MESSAGES 1986#ifdef HAVE_MESSAGES
1987 const int err = MHD_socket_errno_; 1987 const int err = MHD_socket_errno_;
1988 /* This could be a common occurance with multiple worker threads */ 1988 /* This could be a common occurance with multiple worker threads */
1989 if ( (EINVAL == err) && 1989 if ( (EINVAL == err) &&
@@ -2005,7 +2005,7 @@ MHD_accept_connection (struct MHD_Daemon *daemon)
2005#if !defined(HAVE_ACCEPT4) || HAVE_ACCEPT4+0 == 0 || !defined(HAVE_SOCK_NONBLOCK) || SOCK_CLOEXEC+0 == 0 2005#if !defined(HAVE_ACCEPT4) || HAVE_ACCEPT4+0 == 0 || !defined(HAVE_SOCK_NONBLOCK) || SOCK_CLOEXEC+0 == 0
2006 make_nonblocking_noninheritable (daemon, s); 2006 make_nonblocking_noninheritable (daemon, s);
2007#endif 2007#endif
2008#if HAVE_MESSAGES 2008#ifdef HAVE_MESSAGES
2009#if DEBUG_CONNECT 2009#if DEBUG_CONNECT
2010 MHD_DLOG (daemon, 2010 MHD_DLOG (daemon,
2011 "Accepted connection on socket %d\n", 2011 "Accepted connection on socket %d\n",
@@ -2133,7 +2133,7 @@ MHD_get_timeout (struct MHD_Daemon *daemon,
2133 2133
2134 if (0 != (daemon->options & MHD_USE_THREAD_PER_CONNECTION)) 2134 if (0 != (daemon->options & MHD_USE_THREAD_PER_CONNECTION))
2135 { 2135 {
2136#if HAVE_MESSAGES 2136#ifdef HAVE_MESSAGES
2137 MHD_DLOG (daemon, 2137 MHD_DLOG (daemon,
2138 "Illegal call to MHD_get_timeout\n"); 2138 "Illegal call to MHD_get_timeout\n");
2139#endif 2139#endif
@@ -2342,7 +2342,7 @@ MHD_select (struct MHD_Daemon *daemon,
2342 /* single-threaded, go over everything */ 2342 /* single-threaded, go over everything */
2343 if (MHD_NO == MHD_get_fdset2 (daemon, &rs, &ws, &es, &maxsock, FD_SETSIZE)) 2343 if (MHD_NO == MHD_get_fdset2 (daemon, &rs, &ws, &es, &maxsock, FD_SETSIZE))
2344 { 2344 {
2345#if HAVE_MESSAGES 2345#ifdef HAVE_MESSAGES
2346 MHD_DLOG (daemon, "Could not obtain daemon fdsets"); 2346 MHD_DLOG (daemon, "Could not obtain daemon fdsets");
2347#endif 2347#endif
2348 err_state = MHD_YES; 2348 err_state = MHD_YES;
@@ -2367,7 +2367,7 @@ MHD_select (struct MHD_Daemon *daemon,
2367 &maxsock, 2367 &maxsock,
2368 FD_SETSIZE)) ) 2368 FD_SETSIZE)) )
2369 { 2369 {
2370#if HAVE_MESSAGES 2370#ifdef HAVE_MESSAGES
2371 MHD_DLOG (daemon, "Could not add listen socket to fdset"); 2371 MHD_DLOG (daemon, "Could not add listen socket to fdset");
2372#endif 2372#endif
2373 return MHD_NO; 2373 return MHD_NO;
@@ -2392,7 +2392,7 @@ MHD_select (struct MHD_Daemon *daemon,
2392 FD_SETSIZE)) 2392 FD_SETSIZE))
2393 { 2393 {
2394#endif /* MHD_WINSOCK_SOCKETS */ 2394#endif /* MHD_WINSOCK_SOCKETS */
2395#if HAVE_MESSAGES 2395#ifdef HAVE_MESSAGES
2396 MHD_DLOG (daemon, 2396 MHD_DLOG (daemon,
2397 "Could not add control pipe FD to fdset"); 2397 "Could not add control pipe FD to fdset");
2398#endif 2398#endif
@@ -2430,7 +2430,7 @@ MHD_select (struct MHD_Daemon *daemon,
2430 { 2430 {
2431 if (EINTR == MHD_socket_errno_) 2431 if (EINTR == MHD_socket_errno_)
2432 return (MHD_NO == err_state) ? MHD_YES : MHD_NO; 2432 return (MHD_NO == err_state) ? MHD_YES : MHD_NO;
2433#if HAVE_MESSAGES 2433#ifdef HAVE_MESSAGES
2434 MHD_DLOG (daemon, 2434 MHD_DLOG (daemon,
2435 "select failed: %s\n", 2435 "select failed: %s\n",
2436 MHD_socket_last_strerr_ ()); 2436 MHD_socket_last_strerr_ ());
@@ -2481,7 +2481,7 @@ MHD_poll_all (struct MHD_Daemon *daemon,
2481 p = malloc(sizeof (struct pollfd) * (2 + num_connections)); 2481 p = malloc(sizeof (struct pollfd) * (2 + num_connections));
2482 if (NULL == p) 2482 if (NULL == p)
2483 { 2483 {
2484#if HAVE_MESSAGES 2484#ifdef HAVE_MESSAGES
2485 MHD_DLOG(daemon, 2485 MHD_DLOG(daemon,
2486 "Error allocating memory: %s\n", 2486 "Error allocating memory: %s\n",
2487 MHD_strerror_(errno)); 2487 MHD_strerror_(errno));
@@ -2554,7 +2554,7 @@ MHD_poll_all (struct MHD_Daemon *daemon,
2554 free(p); 2554 free(p);
2555 return MHD_YES; 2555 return MHD_YES;
2556 } 2556 }
2557#if HAVE_MESSAGES 2557#ifdef HAVE_MESSAGES
2558 MHD_DLOG (daemon, 2558 MHD_DLOG (daemon,
2559 "poll failed: %s\n", 2559 "poll failed: %s\n",
2560 MHD_socket_last_strerr_ ()); 2560 MHD_socket_last_strerr_ ());
@@ -2671,7 +2671,7 @@ MHD_poll_listen_socket (struct MHD_Daemon *daemon,
2671 { 2671 {
2672 if (EINTR == MHD_socket_errno_) 2672 if (EINTR == MHD_socket_errno_)
2673 return MHD_YES; 2673 return MHD_YES;
2674#if HAVE_MESSAGES 2674#ifdef HAVE_MESSAGES
2675 MHD_DLOG (daemon, 2675 MHD_DLOG (daemon,
2676 "poll failed: %s\n", 2676 "poll failed: %s\n",
2677 MHD_socket_last_strerr_ ()); 2677 MHD_socket_last_strerr_ ());
@@ -2764,7 +2764,7 @@ MHD_epoll (struct MHD_Daemon *daemon,
2764 daemon->socket_fd, 2764 daemon->socket_fd,
2765 &event)) 2765 &event))
2766 { 2766 {
2767#if HAVE_MESSAGES 2767#ifdef HAVE_MESSAGES
2768 MHD_DLOG (daemon, 2768 MHD_DLOG (daemon,
2769 "Call to epoll_ctl failed: %s\n", 2769 "Call to epoll_ctl failed: %s\n",
2770 MHD_socket_last_strerr_ ()); 2770 MHD_socket_last_strerr_ ());
@@ -2815,7 +2815,7 @@ MHD_epoll (struct MHD_Daemon *daemon,
2815 { 2815 {
2816 if (EINTR == MHD_socket_errno_) 2816 if (EINTR == MHD_socket_errno_)
2817 return MHD_YES; 2817 return MHD_YES;
2818#if HAVE_MESSAGES 2818#ifdef HAVE_MESSAGES
2819 MHD_DLOG (daemon, 2819 MHD_DLOG (daemon,
2820 "Call to epoll_wait failed: %s\n", 2820 "Call to epoll_wait failed: %s\n",
2821 MHD_socket_last_strerr_ ()); 2821 MHD_socket_last_strerr_ ());
@@ -3087,7 +3087,7 @@ MHD_quiesce_daemon (struct MHD_Daemon *daemon)
3087 if ( (MHD_INVALID_PIPE_ == daemon->wpipe[1]) && 3087 if ( (MHD_INVALID_PIPE_ == daemon->wpipe[1]) &&
3088 (0 != (daemon->options & (MHD_USE_SELECT_INTERNALLY | MHD_USE_THREAD_PER_CONNECTION))) ) 3088 (0 != (daemon->options & (MHD_USE_SELECT_INTERNALLY | MHD_USE_THREAD_PER_CONNECTION))) )
3089 { 3089 {
3090#if HAVE_MESSAGES 3090#ifdef HAVE_MESSAGES
3091 MHD_DLOG (daemon, 3091 MHD_DLOG (daemon,
3092 "Using MHD_quiesce_daemon in this mode requires MHD_USE_PIPE_FOR_SHUTDOWN\n"); 3092 "Using MHD_quiesce_daemon in this mode requires MHD_USE_PIPE_FOR_SHUTDOWN\n");
3093#endif 3093#endif
@@ -3241,7 +3241,7 @@ parse_options_va (struct MHD_Daemon *daemon,
3241 daemon->worker_pool_size = va_arg (ap, unsigned int); 3241 daemon->worker_pool_size = va_arg (ap, unsigned int);
3242 if (daemon->worker_pool_size >= (SIZE_MAX / sizeof (struct MHD_Daemon))) 3242 if (daemon->worker_pool_size >= (SIZE_MAX / sizeof (struct MHD_Daemon)))
3243 { 3243 {
3244#if HAVE_MESSAGES 3244#ifdef HAVE_MESSAGES
3245 MHD_DLOG (daemon, 3245 MHD_DLOG (daemon,
3246 "Specified thread pool size (%u) too big\n", 3246 "Specified thread pool size (%u) too big\n",
3247 daemon->worker_pool_size); 3247 daemon->worker_pool_size);
@@ -3253,7 +3253,7 @@ parse_options_va (struct MHD_Daemon *daemon,
3253 case MHD_OPTION_HTTPS_MEM_KEY: 3253 case MHD_OPTION_HTTPS_MEM_KEY:
3254 if (0 != (daemon->options & MHD_USE_SSL)) 3254 if (0 != (daemon->options & MHD_USE_SSL))
3255 daemon->https_mem_key = va_arg (ap, const char *); 3255 daemon->https_mem_key = va_arg (ap, const char *);
3256#if HAVE_MESSAGES 3256#ifdef HAVE_MESSAGES
3257 else 3257 else
3258 MHD_DLOG (daemon, 3258 MHD_DLOG (daemon,
3259 "MHD HTTPS option %d passed to MHD but MHD_USE_SSL not set\n", 3259 "MHD HTTPS option %d passed to MHD but MHD_USE_SSL not set\n",
@@ -3263,7 +3263,7 @@ parse_options_va (struct MHD_Daemon *daemon,
3263 case MHD_OPTION_HTTPS_KEY_PASSWORD: 3263 case MHD_OPTION_HTTPS_KEY_PASSWORD:
3264 if (0 != (daemon->options & MHD_USE_SSL)) 3264 if (0 != (daemon->options & MHD_USE_SSL))
3265 daemon->https_key_password = va_arg (ap, const char *); 3265 daemon->https_key_password = va_arg (ap, const char *);
3266#if HAVE_MESSAGES 3266#ifdef HAVE_MESSAGES
3267 else 3267 else
3268 MHD_DLOG (daemon, 3268 MHD_DLOG (daemon,
3269 "MHD HTTPS option %d passed to MHD but MHD_USE_SSL not set\n", 3269 "MHD HTTPS option %d passed to MHD but MHD_USE_SSL not set\n",
@@ -3273,7 +3273,7 @@ parse_options_va (struct MHD_Daemon *daemon,
3273 case MHD_OPTION_HTTPS_MEM_CERT: 3273 case MHD_OPTION_HTTPS_MEM_CERT:
3274 if (0 != (daemon->options & MHD_USE_SSL)) 3274 if (0 != (daemon->options & MHD_USE_SSL))
3275 daemon->https_mem_cert = va_arg (ap, const char *); 3275 daemon->https_mem_cert = va_arg (ap, const char *);
3276#if HAVE_MESSAGES 3276#ifdef HAVE_MESSAGES
3277 else 3277 else
3278 MHD_DLOG (daemon, 3278 MHD_DLOG (daemon,
3279 "MHD HTTPS option %d passed to MHD but MHD_USE_SSL not set\n", 3279 "MHD HTTPS option %d passed to MHD but MHD_USE_SSL not set\n",
@@ -3283,7 +3283,7 @@ parse_options_va (struct MHD_Daemon *daemon,
3283 case MHD_OPTION_HTTPS_MEM_TRUST: 3283 case MHD_OPTION_HTTPS_MEM_TRUST:
3284 if (0 != (daemon->options & MHD_USE_SSL)) 3284 if (0 != (daemon->options & MHD_USE_SSL))
3285 daemon->https_mem_trust = va_arg (ap, const char *); 3285 daemon->https_mem_trust = va_arg (ap, const char *);
3286#if HAVE_MESSAGES 3286#ifdef HAVE_MESSAGES
3287 else 3287 else
3288 MHD_DLOG (daemon, 3288 MHD_DLOG (daemon,
3289 "MHD HTTPS option %d passed to MHD but MHD_USE_SSL not set\n", 3289 "MHD HTTPS option %d passed to MHD but MHD_USE_SSL not set\n",
@@ -3301,7 +3301,7 @@ parse_options_va (struct MHD_Daemon *daemon,
3301 3301
3302 if (gnutls_dh_params_init (&daemon->https_mem_dhparams) < 0) 3302 if (gnutls_dh_params_init (&daemon->https_mem_dhparams) < 0)
3303 { 3303 {
3304#if HAVE_MESSAGES 3304#ifdef HAVE_MESSAGES
3305 MHD_DLOG(daemon, 3305 MHD_DLOG(daemon,
3306 "Error initializing DH parameters\n"); 3306 "Error initializing DH parameters\n");
3307#endif 3307#endif
@@ -3312,7 +3312,7 @@ parse_options_va (struct MHD_Daemon *daemon,
3312 if (gnutls_dh_params_import_pkcs3 (daemon->https_mem_dhparams, &dhpar, 3312 if (gnutls_dh_params_import_pkcs3 (daemon->https_mem_dhparams, &dhpar,
3313 GNUTLS_X509_FMT_PEM) < 0) 3313 GNUTLS_X509_FMT_PEM) < 0)
3314 { 3314 {
3315#if HAVE_MESSAGES 3315#ifdef HAVE_MESSAGES
3316 MHD_DLOG(daemon, 3316 MHD_DLOG(daemon,
3317 "Bad Diffie-Hellman parameters format\n"); 3317 "Bad Diffie-Hellman parameters format\n");
3318#endif 3318#endif
@@ -3323,7 +3323,7 @@ parse_options_va (struct MHD_Daemon *daemon,
3323 } 3323 }
3324 else 3324 else
3325 { 3325 {
3326#if HAVE_MESSAGES 3326#ifdef HAVE_MESSAGES
3327 MHD_DLOG (daemon, 3327 MHD_DLOG (daemon,
3328 "MHD HTTPS option %d passed to MHD but MHD_USE_SSL not set\n", 3328 "MHD HTTPS option %d passed to MHD but MHD_USE_SSL not set\n",
3329 opt); 3329 opt);
@@ -3340,7 +3340,7 @@ parse_options_va (struct MHD_Daemon *daemon,
3340 NULL); 3340 NULL);
3341 if (GNUTLS_E_SUCCESS != ret) 3341 if (GNUTLS_E_SUCCESS != ret)
3342 { 3342 {
3343#if HAVE_MESSAGES 3343#ifdef HAVE_MESSAGES
3344 MHD_DLOG (daemon, 3344 MHD_DLOG (daemon,
3345 "Setting priorities to `%s' failed: %s\n", 3345 "Setting priorities to `%s' failed: %s\n",
3346 pstr, 3346 pstr,
@@ -3353,7 +3353,7 @@ parse_options_va (struct MHD_Daemon *daemon,
3353 break; 3353 break;
3354 case MHD_OPTION_HTTPS_CERT_CALLBACK: 3354 case MHD_OPTION_HTTPS_CERT_CALLBACK:
3355#if GNUTLS_VERSION_MAJOR < 3 3355#if GNUTLS_VERSION_MAJOR < 3
3356#if HAVE_MESSAGES 3356#ifdef HAVE_MESSAGES
3357 MHD_DLOG (daemon, 3357 MHD_DLOG (daemon,
3358 "MHD_OPTION_HTTPS_CERT_CALLBACK requires building MHD with GnuTLS >= 3.0\n"); 3358 "MHD_OPTION_HTTPS_CERT_CALLBACK requires building MHD with GnuTLS >= 3.0\n");
3359#endif 3359#endif
@@ -3377,7 +3377,7 @@ parse_options_va (struct MHD_Daemon *daemon,
3377 daemon->socket_fd = va_arg (ap, MHD_socket); 3377 daemon->socket_fd = va_arg (ap, MHD_socket);
3378 break; 3378 break;
3379 case MHD_OPTION_EXTERNAL_LOGGER: 3379 case MHD_OPTION_EXTERNAL_LOGGER:
3380#if HAVE_MESSAGES 3380#ifdef HAVE_MESSAGES
3381 daemon->custom_error_log = 3381 daemon->custom_error_log =
3382 va_arg (ap, VfprintfFunctionPointerType); 3382 va_arg (ap, VfprintfFunctionPointerType);
3383 daemon->custom_error_log_cls = va_arg (ap, void *); 3383 daemon->custom_error_log_cls = va_arg (ap, void *);
@@ -3505,7 +3505,7 @@ parse_options_va (struct MHD_Daemon *daemon,
3505 daemon->unescape_callback_cls = va_arg (ap, void *); 3505 daemon->unescape_callback_cls = va_arg (ap, void *);
3506 break; 3506 break;
3507 default: 3507 default:
3508#if HAVE_MESSAGES 3508#ifdef HAVE_MESSAGES
3509 if (((opt >= MHD_OPTION_HTTPS_MEM_KEY) && 3509 if (((opt >= MHD_OPTION_HTTPS_MEM_KEY) &&
3510 (opt <= MHD_OPTION_HTTPS_PRIORITIES)) || (opt == MHD_OPTION_HTTPS_MEM_TRUST)) 3510 (opt <= MHD_OPTION_HTTPS_PRIORITIES)) || (opt == MHD_OPTION_HTTPS_MEM_TRUST))
3511 { 3511 {
@@ -3578,7 +3578,7 @@ setup_epoll_to_listen (struct MHD_Daemon *daemon)
3578#endif /* !HAVE_EPOLL_CREATE1 */ 3578#endif /* !HAVE_EPOLL_CREATE1 */
3579 if (-1 == daemon->epoll_fd) 3579 if (-1 == daemon->epoll_fd)
3580 { 3580 {
3581#if HAVE_MESSAGES 3581#ifdef HAVE_MESSAGES
3582 MHD_DLOG (daemon, 3582 MHD_DLOG (daemon,
3583 "Call to epoll_create1 failed: %s\n", 3583 "Call to epoll_create1 failed: %s\n",
3584 MHD_socket_last_strerr_ ()); 3584 MHD_socket_last_strerr_ ());
@@ -3591,7 +3591,7 @@ setup_epoll_to_listen (struct MHD_Daemon *daemon)
3591 int fdflags = fcntl (daemon->epoll_fd, F_GETFD); 3591 int fdflags = fcntl (daemon->epoll_fd, F_GETFD);
3592 if (0 > fdflags || 0 > fcntl (daemon->epoll_fd, F_SETFD, fdflags | FD_CLOEXEC)) 3592 if (0 > fdflags || 0 > fcntl (daemon->epoll_fd, F_SETFD, fdflags | FD_CLOEXEC))
3593 { 3593 {
3594#if HAVE_MESSAGES 3594#ifdef HAVE_MESSAGES
3595 MHD_DLOG (daemon, 3595 MHD_DLOG (daemon,
3596 "Failed to change flags on epoll fd: %s\n", 3596 "Failed to change flags on epoll fd: %s\n",
3597 MHD_socket_last_strerr_ ()); 3597 MHD_socket_last_strerr_ ());
@@ -3611,7 +3611,7 @@ setup_epoll_to_listen (struct MHD_Daemon *daemon)
3611 daemon->socket_fd, 3611 daemon->socket_fd,
3612 &event)) 3612 &event))
3613 { 3613 {
3614#if HAVE_MESSAGES 3614#ifdef HAVE_MESSAGES
3615 MHD_DLOG (daemon, 3615 MHD_DLOG (daemon,
3616 "Call to epoll_ctl failed: %s\n", 3616 "Call to epoll_ctl failed: %s\n",
3617 MHD_socket_last_strerr_ ()); 3617 MHD_socket_last_strerr_ ());
@@ -3629,7 +3629,7 @@ setup_epoll_to_listen (struct MHD_Daemon *daemon)
3629 daemon->wpipe[0], 3629 daemon->wpipe[0],
3630 &event)) 3630 &event))
3631 { 3631 {
3632#if HAVE_MESSAGES 3632#ifdef HAVE_MESSAGES
3633 MHD_DLOG (daemon, 3633 MHD_DLOG (daemon,
3634 "Call to epoll_ctl failed: %s\n", 3634 "Call to epoll_ctl failed: %s\n",
3635 MHD_socket_last_strerr_ ()); 3635 MHD_socket_last_strerr_ ());
@@ -3740,7 +3740,7 @@ MHD_start_daemon_va (unsigned int flags,
3740#else /* !SOMAXCONN */ 3740#else /* !SOMAXCONN */
3741 daemon->listen_backlog_size = 511; /* should be safe value */ 3741 daemon->listen_backlog_size = 511; /* should be safe value */
3742#endif /* !SOMAXCONN */ 3742#endif /* !SOMAXCONN */
3743#if HAVE_MESSAGES 3743#ifdef HAVE_MESSAGES
3744 daemon->custom_error_log = (MHD_LogCallback) &vfprintf; 3744 daemon->custom_error_log = (MHD_LogCallback) &vfprintf;
3745 daemon->custom_error_log_cls = stderr; 3745 daemon->custom_error_log_cls = stderr;
3746#endif 3746#endif
@@ -3753,7 +3753,7 @@ MHD_start_daemon_va (unsigned int flags,
3753 use_pipe = 0; /* useless if we are using 'external' select */ 3753 use_pipe = 0; /* useless if we are using 'external' select */
3754 if ( (use_pipe) && (0 != MHD_pipe_ (daemon->wpipe)) ) 3754 if ( (use_pipe) && (0 != MHD_pipe_ (daemon->wpipe)) )
3755 { 3755 {
3756#if HAVE_MESSAGES 3756#ifdef HAVE_MESSAGES
3757 MHD_DLOG (daemon, 3757 MHD_DLOG (daemon,
3758 "Failed to create control pipe: %s\n", 3758 "Failed to create control pipe: %s\n",
3759 MHD_strerror_ (errno)); 3759 MHD_strerror_ (errno));
@@ -3766,7 +3766,7 @@ MHD_start_daemon_va (unsigned int flags,
3766 (1 == use_pipe) && 3766 (1 == use_pipe) &&
3767 (daemon->wpipe[0] >= FD_SETSIZE) ) 3767 (daemon->wpipe[0] >= FD_SETSIZE) )
3768 { 3768 {
3769#if HAVE_MESSAGES 3769#ifdef HAVE_MESSAGES
3770 MHD_DLOG (daemon, 3770 MHD_DLOG (daemon,
3771 "file descriptor for control pipe exceeds maximum value\n"); 3771 "file descriptor for control pipe exceeds maximum value\n");
3772#endif 3772#endif
@@ -3807,7 +3807,7 @@ MHD_start_daemon_va (unsigned int flags,
3807 if ( ( (size_t) (daemon->nonce_nc_size * sizeof (struct MHD_NonceNc))) / 3807 if ( ( (size_t) (daemon->nonce_nc_size * sizeof (struct MHD_NonceNc))) /
3808 sizeof(struct MHD_NonceNc) != daemon->nonce_nc_size) 3808 sizeof(struct MHD_NonceNc) != daemon->nonce_nc_size)
3809 { 3809 {
3810#if HAVE_MESSAGES 3810#ifdef HAVE_MESSAGES
3811 MHD_DLOG (daemon, 3811 MHD_DLOG (daemon,
3812 "Specified value for NC_SIZE too large\n"); 3812 "Specified value for NC_SIZE too large\n");
3813#endif 3813#endif
@@ -3821,7 +3821,7 @@ MHD_start_daemon_va (unsigned int flags,
3821 daemon->nnc = malloc (daemon->nonce_nc_size * sizeof (struct MHD_NonceNc)); 3821 daemon->nnc = malloc (daemon->nonce_nc_size * sizeof (struct MHD_NonceNc));
3822 if (NULL == daemon->nnc) 3822 if (NULL == daemon->nnc)
3823 { 3823 {
3824#if HAVE_MESSAGES 3824#ifdef HAVE_MESSAGES
3825 MHD_DLOG (daemon, 3825 MHD_DLOG (daemon,
3826 "Failed to allocate memory for nonce-nc map: %s\n", 3826 "Failed to allocate memory for nonce-nc map: %s\n",
3827 MHD_strerror_ (errno)); 3827 MHD_strerror_ (errno));
@@ -3837,7 +3837,7 @@ MHD_start_daemon_va (unsigned int flags,
3837 3837
3838 if (MHD_YES != MHD_mutex_create_ (&daemon->nnc_lock)) 3838 if (MHD_YES != MHD_mutex_create_ (&daemon->nnc_lock))
3839 { 3839 {
3840#if HAVE_MESSAGES 3840#ifdef HAVE_MESSAGES
3841 MHD_DLOG (daemon, 3841 MHD_DLOG (daemon,
3842 "MHD failed to initialize nonce-nc mutex\n"); 3842 "MHD failed to initialize nonce-nc mutex\n");
3843#endif 3843#endif
@@ -3855,7 +3855,7 @@ MHD_start_daemon_va (unsigned int flags,
3855 if ( (0 == (flags & MHD_USE_SELECT_INTERNALLY)) && 3855 if ( (0 == (flags & MHD_USE_SELECT_INTERNALLY)) &&
3856 (daemon->worker_pool_size > 0) ) 3856 (daemon->worker_pool_size > 0) )
3857 { 3857 {
3858#if HAVE_MESSAGES 3858#ifdef HAVE_MESSAGES
3859 MHD_DLOG (daemon, 3859 MHD_DLOG (daemon,
3860 "MHD thread pooling only works with MHD_USE_SELECT_INTERNALLY\n"); 3860 "MHD thread pooling only works with MHD_USE_SELECT_INTERNALLY\n");
3861#endif 3861#endif
@@ -3865,7 +3865,7 @@ MHD_start_daemon_va (unsigned int flags,
3865 if ( (MHD_USE_SUSPEND_RESUME == (flags & MHD_USE_SUSPEND_RESUME)) && 3865 if ( (MHD_USE_SUSPEND_RESUME == (flags & MHD_USE_SUSPEND_RESUME)) &&
3866 (0 != (flags & MHD_USE_THREAD_PER_CONNECTION)) ) 3866 (0 != (flags & MHD_USE_THREAD_PER_CONNECTION)) )
3867 { 3867 {
3868#if HAVE_MESSAGES 3868#ifdef HAVE_MESSAGES
3869 MHD_DLOG (daemon, 3869 MHD_DLOG (daemon,
3870 "Combining MHD_USE_THREAD_PER_CONNECTION and MHD_USE_SUSPEND_RESUME is not supported.\n"); 3870 "Combining MHD_USE_THREAD_PER_CONNECTION and MHD_USE_SUSPEND_RESUME is not supported.\n");
3871#endif 3871#endif
@@ -3875,7 +3875,7 @@ MHD_start_daemon_va (unsigned int flags,
3875#ifdef __SYMBIAN32__ 3875#ifdef __SYMBIAN32__
3876 if (0 != (flags & (MHD_USE_SELECT_INTERNALLY | MHD_USE_THREAD_PER_CONNECTION))) 3876 if (0 != (flags & (MHD_USE_SELECT_INTERNALLY | MHD_USE_THREAD_PER_CONNECTION)))
3877 { 3877 {
3878#if HAVE_MESSAGES 3878#ifdef HAVE_MESSAGES
3879 MHD_DLOG (daemon, 3879 MHD_DLOG (daemon,
3880 "Threaded operations are not supported on Symbian.\n"); 3880 "Threaded operations are not supported on Symbian.\n");
3881#endif 3881#endif
@@ -3894,7 +3894,7 @@ MHD_start_daemon_va (unsigned int flags,
3894 PF_INET, SOCK_STREAM, 0); 3894 PF_INET, SOCK_STREAM, 0);
3895 if (MHD_INVALID_SOCKET == socket_fd) 3895 if (MHD_INVALID_SOCKET == socket_fd)
3896 { 3896 {
3897#if HAVE_MESSAGES 3897#ifdef HAVE_MESSAGES
3898 MHD_DLOG (daemon, 3898 MHD_DLOG (daemon,
3899 "Call to socket failed: %s\n", 3899 "Call to socket failed: %s\n",
3900 MHD_socket_last_strerr_ ()); 3900 MHD_socket_last_strerr_ ());
@@ -3912,7 +3912,7 @@ MHD_start_daemon_va (unsigned int flags,
3912 SO_REUSEADDR, 3912 SO_REUSEADDR,
3913 (void*)&on, sizeof (on))) 3913 (void*)&on, sizeof (on)))
3914 { 3914 {
3915#if HAVE_MESSAGES 3915#ifdef HAVE_MESSAGES
3916 MHD_DLOG (daemon, 3916 MHD_DLOG (daemon,
3917 "setsockopt failed: %s\n", 3917 "setsockopt failed: %s\n",
3918 MHD_socket_last_strerr_ ()); 3918 MHD_socket_last_strerr_ ());
@@ -3933,7 +3933,7 @@ MHD_start_daemon_va (unsigned int flags,
3933 SO_REUSEADDR, 3933 SO_REUSEADDR,
3934 (void*)&on, sizeof (on))) 3934 (void*)&on, sizeof (on)))
3935 { 3935 {
3936#if HAVE_MESSAGES 3936#ifdef HAVE_MESSAGES
3937 MHD_DLOG (daemon, 3937 MHD_DLOG (daemon,
3938 "setsockopt failed: %s\n", 3938 "setsockopt failed: %s\n",
3939 MHD_socket_last_strerr_ ()); 3939 MHD_socket_last_strerr_ ());
@@ -3955,7 +3955,7 @@ MHD_start_daemon_va (unsigned int flags,
3955 SO_REUSEPORT, 3955 SO_REUSEPORT,
3956 (void*)&on, sizeof (on))) 3956 (void*)&on, sizeof (on)))
3957 { 3957 {
3958#if HAVE_MESSAGES 3958#ifdef HAVE_MESSAGES
3959 MHD_DLOG (daemon, 3959 MHD_DLOG (daemon,
3960 "setsockopt failed: %s\n", 3960 "setsockopt failed: %s\n",
3961 MHD_socket_last_strerr_ ()); 3961 MHD_socket_last_strerr_ ());
@@ -3965,7 +3965,7 @@ MHD_start_daemon_va (unsigned int flags,
3965#else 3965#else
3966 /* we're supposed to allow address:port re-use, but 3966 /* we're supposed to allow address:port re-use, but
3967 on this platform we cannot; fail hard */ 3967 on this platform we cannot; fail hard */
3968#if HAVE_MESSAGES 3968#ifdef HAVE_MESSAGES
3969 MHD_DLOG (daemon, 3969 MHD_DLOG (daemon,
3970 "Cannot allow listening address reuse: SO_REUSEPORT not defined\n"); 3970 "Cannot allow listening address reuse: SO_REUSEPORT not defined\n");
3971#endif 3971#endif
@@ -3986,7 +3986,7 @@ MHD_start_daemon_va (unsigned int flags,
3986 SO_EXCLUSIVEADDRUSE, 3986 SO_EXCLUSIVEADDRUSE,
3987 (void*)&on, sizeof (on))) 3987 (void*)&on, sizeof (on)))
3988 { 3988 {
3989#if HAVE_MESSAGES 3989#ifdef HAVE_MESSAGES
3990 MHD_DLOG (daemon, 3990 MHD_DLOG (daemon,
3991 "setsockopt failed: %s\n", 3991 "setsockopt failed: %s\n",
3992 MHD_socket_last_strerr_ ()); 3992 MHD_socket_last_strerr_ ());
@@ -3994,7 +3994,7 @@ MHD_start_daemon_va (unsigned int flags,
3994 goto free_and_fail; 3994 goto free_and_fail;
3995 } 3995 }
3996#else /* SO_EXCLUSIVEADDRUSE not defined on W32? */ 3996#else /* SO_EXCLUSIVEADDRUSE not defined on W32? */
3997#if HAVE_MESSAGES 3997#ifdef HAVE_MESSAGES
3998 MHD_DLOG (daemon, 3998 MHD_DLOG (daemon,
3999 "Cannot disallow listening address reuse: SO_EXCLUSIVEADDRUSE not defined\n"); 3999 "Cannot disallow listening address reuse: SO_EXCLUSIVEADDRUSE not defined\n");
4000#endif 4000#endif
@@ -4051,7 +4051,7 @@ MHD_start_daemon_va (unsigned int flags,
4051 IPPROTO_IPV6, IPV6_V6ONLY, 4051 IPPROTO_IPV6, IPV6_V6ONLY,
4052 (const void*)&v6_only, sizeof (v6_only))) 4052 (const void*)&v6_only, sizeof (v6_only)))
4053 { 4053 {
4054#if HAVE_MESSAGES 4054#ifdef HAVE_MESSAGES
4055 MHD_DLOG (daemon, 4055 MHD_DLOG (daemon,
4056 "setsockopt failed: %s\n", 4056 "setsockopt failed: %s\n",
4057 MHD_socket_last_strerr_ ()); 4057 MHD_socket_last_strerr_ ());
@@ -4062,7 +4062,7 @@ MHD_start_daemon_va (unsigned int flags,
4062 } 4062 }
4063 if (-1 == bind (socket_fd, servaddr, addrlen)) 4063 if (-1 == bind (socket_fd, servaddr, addrlen))
4064 { 4064 {
4065#if HAVE_MESSAGES 4065#ifdef HAVE_MESSAGES
4066 MHD_DLOG (daemon, 4066 MHD_DLOG (daemon,
4067 "Failed to bind to port %u: %s\n", 4067 "Failed to bind to port %u: %s\n",
4068 (unsigned int) port, 4068 (unsigned int) port,
@@ -4082,7 +4082,7 @@ MHD_start_daemon_va (unsigned int flags,
4082 &daemon->fastopen_queue_size, 4082 &daemon->fastopen_queue_size,
4083 sizeof (daemon->fastopen_queue_size))) 4083 sizeof (daemon->fastopen_queue_size)))
4084 { 4084 {
4085#if HAVE_MESSAGES 4085#ifdef HAVE_MESSAGES
4086 MHD_DLOG (daemon, 4086 MHD_DLOG (daemon,
4087 "setsockopt failed: %s\n", 4087 "setsockopt failed: %s\n",
4088 MHD_socket_last_strerr_ ()); 4088 MHD_socket_last_strerr_ ());
@@ -4096,7 +4096,7 @@ MHD_start_daemon_va (unsigned int flags,
4096 int sk_flags = fcntl (socket_fd, F_GETFL); 4096 int sk_flags = fcntl (socket_fd, F_GETFL);
4097 if (0 != fcntl (socket_fd, F_SETFL, sk_flags | O_NONBLOCK)) 4097 if (0 != fcntl (socket_fd, F_SETFL, sk_flags | O_NONBLOCK))
4098 { 4098 {
4099#if HAVE_MESSAGES 4099#ifdef HAVE_MESSAGES
4100 MHD_DLOG (daemon, 4100 MHD_DLOG (daemon,
4101 "Failed to make listen socket non-blocking: %s\n", 4101 "Failed to make listen socket non-blocking: %s\n",
4102 MHD_socket_last_strerr_ ()); 4102 MHD_socket_last_strerr_ ());
@@ -4109,7 +4109,7 @@ MHD_start_daemon_va (unsigned int flags,
4109#endif 4109#endif
4110 if (listen (socket_fd, daemon->listen_backlog_size) < 0) 4110 if (listen (socket_fd, daemon->listen_backlog_size) < 0)
4111 { 4111 {
4112#if HAVE_MESSAGES 4112#ifdef HAVE_MESSAGES
4113 MHD_DLOG (daemon, 4113 MHD_DLOG (daemon,
4114 "Failed to listen for connections: %s\n", 4114 "Failed to listen for connections: %s\n",
4115 MHD_socket_last_strerr_ ()); 4115 MHD_socket_last_strerr_ ());
@@ -4127,7 +4127,7 @@ MHD_start_daemon_va (unsigned int flags,
4127 if ( (socket_fd >= FD_SETSIZE) && 4127 if ( (socket_fd >= FD_SETSIZE) &&
4128 (0 == (flags & (MHD_USE_POLL | MHD_USE_EPOLL_LINUX_ONLY)) ) ) 4128 (0 == (flags & (MHD_USE_POLL | MHD_USE_EPOLL_LINUX_ONLY)) ) )
4129 { 4129 {
4130#if HAVE_MESSAGES 4130#ifdef HAVE_MESSAGES
4131 MHD_DLOG (daemon, 4131 MHD_DLOG (daemon,
4132 "Socket descriptor larger than FD_SETSIZE: %d > %d\n", 4132 "Socket descriptor larger than FD_SETSIZE: %d > %d\n",
4133 socket_fd, 4133 socket_fd,
@@ -4146,7 +4146,7 @@ MHD_start_daemon_va (unsigned int flags,
4146 { 4146 {
4147 if (0 != (flags & MHD_USE_THREAD_PER_CONNECTION)) 4147 if (0 != (flags & MHD_USE_THREAD_PER_CONNECTION))
4148 { 4148 {
4149#if HAVE_MESSAGES 4149#ifdef HAVE_MESSAGES
4150 MHD_DLOG (daemon, 4150 MHD_DLOG (daemon,
4151 "Combining MHD_USE_THREAD_PER_CONNECTION and MHD_USE_EPOLL_LINUX_ONLY is not supported.\n"); 4151 "Combining MHD_USE_THREAD_PER_CONNECTION and MHD_USE_EPOLL_LINUX_ONLY is not supported.\n");
4152#endif 4152#endif
@@ -4158,7 +4158,7 @@ MHD_start_daemon_va (unsigned int flags,
4158#else 4158#else
4159 if (0 != (flags & MHD_USE_EPOLL_LINUX_ONLY)) 4159 if (0 != (flags & MHD_USE_EPOLL_LINUX_ONLY))
4160 { 4160 {
4161#if HAVE_MESSAGES 4161#ifdef HAVE_MESSAGES
4162 MHD_DLOG (daemon, 4162 MHD_DLOG (daemon,
4163 "epoll is not supported on this platform by this build.\n"); 4163 "epoll is not supported on this platform by this build.\n");
4164#endif 4164#endif
@@ -4168,7 +4168,7 @@ MHD_start_daemon_va (unsigned int flags,
4168 4168
4169 if (MHD_YES != MHD_mutex_create_ (&daemon->per_ip_connection_mutex)) 4169 if (MHD_YES != MHD_mutex_create_ (&daemon->per_ip_connection_mutex))
4170 { 4170 {
4171#if HAVE_MESSAGES 4171#ifdef HAVE_MESSAGES
4172 MHD_DLOG (daemon, 4172 MHD_DLOG (daemon,
4173 "MHD failed to initialize IP connection limit mutex\n"); 4173 "MHD failed to initialize IP connection limit mutex\n");
4174#endif 4174#endif
@@ -4179,7 +4179,7 @@ MHD_start_daemon_va (unsigned int flags,
4179 } 4179 }
4180 if (MHD_YES != MHD_mutex_create_ (&daemon->cleanup_connection_mutex)) 4180 if (MHD_YES != MHD_mutex_create_ (&daemon->cleanup_connection_mutex))
4181 { 4181 {
4182#if HAVE_MESSAGES 4182#ifdef HAVE_MESSAGES
4183 MHD_DLOG (daemon, 4183 MHD_DLOG (daemon,
4184 "MHD failed to initialize IP connection limit mutex\n"); 4184 "MHD failed to initialize IP connection limit mutex\n");
4185#endif 4185#endif
@@ -4194,7 +4194,7 @@ MHD_start_daemon_va (unsigned int flags,
4194 /* initialize HTTPS daemon certificate aspects & send / recv functions */ 4194 /* initialize HTTPS daemon certificate aspects & send / recv functions */
4195 if ((0 != (flags & MHD_USE_SSL)) && (0 != MHD_TLS_init (daemon))) 4195 if ((0 != (flags & MHD_USE_SSL)) && (0 != MHD_TLS_init (daemon)))
4196 { 4196 {
4197#if HAVE_MESSAGES 4197#ifdef HAVE_MESSAGES
4198 MHD_DLOG (daemon, 4198 MHD_DLOG (daemon,
4199 "Failed to initialize TLS support\n"); 4199 "Failed to initialize TLS support\n");
4200#endif 4200#endif
@@ -4213,7 +4213,7 @@ MHD_start_daemon_va (unsigned int flags,
4213 (0 != (res_thread_create = 4213 (0 != (res_thread_create =
4214 create_thread (&daemon->pid, daemon, &MHD_select_thread, daemon)))) 4214 create_thread (&daemon->pid, daemon, &MHD_select_thread, daemon))))
4215 { 4215 {
4216#if HAVE_MESSAGES 4216#ifdef HAVE_MESSAGES
4217 MHD_DLOG (daemon, 4217 MHD_DLOG (daemon,
4218 "Failed to create listen thread: %s\n", 4218 "Failed to create listen thread: %s\n",
4219 MHD_strerror_ (res_thread_create)); 4219 MHD_strerror_ (res_thread_create));
@@ -4282,7 +4282,7 @@ MHD_start_daemon_va (unsigned int flags,
4282 if ( (MHD_USE_SUSPEND_RESUME == (flags & MHD_USE_SUSPEND_RESUME)) && 4282 if ( (MHD_USE_SUSPEND_RESUME == (flags & MHD_USE_SUSPEND_RESUME)) &&
4283 (0 != MHD_pipe_ (d->wpipe)) ) 4283 (0 != MHD_pipe_ (d->wpipe)) )
4284 { 4284 {
4285#if HAVE_MESSAGES 4285#ifdef HAVE_MESSAGES
4286 MHD_DLOG (daemon, 4286 MHD_DLOG (daemon,
4287 "Failed to create worker control pipe: %s\n", 4287 "Failed to create worker control pipe: %s\n",
4288 MHD_pipe_last_strerror_() ); 4288 MHD_pipe_last_strerror_() );
@@ -4294,7 +4294,7 @@ MHD_start_daemon_va (unsigned int flags,
4294 (MHD_USE_SUSPEND_RESUME == (flags & MHD_USE_SUSPEND_RESUME)) && 4294 (MHD_USE_SUSPEND_RESUME == (flags & MHD_USE_SUSPEND_RESUME)) &&
4295 (d->wpipe[0] >= FD_SETSIZE) ) 4295 (d->wpipe[0] >= FD_SETSIZE) )
4296 { 4296 {
4297#if HAVE_MESSAGES 4297#ifdef HAVE_MESSAGES
4298 MHD_DLOG (daemon, 4298 MHD_DLOG (daemon,
4299 "File descriptor for worker control pipe exceeds maximum value\n"); 4299 "File descriptor for worker control pipe exceeds maximum value\n");
4300#endif 4300#endif
@@ -4320,7 +4320,7 @@ MHD_start_daemon_va (unsigned int flags,
4320 /* Must init cleanup connection mutex for each worker */ 4320 /* Must init cleanup connection mutex for each worker */
4321 if (MHD_YES != MHD_mutex_create_ (&d->cleanup_connection_mutex)) 4321 if (MHD_YES != MHD_mutex_create_ (&d->cleanup_connection_mutex))
4322 { 4322 {
4323#if HAVE_MESSAGES 4323#ifdef HAVE_MESSAGES
4324 MHD_DLOG (daemon, 4324 MHD_DLOG (daemon,
4325 "MHD failed to initialize cleanup connection mutex for thread worker %d\n", i); 4325 "MHD failed to initialize cleanup connection mutex for thread worker %d\n", i);
4326#endif 4326#endif
@@ -4331,7 +4331,7 @@ MHD_start_daemon_va (unsigned int flags,
4331 if (0 != (res_thread_create = 4331 if (0 != (res_thread_create =
4332 create_thread (&d->pid, daemon, &MHD_select_thread, d))) 4332 create_thread (&d->pid, daemon, &MHD_select_thread, d)))
4333 { 4333 {
4334#if HAVE_MESSAGES 4334#ifdef HAVE_MESSAGES
4335 MHD_DLOG (daemon, 4335 MHD_DLOG (daemon,
4336 "Failed to create pool thread: %s\n", 4336 "Failed to create pool thread: %s\n",
4337 MHD_strerror_ (res_thread_create)); 4337 MHD_strerror_ (res_thread_create));
@@ -4579,7 +4579,7 @@ MHD_stop_daemon (struct MHD_Daemon *daemon)
4579#endif 4579#endif
4580 4580
4581#if DEBUG_CLOSE 4581#if DEBUG_CLOSE
4582#if HAVE_MESSAGES 4582#ifdef HAVE_MESSAGES
4583 MHD_DLOG (daemon, 4583 MHD_DLOG (daemon,
4584 "MHD listen socket shutdown\n"); 4584 "MHD listen socket shutdown\n");
4585#endif 4585#endif
@@ -4794,7 +4794,7 @@ MHD_is_feature_supported(enum MHD_FEATURE feature)
4794 switch(feature) 4794 switch(feature)
4795 { 4795 {
4796 case MHD_FEATURE_MESSGES: 4796 case MHD_FEATURE_MESSGES:
4797#if HAVE_MESSAGES 4797#ifdef HAVE_MESSAGES
4798 return MHD_YES; 4798 return MHD_YES;
4799#else 4799#else
4800 return MHD_NO; 4800 return MHD_NO;
@@ -4854,19 +4854,19 @@ MHD_is_feature_supported(enum MHD_FEATURE feature)
4854 return MHD_NO; 4854 return MHD_NO;
4855#endif 4855#endif
4856 case MHD_FEATURE_BASIC_AUTH: 4856 case MHD_FEATURE_BASIC_AUTH:
4857#if BAUTH_SUPPORT 4857#ifdef BAUTH_SUPPORT
4858 return MHD_YES; 4858 return MHD_YES;
4859#else 4859#else
4860 return MHD_NO; 4860 return MHD_NO;
4861#endif 4861#endif
4862 case MHD_FEATURE_DIGEST_AUTH: 4862 case MHD_FEATURE_DIGEST_AUTH:
4863#if DAUTH_SUPPORT 4863#ifdef DAUTH_SUPPORT
4864 return MHD_YES; 4864 return MHD_YES;
4865#else 4865#else
4866 return MHD_NO; 4866 return MHD_NO;
4867#endif 4867#endif
4868 case MHD_FEATURE_POSTPROCESSOR: 4868 case MHD_FEATURE_POSTPROCESSOR:
4869#if HAVE_POSTPROCESSOR 4869#ifdef HAVE_POSTPROCESSOR
4870 return MHD_YES; 4870 return MHD_YES;
4871#else 4871#else
4872 return MHD_NO; 4872 return MHD_NO;