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.c205
1 files changed, 98 insertions, 107 deletions
diff --git a/src/microhttpd/daemon.c b/src/microhttpd/daemon.c
index b1cb5146..6f7bfb58 100644
--- a/src/microhttpd/daemon.c
+++ b/src/microhttpd/daemon.c
@@ -1337,8 +1337,8 @@ process_urh (struct MHD_UpgradeResponseHandle *urh)
1337 if (! urh->was_closed) 1337 if (! urh->was_closed)
1338 { 1338 {
1339 MHD_DLOG (daemon, 1339 MHD_DLOG (daemon,
1340 _ ( 1340 _ ("Initiated daemon shutdown while \"upgraded\" " \
1341 "Initiated daemon shutdown while \"upgraded\" connection was not closed.\n")); 1341 "connection was not closed.\n"));
1342 } 1342 }
1343#endif 1343#endif
1344 urh->was_closed = true; 1344 urh->was_closed = true;
@@ -1352,9 +1352,9 @@ process_urh (struct MHD_UpgradeResponseHandle *urh)
1352 { 1352 {
1353#ifdef HAVE_MESSAGES 1353#ifdef HAVE_MESSAGES
1354 MHD_DLOG (daemon, 1354 MHD_DLOG (daemon,
1355 _ ("Failed to forward to application " 1355 _ ("Failed to forward to application %" PRIu64 \
1356 "%" PRIu64 \ 1356 " bytes of data received from remote side: " \
1357 " bytes of data received from remote side: application shut down socket.\n"), 1357 "application shut down socket.\n"),
1358 (uint64_t) urh->in_buffer_used); 1358 (uint64_t) urh->in_buffer_used);
1359#endif 1359#endif
1360 1360
@@ -1519,10 +1519,8 @@ process_urh (struct MHD_UpgradeResponseHandle *urh)
1519 * persistent / unrecoverable error. */ 1519 * persistent / unrecoverable error. */
1520#ifdef HAVE_MESSAGES 1520#ifdef HAVE_MESSAGES
1521 MHD_DLOG (daemon, 1521 MHD_DLOG (daemon,
1522 _ ( 1522 _ ("Failed to forward to remote client %" PRIu64 \
1523 "Failed to forward to remote client " 1523 " bytes of data received from application: %s\n"),
1524 "%" PRIu64 \
1525 " bytes of data received from application: %s\n"),
1526 (uint64_t) urh->out_buffer_used, 1524 (uint64_t) urh->out_buffer_used,
1527 gnutls_strerror ((int) res)); 1525 gnutls_strerror ((int) res));
1528#endif 1526#endif
@@ -1589,10 +1587,8 @@ process_urh (struct MHD_UpgradeResponseHandle *urh)
1589 * persistent / unrecoverable error. */ 1587 * persistent / unrecoverable error. */
1590#ifdef HAVE_MESSAGES 1588#ifdef HAVE_MESSAGES
1591 MHD_DLOG (daemon, 1589 MHD_DLOG (daemon,
1592 _ ( 1590 _ ("Failed to forward to application %" PRIu64 \
1593 "Failed to forward to application " 1591 " bytes of data received from remote side: %s\n"),
1594 "%" PRIu64 \
1595 " bytes of data received from remote side: %s\n"),
1596 (uint64_t) urh->in_buffer_used, 1592 (uint64_t) urh->in_buffer_used,
1597 MHD_socket_strerr_ (err)); 1593 MHD_socket_strerr_ (err));
1598#endif 1594#endif
@@ -1645,10 +1641,8 @@ process_urh (struct MHD_UpgradeResponseHandle *urh)
1645#ifdef HAVE_MESSAGES 1641#ifdef HAVE_MESSAGES
1646 if (0 < urh->out_buffer_used) 1642 if (0 < urh->out_buffer_used)
1647 MHD_DLOG (daemon, 1643 MHD_DLOG (daemon,
1648 _ ( 1644 _ ("Failed to forward to remote client %" PRIu64 \
1649 "Failed to forward to remote client " 1645 " bytes of data received from application: daemon shut down.\n"),
1650 "%" PRIu64 \
1651 " bytes of data received from application: daemon shut down.\n"),
1652 (uint64_t) urh->out_buffer_used); 1646 (uint64_t) urh->out_buffer_used);
1653#endif 1647#endif
1654 /* Discard any data unsent to remote. */ 1648 /* Discard any data unsent to remote. */
@@ -2254,8 +2248,8 @@ exit:
2254 { 2248 {
2255#ifdef HAVE_MESSAGES 2249#ifdef HAVE_MESSAGES
2256 MHD_DLOG (daemon, 2250 MHD_DLOG (daemon,
2257 _ ( 2251 _ ("Failed to signal thread termination via inter-thread " \
2258 "Failed to signal thread termination via inter-thread communication channel.\n")); 2252 "communication channel.\n"));
2259#endif 2253#endif
2260 } 2254 }
2261 return (MHD_THRD_RTRN_TYPE_) 0; 2255 return (MHD_THRD_RTRN_TYPE_) 0;
@@ -2361,8 +2355,8 @@ psk_gnutls_adapter (gnutls_session_t session,
2361 { 2355 {
2362#ifdef HAVE_MESSAGES 2356#ifdef HAVE_MESSAGES
2363 MHD_DLOG (daemon, 2357 MHD_DLOG (daemon,
2364 _ ( 2358 _ ("PSK authentication failed: gnutls_malloc failed to " \
2365 "PSK authentication failed: gnutls_malloc failed to allocate memory.\n")); 2359 "allocate memory.\n"));
2366#endif 2360#endif
2367 free (app_psk); 2361 free (app_psk);
2368 return -1; 2362 return -1;
@@ -2446,8 +2440,8 @@ new_connection_prepare_ (struct MHD_Daemon *daemon,
2446 /* above connection limit - reject */ 2440 /* above connection limit - reject */
2447#ifdef HAVE_MESSAGES 2441#ifdef HAVE_MESSAGES
2448 MHD_DLOG (daemon, 2442 MHD_DLOG (daemon,
2449 _ ( 2443 _ ("Server reached connection limit. " \
2450 "Server reached connection limit. Closing inbound connection.\n")); 2444 "Closing inbound connection.\n"));
2451#endif 2445#endif
2452 MHD_socket_close_chk_ (client_socket); 2446 MHD_socket_close_chk_ (client_socket);
2453#if defined(ENFILE) && (ENFILE + 0 != 0) 2447#if defined(ENFILE) && (ENFILE + 0 != 0)
@@ -2640,8 +2634,8 @@ new_connection_prepare_ (struct MHD_Daemon *daemon,
2640 default: 2634 default:
2641#ifdef HAVE_MESSAGES 2635#ifdef HAVE_MESSAGES
2642 MHD_DLOG (daemon, 2636 MHD_DLOG (daemon,
2643 _ ( 2637 _ ("Failed to setup TLS credentials: " \
2644 "Failed to setup TLS credentials: unknown credential type %d.\n"), 2638 "unknown credential type %d.\n"),
2645 daemon->cred_type); 2639 daemon->cred_type);
2646#endif 2640#endif
2647 gnutls_deinit (connection->tls_session); 2641 gnutls_deinit (connection->tls_session);
@@ -3212,15 +3206,15 @@ MHD_suspend_connection (struct MHD_Connection *connection)
3212#endif /* MHD_USE_THREADS */ 3206#endif /* MHD_USE_THREADS */
3213 3207
3214 if (0 == (daemon->options & MHD_TEST_ALLOW_SUSPEND_RESUME)) 3208 if (0 == (daemon->options & MHD_TEST_ALLOW_SUSPEND_RESUME))
3215 MHD_PANIC (_ ( 3209 MHD_PANIC (_ ("Cannot suspend connections without " \
3216 "Cannot suspend connections without enabling MHD_ALLOW_SUSPEND_RESUME!\n")); 3210 "enabling MHD_ALLOW_SUSPEND_RESUME!\n"));
3217#ifdef UPGRADE_SUPPORT 3211#ifdef UPGRADE_SUPPORT
3218 if (NULL != connection->urh) 3212 if (NULL != connection->urh)
3219 { 3213 {
3220#ifdef HAVE_MESSAGES 3214#ifdef HAVE_MESSAGES
3221 MHD_DLOG (daemon, 3215 MHD_DLOG (daemon,
3222 _ ( 3216 _ ("Error: connection scheduled for \"upgrade\" cannot " \
3223 "Error: connection scheduled for \"upgrade\" cannot be suspended.\n")); 3217 "be suspended.\n"));
3224#endif /* HAVE_MESSAGES */ 3218#endif /* HAVE_MESSAGES */
3225 return; 3219 return;
3226 } 3220 }
@@ -3252,8 +3246,8 @@ MHD_resume_connection (struct MHD_Connection *connection)
3252#endif /* MHD_USE_THREADS */ 3246#endif /* MHD_USE_THREADS */
3253 3247
3254 if (0 == (daemon->options & MHD_TEST_ALLOW_SUSPEND_RESUME)) 3248 if (0 == (daemon->options & MHD_TEST_ALLOW_SUSPEND_RESUME))
3255 MHD_PANIC (_ ( 3249 MHD_PANIC (_ ("Cannot resume connections without enabling " \
3256 "Cannot resume connections without enabling MHD_ALLOW_SUSPEND_RESUME!\n")); 3250 "MHD_ALLOW_SUSPEND_RESUME!\n"));
3257#if defined(MHD_USE_POSIX_THREADS) || defined(MHD_USE_W32_THREADS) 3251#if defined(MHD_USE_POSIX_THREADS) || defined(MHD_USE_W32_THREADS)
3258 MHD_mutex_lock_chk_ (&daemon->cleanup_connection_mutex); 3252 MHD_mutex_lock_chk_ (&daemon->cleanup_connection_mutex);
3259#endif 3253#endif
@@ -3267,8 +3261,8 @@ MHD_resume_connection (struct MHD_Connection *connection)
3267 { 3261 {
3268#ifdef HAVE_MESSAGES 3262#ifdef HAVE_MESSAGES
3269 MHD_DLOG (daemon, 3263 MHD_DLOG (daemon,
3270 _ ( 3264 _ ("Failed to signal resume via inter-thread " \
3271 "Failed to signal resume via inter-thread communication channel.\n")); 3265 "communication channel.\n"));
3272#endif 3266#endif
3273 } 3267 }
3274} 3268}
@@ -3445,8 +3439,8 @@ resume_suspended_connections (struct MHD_Daemon *daemon)
3445 { 3439 {
3446#ifdef HAVE_MESSAGES 3440#ifdef HAVE_MESSAGES
3447 MHD_DLOG (daemon, 3441 MHD_DLOG (daemon,
3448 _ ( 3442 _ ("Failed to signal resume of connection via " \
3449 "Failed to signal resume of connection via inter-thread communication channel.\n")); 3443 "inter-thread communication channel.\n"));
3450#endif 3444#endif
3451 } 3445 }
3452 } 3446 }
@@ -3559,8 +3553,7 @@ MHD_add_connection (struct MHD_Daemon *daemon,
3559 { 3553 {
3560#ifdef HAVE_MESSAGES 3554#ifdef HAVE_MESSAGES
3561 MHD_DLOG (daemon, 3555 MHD_DLOG (daemon,
3562 _ ( 3556 _ ("Failed to suppress SIGPIPE on new client socket: %s\n"),
3563 "Failed to suppress SIGPIPE on new client socket: %s\n"),
3564 MHD_socket_last_strerr_ ()); 3557 MHD_socket_last_strerr_ ());
3565#else /* ! HAVE_MESSAGES */ 3558#else /* ! HAVE_MESSAGES */
3566 (void) 0; /* Mute compiler warning */ 3559 (void) 0; /* Mute compiler warning */
@@ -3911,8 +3904,7 @@ MHD_cleanup_connections (struct MHD_Daemon *daemon)
3911 EPOLL_CTL_DEL, 3904 EPOLL_CTL_DEL,
3912 pos->socket_fd, 3905 pos->socket_fd,
3913 NULL)) 3906 NULL))
3914 MHD_PANIC (_ ( 3907 MHD_PANIC (_ ("Failed to remove FD from epoll set.\n"));
3915 "Failed to remove FD from epoll set.\n"));
3916 pos->epoll_state &= 3908 pos->epoll_state &=
3917 ~((enum MHD_EpollState) 3909 ~((enum MHD_EpollState)
3918 MHD_EPOLL_STATE_IN_EPOLL_SET); 3910 MHD_EPOLL_STATE_IN_EPOLL_SET);
@@ -5794,8 +5786,8 @@ MHD_quiesce_daemon (struct MHD_Daemon *daemon)
5794 { 5786 {
5795#ifdef HAVE_MESSAGES 5787#ifdef HAVE_MESSAGES
5796 MHD_DLOG (daemon, 5788 MHD_DLOG (daemon,
5797 _ ( 5789 _ ("Using MHD_quiesce_daemon in this mode " \
5798 "Using MHD_quiesce_daemon in this mode requires MHD_USE_ITC.\n")); 5790 "requires MHD_USE_ITC.\n"));
5799#endif 5791#endif
5800 return MHD_INVALID_SOCKET; 5792 return MHD_INVALID_SOCKET;
5801 } 5793 }
@@ -5822,8 +5814,8 @@ MHD_quiesce_daemon (struct MHD_Daemon *daemon)
5822 if (MHD_ITC_IS_VALID_ (daemon->worker_pool[i].itc)) 5814 if (MHD_ITC_IS_VALID_ (daemon->worker_pool[i].itc))
5823 { 5815 {
5824 if (! MHD_itc_activate_ (daemon->worker_pool[i].itc, "q")) 5816 if (! MHD_itc_activate_ (daemon->worker_pool[i].itc, "q"))
5825 MHD_PANIC (_ ( 5817 MHD_PANIC (_ ("Failed to signal quiesce via inter-thread " \
5826 "Failed to signal quiesce via inter-thread communication channel.\n")); 5818 "communication channel.\n"));
5827 } 5819 }
5828 } 5820 }
5829#endif 5821#endif
@@ -5845,8 +5837,8 @@ MHD_quiesce_daemon (struct MHD_Daemon *daemon)
5845#endif 5837#endif
5846 if ( (MHD_ITC_IS_VALID_ (daemon->itc)) && 5838 if ( (MHD_ITC_IS_VALID_ (daemon->itc)) &&
5847 (! MHD_itc_activate_ (daemon->itc, "q")) ) 5839 (! MHD_itc_activate_ (daemon->itc, "q")) )
5848 MHD_PANIC (_ ( 5840 MHD_PANIC (_ ("failed to signal quiesce via inter-thread " \
5849 "failed to signal quiesce via inter-thread communication channel.\n")); 5841 "communication channel.\n"));
5850 return ret; 5842 return ret;
5851} 5843}
5852 5844
@@ -6007,18 +5999,16 @@ parse_options_va (struct MHD_Daemon *daemon,
6007 { 5999 {
6008#ifdef HAVE_MESSAGES 6000#ifdef HAVE_MESSAGES
6009 MHD_DLOG (daemon, 6001 MHD_DLOG (daemon,
6010 _ ( 6002 _ ("Warning: Zero size, specified for thread pool size," \
6011 "Warning: Zero size, specified for thread pool size, is ignored. " 6003 " is ignored. Thread pool is not used.\n"));
6012 "Thread pool is not used.\n"));
6013#endif 6004#endif
6014 } 6005 }
6015 else if (1 == daemon->worker_pool_size) 6006 else if (1 == daemon->worker_pool_size)
6016 { 6007 {
6017#ifdef HAVE_MESSAGES 6008#ifdef HAVE_MESSAGES
6018 MHD_DLOG (daemon, 6009 MHD_DLOG (daemon,
6019 _ ( 6010 _ ("Warning: \"1\", specified for thread pool size, " \
6020 "Warning: \"1\", specified for thread pool size, is ignored. " 6011 "is ignored. Thread pool is not used.\n"));
6021 "Thread pool is not used.\n"));
6022#endif 6012#endif
6023 daemon->worker_pool_size = 0; 6013 daemon->worker_pool_size = 0;
6024 } 6014 }
@@ -6069,8 +6059,8 @@ parse_options_va (struct MHD_Daemon *daemon,
6069#ifdef HAVE_MESSAGES 6059#ifdef HAVE_MESSAGES
6070 else 6060 else
6071 MHD_DLOG (daemon, 6061 MHD_DLOG (daemon,
6072 _ ( 6062 _ ("MHD HTTPS option %d passed to MHD but " \
6073 "MHD HTTPS option %d passed to MHD but MHD_USE_TLS not set.\n"), 6063 "MHD_USE_TLS not set.\n"),
6074 opt); 6064 opt);
6075#endif 6065#endif
6076 break; 6066 break;
@@ -6082,8 +6072,8 @@ parse_options_va (struct MHD_Daemon *daemon,
6082#ifdef HAVE_MESSAGES 6072#ifdef HAVE_MESSAGES
6083 else 6073 else
6084 MHD_DLOG (daemon, 6074 MHD_DLOG (daemon,
6085 _ ( 6075 _ ("MHD HTTPS option %d passed to MHD but " \
6086 "MHD HTTPS option %d passed to MHD but MHD_USE_TLS not set.\n"), 6076 "MHD_USE_TLS not set.\n"),
6087 opt); 6077 opt);
6088#endif 6078#endif
6089 break; 6079 break;
@@ -6095,8 +6085,8 @@ parse_options_va (struct MHD_Daemon *daemon,
6095#ifdef HAVE_MESSAGES 6085#ifdef HAVE_MESSAGES
6096 else 6086 else
6097 MHD_DLOG (daemon, 6087 MHD_DLOG (daemon,
6098 _ ( 6088 _ ("MHD HTTPS option %d passed to MHD but " \
6099 "MHD HTTPS option %d passed to MHD but MHD_USE_TLS not set.\n"), 6089 "MHD_USE_TLS not set.\n"),
6100 opt); 6090 opt);
6101#endif 6091#endif
6102 break; 6092 break;
@@ -6108,8 +6098,8 @@ parse_options_va (struct MHD_Daemon *daemon,
6108#ifdef HAVE_MESSAGES 6098#ifdef HAVE_MESSAGES
6109 else 6099 else
6110 MHD_DLOG (daemon, 6100 MHD_DLOG (daemon,
6111 _ ( 6101 _ ("MHD HTTPS option %d passed to MHD but " \
6112 "MHD HTTPS option %d passed to MHD but MHD_USE_TLS not set.\n"), 6102 "MHD_USE_TLS not set.\n"),
6113 opt); 6103 opt);
6114#endif 6104#endif
6115 break; 6105 break;
@@ -6160,8 +6150,8 @@ parse_options_va (struct MHD_Daemon *daemon,
6160#ifdef HAVE_MESSAGES 6150#ifdef HAVE_MESSAGES
6161 else 6151 else
6162 MHD_DLOG (daemon, 6152 MHD_DLOG (daemon,
6163 _ ( 6153 _ ("MHD HTTPS option %d passed to MHD but " \
6164 "MHD HTTPS option %d passed to MHD but MHD_USE_TLS not set.\n"), 6154 "MHD_USE_TLS not set.\n"),
6165 opt); 6155 opt);
6166#endif 6156#endif
6167 break; 6157 break;
@@ -6190,8 +6180,8 @@ parse_options_va (struct MHD_Daemon *daemon,
6190#ifdef HAVE_MESSAGES 6180#ifdef HAVE_MESSAGES
6191 else 6181 else
6192 MHD_DLOG (daemon, 6182 MHD_DLOG (daemon,
6193 _ ( 6183 _ ("MHD HTTPS option %d passed to MHD but " \
6194 "MHD HTTPS option %d passed to MHD but MHD_USE_TLS not set.\n"), 6184 "MHD_USE_TLS not set.\n"),
6195 opt); 6185 opt);
6196#endif 6186#endif
6197 break; 6187 break;
@@ -6199,8 +6189,8 @@ parse_options_va (struct MHD_Daemon *daemon,
6199#if GNUTLS_VERSION_MAJOR < 3 6189#if GNUTLS_VERSION_MAJOR < 3
6200#ifdef HAVE_MESSAGES 6190#ifdef HAVE_MESSAGES
6201 MHD_DLOG (daemon, 6191 MHD_DLOG (daemon,
6202 _ ( 6192 _ ("MHD_OPTION_HTTPS_CERT_CALLBACK requires building " \
6203 "MHD_OPTION_HTTPS_CERT_CALLBACK requires building MHD with GnuTLS >= 3.0.\n")); 6193 "MHD with GnuTLS >= 3.0.\n"));
6204#endif 6194#endif
6205 return MHD_NO; 6195 return MHD_NO;
6206#else 6196#else
@@ -6211,8 +6201,8 @@ parse_options_va (struct MHD_Daemon *daemon,
6211#ifdef HAVE_MESSAGES 6201#ifdef HAVE_MESSAGES
6212 else 6202 else
6213 MHD_DLOG (daemon, 6203 MHD_DLOG (daemon,
6214 _ ( 6204 _ ("MHD HTTPS option %d passed to MHD but " \
6215 "MHD HTTPS option %d passed to MHD but MHD_USE_TLS not set.\n"), 6205 "MHD_USE_TLS not set.\n"),
6216 opt); 6206 opt);
6217#endif /* HAVE_MESSAGES */ 6207#endif /* HAVE_MESSAGES */
6218 break; 6208 break;
@@ -6221,8 +6211,8 @@ parse_options_va (struct MHD_Daemon *daemon,
6221#if GNUTLS_VERSION_NUMBER < 0x030603 6211#if GNUTLS_VERSION_NUMBER < 0x030603
6222#ifdef HAVE_MESSAGES 6212#ifdef HAVE_MESSAGES
6223 MHD_DLOG (daemon, 6213 MHD_DLOG (daemon,
6224 _ ( 6214 _ ("MHD_OPTION_HTTPS_CERT_CALLBACK2 requires building " \
6225 "MHD_OPTION_HTTPS_CERT_CALLBACK2 requires building MHD with GnuTLS >= 3.6.3.\n")); 6215 "MHD with GnuTLS >= 3.6.3.\n"));
6226#endif 6216#endif
6227 return MHD_NO; 6217 return MHD_NO;
6228#else 6218#else
@@ -6233,8 +6223,8 @@ parse_options_va (struct MHD_Daemon *daemon,
6233#ifdef HAVE_MESSAGES 6223#ifdef HAVE_MESSAGES
6234 else 6224 else
6235 MHD_DLOG (daemon, 6225 MHD_DLOG (daemon,
6236 _ ( 6226 _ ("MHD HTTPS option %d passed to MHD but " \
6237 "MHD HTTPS option %d passed to MHD but MHD_USE_TLS not set.\n"), 6227 "MHD_USE_TLS not set.\n"),
6238 opt); 6228 opt);
6239#endif /* HAVE_MESSAGES */ 6229#endif /* HAVE_MESSAGES */
6240 break; 6230 break;
@@ -6491,8 +6481,8 @@ parse_options_va (struct MHD_Daemon *daemon,
6491 break; 6481 break;
6492#else 6482#else
6493 MHD_DLOG (daemon, 6483 MHD_DLOG (daemon,
6494 _ ( 6484 _ ("MHD HTTPS option %d passed to MHD compiled " \
6495 "MHD HTTPS option %d passed to MHD compiled without GNUtls >= 3.\n"), 6485 "without GNUtls >= 3.\n"),
6496 opt); 6486 opt);
6497 return MHD_NO; 6487 return MHD_NO;
6498#endif 6488#endif
@@ -6875,10 +6865,11 @@ MHD_start_daemon_va (unsigned int flags,
6875 (0 == (flags & MHD_USE_INTERNAL_POLLING_THREAD)) ) 6865 (0 == (flags & MHD_USE_INTERNAL_POLLING_THREAD)) )
6876 { 6866 {
6877 MHD_DLOG (daemon, 6867 MHD_DLOG (daemon,
6878 _ ( 6868 _ ("Warning: MHD_USE_THREAD_PER_CONNECTION must be used " \
6879 "Warning: MHD_USE_THREAD_PER_CONNECTION must be used only with " 6869 "only with MHD_USE_INTERNAL_POLLING_THREAD. " \
6880 "MHD_USE_INTERNAL_POLLING_THREAD. Flag MHD_USE_INTERNAL_POLLING_THREAD " 6870 "Flag MHD_USE_INTERNAL_POLLING_THREAD was added. " \
6881 "was added. Consider setting MHD_USE_INTERNAL_POLLING_THREAD explicitly.\n")); 6871 "Consider setting MHD_USE_INTERNAL_POLLING_THREAD " \
6872 "explicitly.\n"));
6882 } 6873 }
6883#endif 6874#endif
6884 6875
@@ -6919,8 +6910,8 @@ MHD_start_daemon_va (unsigned int flags,
6919 { 6910 {
6920#ifdef HAVE_MESSAGES 6911#ifdef HAVE_MESSAGES
6921 MHD_DLOG (daemon, 6912 MHD_DLOG (daemon,
6922 _ ( 6913 _ ("file descriptor for inter-thread communication " \
6923 "file descriptor for inter-thread communication channel exceeds maximum value.\n")); 6914 "channel exceeds maximum value.\n"));
6924#endif 6915#endif
6925 MHD_itc_destroy_chk_ (daemon->itc); 6916 MHD_itc_destroy_chk_ (daemon->itc);
6926#ifdef HTTPS_SUPPORT 6917#ifdef HTTPS_SUPPORT
@@ -7013,8 +7004,8 @@ MHD_start_daemon_va (unsigned int flags,
7013 { 7004 {
7014#ifdef HAVE_MESSAGES 7005#ifdef HAVE_MESSAGES
7015 MHD_DLOG (daemon, 7006 MHD_DLOG (daemon,
7016 _ ( 7007 _ ("MHD thread polling only works with " \
7017 "MHD thread polling only works with MHD_USE_INTERNAL_POLLING_THREAD.\n")); 7008 "MHD_USE_INTERNAL_POLLING_THREAD.\n"));
7018#endif 7009#endif
7019 goto free_and_fail; 7010 goto free_and_fail;
7020 } 7011 }
@@ -7111,8 +7102,8 @@ MHD_start_daemon_va (unsigned int flags,
7111 on this platform we cannot; fail hard */ 7102 on this platform we cannot; fail hard */
7112#ifdef HAVE_MESSAGES 7103#ifdef HAVE_MESSAGES
7113 MHD_DLOG (daemon, 7104 MHD_DLOG (daemon,
7114 _ ( 7105 _ ("Cannot allow listening address reuse: " \
7115 "Cannot allow listening address reuse: SO_REUSEPORT not defined.\n")); 7106 "SO_REUSEPORT not defined.\n"));
7116#endif 7107#endif
7117 goto free_and_fail; 7108 goto free_and_fail;
7118#endif /* !MHD_WINSOCK_SOCKETS && !SO_REUSEPORT */ 7109#endif /* !MHD_WINSOCK_SOCKETS && !SO_REUSEPORT */
@@ -7147,8 +7138,8 @@ MHD_start_daemon_va (unsigned int flags,
7147#elif defined(MHD_WINSOCK_SOCKETS) /* SO_EXCLUSIVEADDRUSE not defined on W32? */ 7138#elif defined(MHD_WINSOCK_SOCKETS) /* SO_EXCLUSIVEADDRUSE not defined on W32? */
7148#ifdef HAVE_MESSAGES 7139#ifdef HAVE_MESSAGES
7149 MHD_DLOG (daemon, 7140 MHD_DLOG (daemon,
7150 _ ( 7141 _ ("Cannot disallow listening address reuse: " \
7151 "Cannot disallow listening address reuse: SO_EXCLUSIVEADDRUSE not defined.\n")); 7142 "SO_EXCLUSIVEADDRUSE not defined.\n"));
7152#endif 7143#endif
7153 goto free_and_fail; 7144 goto free_and_fail;
7154#endif /* MHD_WINSOCK_SOCKETS */ 7145#endif /* MHD_WINSOCK_SOCKETS */
@@ -7299,8 +7290,8 @@ MHD_start_daemon_va (unsigned int flags,
7299 /* should be impossible with `struct sockaddr_storage` */ 7290 /* should be impossible with `struct sockaddr_storage` */
7300#ifdef HAVE_MESSAGES 7291#ifdef HAVE_MESSAGES
7301 MHD_DLOG (daemon, 7292 MHD_DLOG (daemon,
7302 _ ( 7293 _ ("Failed to get listen port number " \
7303 "Failed to get listen port number (`struct sockaddr_storage` too small!?).\n")); 7294 "(`struct sockaddr_storage` too small!?).\n"));
7304#endif /* HAVE_MESSAGES */ 7295#endif /* HAVE_MESSAGES */
7305 } 7296 }
7306#ifndef __linux__ 7297#ifndef __linux__
@@ -7404,8 +7395,8 @@ MHD_start_daemon_va (unsigned int flags,
7404 { 7395 {
7405#ifdef HAVE_MESSAGES 7396#ifdef HAVE_MESSAGES
7406 MHD_DLOG (daemon, 7397 MHD_DLOG (daemon,
7407 _ ( 7398 _ ("Combining MHD_USE_THREAD_PER_CONNECTION and " \
7408 "Combining MHD_USE_THREAD_PER_CONNECTION and MHD_USE_EPOLL is not supported.\n")); 7399 "MHD_USE_EPOLL is not supported.\n"));
7409#endif 7400#endif
7410 goto free_and_fail; 7401 goto free_and_fail;
7411 } 7402 }
@@ -7569,8 +7560,8 @@ MHD_start_daemon_va (unsigned int flags,
7569 { 7560 {
7570#ifdef HAVE_MESSAGES 7561#ifdef HAVE_MESSAGES
7571 MHD_DLOG (daemon, 7562 MHD_DLOG (daemon,
7572 _ ( 7563 _ ("Failed to create worker inter-thread " \
7573 "Failed to create worker inter-thread communication channel: %s\n"), 7564 "communication channel: %s\n"),
7574 MHD_itc_last_strerror_ () ); 7565 MHD_itc_last_strerror_ () );
7575#endif 7566#endif
7576 MHD_mutex_destroy_chk_ (&d->new_connections_mutex); 7567 MHD_mutex_destroy_chk_ (&d->new_connections_mutex);
@@ -7583,8 +7574,8 @@ MHD_start_daemon_va (unsigned int flags,
7583 { 7574 {
7584#ifdef HAVE_MESSAGES 7575#ifdef HAVE_MESSAGES
7585 MHD_DLOG (daemon, 7576 MHD_DLOG (daemon,
7586 _ ( 7577 _ ("File descriptor for worker inter-thread " \
7587 "File descriptor for worker inter-thread communication channel exceeds maximum value.\n")); 7578 "communication channel exceeds maximum value.\n"));
7588#endif 7579#endif
7589 MHD_itc_destroy_chk_ (d->itc); 7580 MHD_itc_destroy_chk_ (d->itc);
7590 MHD_mutex_destroy_chk_ (&d->new_connections_mutex); 7581 MHD_mutex_destroy_chk_ (&d->new_connections_mutex);
@@ -7855,8 +7846,8 @@ close_all_connections (struct MHD_Daemon *daemon)
7855 while (NULL != susp) 7846 while (NULL != susp)
7856 { 7847 {
7857 if (NULL == susp->urh) /* "Upgraded" connection? */ 7848 if (NULL == susp->urh) /* "Upgraded" connection? */
7858 MHD_PANIC (_ ( 7849 MHD_PANIC (_ ("MHD_stop_daemon() called while we have " \
7859 "MHD_stop_daemon() called while we have suspended connections.\n")); 7850 "suspended connections.\n"));
7860#ifdef HTTPS_SUPPORT 7851#ifdef HTTPS_SUPPORT
7861 else if (used_tls && 7852 else if (used_tls &&
7862 used_thr_p_c && 7853 used_thr_p_c &&
@@ -7869,8 +7860,8 @@ close_all_connections (struct MHD_Daemon *daemon)
7869#ifdef HAVE_MESSAGES 7860#ifdef HAVE_MESSAGES
7870 if (! susp->urh->was_closed) 7861 if (! susp->urh->was_closed)
7871 MHD_DLOG (daemon, 7862 MHD_DLOG (daemon,
7872 _ ( 7863 _ ("Initiated daemon shutdown while \"upgraded\" " \
7873 "Initiated daemon shutdown while \"upgraded\" connection was not closed.\n")); 7864 "connection was not closed.\n"));
7874#endif 7865#endif
7875 susp->urh->was_closed = true; 7866 susp->urh->was_closed = true;
7876 /* If thread-per-connection is used, connection's thread 7867 /* If thread-per-connection is used, connection's thread
@@ -7888,8 +7879,8 @@ close_all_connections (struct MHD_Daemon *daemon)
7888 else /* This 'else' is combined with next 'if' */ 7879 else /* This 'else' is combined with next 'if' */
7889#endif /* UPGRADE_SUPPORT */ 7880#endif /* UPGRADE_SUPPORT */
7890 if (NULL != daemon->suspended_connections_head) 7881 if (NULL != daemon->suspended_connections_head)
7891 MHD_PANIC (_ ( 7882 MHD_PANIC (_ ("MHD_stop_daemon() called while we have " \
7892 "MHD_stop_daemon() called while we have suspended connections.\n")); 7883 "suspended connections.\n"));
7893#if defined(UPGRADE_SUPPORT) && defined(HTTPS_SUPPORT) 7884#if defined(UPGRADE_SUPPORT) && defined(HTTPS_SUPPORT)
7894#ifdef MHD_USE_THREADS 7885#ifdef MHD_USE_THREADS
7895 if (upg_allowed && used_tls && used_thr_p_c) 7886 if (upg_allowed && used_tls && used_thr_p_c)
@@ -7927,8 +7918,8 @@ close_all_connections (struct MHD_Daemon *daemon)
7927 if ( (0 != (daemon->options & MHD_USE_THREAD_PER_CONNECTION)) && 7918 if ( (0 != (daemon->options & MHD_USE_THREAD_PER_CONNECTION)) &&
7928 (MHD_ITC_IS_VALID_ (daemon->itc)) && 7919 (MHD_ITC_IS_VALID_ (daemon->itc)) &&
7929 (! MHD_itc_activate_ (daemon->itc, "e")) ) 7920 (! MHD_itc_activate_ (daemon->itc, "e")) )
7930 MHD_PANIC (_ ( 7921 MHD_PANIC (_ ("Failed to signal shutdown via inter-thread " \
7931 "Failed to signal shutdown via inter-thread communication channel.\n")); 7922 "communication channel.\n"));
7932#endif 7923#endif
7933 } 7924 }
7934 7925
@@ -8025,8 +8016,8 @@ MHD_stop_daemon (struct MHD_Daemon *daemon)
8025 { 8016 {
8026 if (! MHD_itc_activate_ (daemon->worker_pool[i].itc, 8017 if (! MHD_itc_activate_ (daemon->worker_pool[i].itc,
8027 "e")) 8018 "e"))
8028 MHD_PANIC (_ ( 8019 MHD_PANIC (_ ("Failed to signal shutdown via inter-thread " \
8029 "Failed to signal shutdown via inter-thread communication channel.\n")); 8020 "communication channel.\n"));
8030 } 8021 }
8031 else 8022 else
8032 mhd_assert (MHD_INVALID_SOCKET != fd); 8023 mhd_assert (MHD_INVALID_SOCKET != fd);
@@ -8063,8 +8054,8 @@ MHD_stop_daemon (struct MHD_Daemon *daemon)
8063 { 8054 {
8064 if (! MHD_itc_activate_ (daemon->itc, 8055 if (! MHD_itc_activate_ (daemon->itc,
8065 "e")) 8056 "e"))
8066 MHD_PANIC (_ ( 8057 MHD_PANIC (_ ("Failed to signal shutdown via inter-thread " \
8067 "Failed to signal shutdown via inter-thread communication channel.\n")); 8058 "communication channel.\n"));
8068 } 8059 }
8069 else 8060 else
8070 { 8061 {
@@ -8573,8 +8564,8 @@ MHD_init (void)
8573 gcry_check_version (NULL); 8564 gcry_check_version (NULL);
8574#else 8565#else
8575 if (NULL == gcry_check_version ("1.6.0")) 8566 if (NULL == gcry_check_version ("1.6.0"))
8576 MHD_PANIC (_ ( 8567 MHD_PANIC (_ ("libgcrypt is too old. MHD was compiled for " \
8577 "libgcrypt is too old. MHD was compiled for libgcrypt 1.6.0 or newer.\n")); 8568 "libgcrypt 1.6.0 or newer.\n"));
8578#endif 8569#endif
8579#endif /* MHD_HTTPS_REQUIRE_GCRYPT */ 8570#endif /* MHD_HTTPS_REQUIRE_GCRYPT */
8580 gnutls_global_init (); 8571 gnutls_global_init ();