summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2016-09-05 13:26:05 +0000
committerChristian Grothoff <christian@grothoff.org>2016-09-05 13:26:05 +0000
commit7a28c66c0457a17455b5c48b3b7b383a28e32d4b (patch)
tree2a530301e8465251be061346ac3464d6045b31e4
parent9b2289ae1966338c77ccea5c299a024bac53adef (diff)
-more marking of translatable messages
-rw-r--r--src/microhttpd/daemon.c822
1 files changed, 493 insertions, 329 deletions
diff --git a/src/microhttpd/daemon.c b/src/microhttpd/daemon.c
index 5351b621..30cbbd06 100644
--- a/src/microhttpd/daemon.c
+++ b/src/microhttpd/daemon.c
@@ -110,8 +110,10 @@ mhd_panic_std (void *cls,
{
#ifdef HAVE_MESSAGES
fprintf (stderr,
- "Fatal error in GNU libmicrohttpd %s:%u: %s\n",
- file, line, reason);
+ _("Fatal error in GNU libmicrohttpd %s:%u: %s\n"),
+ file,
+ line,
+ reason);
#endif
abort ();
}
@@ -193,9 +195,9 @@ struct MHD_IPCount
static void
MHD_ip_count_lock (struct MHD_Daemon *daemon)
{
- if (!MHD_mutex_lock_(&daemon->per_ip_connection_mutex))
+ if (! MHD_mutex_lock_(&daemon->per_ip_connection_mutex))
{
- MHD_PANIC ("Failed to acquire IP connection limit mutex\n");
+ MHD_PANIC (_("Failed to acquire IP connection limit mutex\n"));
}
}
@@ -208,9 +210,9 @@ MHD_ip_count_lock (struct MHD_Daemon *daemon)
static void
MHD_ip_count_unlock (struct MHD_Daemon *daemon)
{
- if (!MHD_mutex_unlock_(&daemon->per_ip_connection_mutex))
+ if (! MHD_mutex_unlock_(&daemon->per_ip_connection_mutex))
{
- MHD_PANIC ("Failed to release IP connection limit mutex\n");
+ MHD_PANIC (_("Failed to release IP connection limit mutex\n"));
}
}
@@ -225,17 +227,21 @@ MHD_ip_count_unlock (struct MHD_Daemon *daemon)
* @return -1, 0 or 1 depending on result of compare
*/
static int
-MHD_ip_addr_compare (const void *a1, const void *a2)
+MHD_ip_addr_compare (const void *a1,
+ const void *a2)
{
- return memcmp (a1, a2, offsetof (struct MHD_IPCount, count));
+ return memcmp (a1,
+ a2,
+ offsetof (struct MHD_IPCount,
+ count));
}
/**
- * Parse address and initialize 'key' using the address.
+ * Parse address and initialize @a key using the address.
*
* @param addr address to parse
- * @param addrlen number of bytes in addr
+ * @param addrlen number of bytes in @a addr
* @param key where to store the parsed address
* @return #MHD_YES on success and #MHD_NO otherwise (e.g., invalid address type)
*/
@@ -244,14 +250,19 @@ MHD_ip_addr_to_key (const struct sockaddr *addr,
socklen_t addrlen,
struct MHD_IPCount *key)
{
- memset(key, 0, sizeof(*key));
+ memset(key,
+ 0,
+ sizeof(*key));
/* IPv4 addresses */
if (sizeof (struct sockaddr_in) == addrlen)
{
const struct sockaddr_in *addr4 = (const struct sockaddr_in*) addr;
+
key->family = AF_INET;
- memcpy (&key->addr.ipv4, &addr4->sin_addr, sizeof(addr4->sin_addr));
+ memcpy (&key->addr.ipv4,
+ &addr4->sin_addr,
+ sizeof(addr4->sin_addr));
return MHD_YES;
}
@@ -260,8 +271,11 @@ MHD_ip_addr_to_key (const struct sockaddr *addr,
if (sizeof (struct sockaddr_in6) == addrlen)
{
const struct sockaddr_in6 *addr6 = (const struct sockaddr_in6*) addr;
+
key->family = AF_INET6;
- memcpy (&key->addr.ipv6, &addr6->sin6_addr, sizeof(addr6->sin6_addr));
+ memcpy (&key->addr.ipv6,
+ &addr6->sin6_addr,
+ sizeof(addr6->sin6_addr));
return MHD_YES;
}
#endif
@@ -272,11 +286,13 @@ MHD_ip_addr_to_key (const struct sockaddr *addr,
/**
- * Check if IP address is over its limit.
+ * Check if IP address is over its limit in terms of the number
+ * of allowed concurrent connections. If the IP is still allowed,
+ * increments the connection counter.
*
* @param daemon handle to daemon where connection counts are tracked
* @param addr address to add (or increment counter)
- * @param addrlen number of bytes in addr
+ * @param addrlen number of bytes in @a addr
* @return Return #MHD_YES if IP below limit, #MHD_NO if IP has surpassed limit.
* Also returns #MHD_NO if fails to allocate memory.
*/
@@ -299,7 +315,9 @@ MHD_ip_limit_add (struct MHD_Daemon *daemon,
return MHD_NO;
/* Initialize key */
- if (MHD_NO == MHD_ip_addr_to_key (addr, addrlen, key))
+ if (MHD_NO == MHD_ip_addr_to_key (addr,
+ addrlen,
+ key))
{
/* Allow unhandled address types through */
free (key);
@@ -314,7 +332,7 @@ MHD_ip_limit_add (struct MHD_Daemon *daemon,
{
#ifdef HAVE_MESSAGES
MHD_DLOG (daemon,
- "Failed to add IP connection count node\n");
+ _("Failed to add IP connection count node\n"));
#endif
MHD_ip_count_unlock (daemon);
free (key);
@@ -358,7 +376,9 @@ MHD_ip_limit_del (struct MHD_Daemon *daemon,
if (0 == daemon->per_ip_connection_limit)
return;
/* Initialize search key */
- if (MHD_NO == MHD_ip_addr_to_key (addr, addrlen, &search_key))
+ if (MHD_NO == MHD_ip_addr_to_key (addr,
+ addrlen,
+ &search_key))
return;
MHD_ip_count_lock (daemon);
@@ -370,13 +390,13 @@ MHD_ip_limit_del (struct MHD_Daemon *daemon,
{
/* Something's wrong if we couldn't find an IP address
* that was previously added */
- MHD_PANIC ("Failed to find previously-added IP address\n");
+ MHD_PANIC (_("Failed to find previously-added IP address\n"));
}
found_key = (struct MHD_IPCount *) *nodep;
/* Validate existing count for IP address */
if (0 == found_key->count)
{
- MHD_PANIC ("Previously-added IP address had 0 count\n");
+ MHD_PANIC (_("Previously-added IP address had counter of zero\n"));
}
/* Remove the node entirely if count reduces to 0 */
if (0 == --found_key->count)
@@ -505,7 +525,8 @@ MHD_init_daemon_certificate (struct MHD_Daemon *daemon)
{
cert.data = (unsigned char *) daemon->https_mem_trust;
cert.size = strlen (daemon->https_mem_trust);
- if (gnutls_certificate_set_x509_trust_mem (daemon->x509_cred, &cert,
+ if (gnutls_certificate_set_x509_trust_mem (daemon->x509_cred,
+ &cert,
GNUTLS_X509_FMT_PEM) < 0)
{
#ifdef HAVE_MESSAGES
@@ -533,22 +554,24 @@ MHD_init_daemon_certificate (struct MHD_Daemon *daemon)
if (NULL != daemon->https_key_password) {
#if GNUTLS_VERSION_NUMBER >= 0x030111
ret = gnutls_certificate_set_x509_key_mem2 (daemon->x509_cred,
- &cert, &key,
+ &cert,
+ &key,
GNUTLS_X509_FMT_PEM,
daemon->https_key_password,
0);
#else
#ifdef HAVE_MESSAGES
MHD_DLOG (daemon,
- "Failed to setup x509 certificate/key: pre 3.X.X version " \
- "of GnuTLS does not support setting key password");
+ _("Failed to setup x509 certificate/key: pre 3.X.X version " \
+ "of GnuTLS does not support setting key password"));
#endif
return -1;
#endif
}
else
ret = gnutls_certificate_set_x509_key_mem (daemon->x509_cred,
- &cert, &key,
+ &cert,
+ &key,
GNUTLS_X509_FMT_PEM);
#ifdef HAVE_MESSAGES
if (0 != ret)
@@ -589,7 +612,7 @@ MHD_TLS_init (struct MHD_Daemon *daemon)
default:
#ifdef HAVE_MESSAGES
MHD_DLOG (daemon,
- "Error: invalid credentials type %d specified.\n",
+ _("Error: invalid credentials type %d specified.\n"),
daemon->cred_type);
#endif
return -1;
@@ -829,7 +852,7 @@ MHD_get_fdset2 (struct MHD_Daemon *daemon,
#ifdef HAVE_MESSAGES
if (NULL != max_fd)
MHD_DLOG (daemon,
- "Maximum socket in select set: %d\n",
+ _("Maximum socket in select set: %d\n"),
*max_fd);
#endif
#endif
@@ -922,7 +945,7 @@ finish_upgrade_close (struct MHD_UpgradeResponseHandle *urh)
EPOLL_CTL_DEL,
connection->socket_fd,
NULL))
- MHD_PANIC ("Failed to remove FD from epoll set\n");
+ MHD_PANIC (_("Failed to remove FD from epoll set\n"));
}
if (MHD_INVALID_SOCKET != urh->mhd.socket)
{
@@ -937,9 +960,9 @@ finish_upgrade_close (struct MHD_UpgradeResponseHandle *urh)
EPOLL_CTL_DEL,
urh->mhd.socket,
NULL)) )
- MHD_PANIC ("Failed to remove FD from epoll set\n");
+ MHD_PANIC (_("Failed to remove FD from epoll set\n"));
if (0 != MHD_socket_close_ (urh->mhd.socket))
- MHD_PANIC ("close failed\n");
+ MHD_PANIC (_("close failed\n"));
}
MHD_resume_connection (connection);
MHD_connection_close_ (connection,
@@ -1133,7 +1156,7 @@ thread_main_connection_upgrade (struct MHD_Connection *con)
{
#ifdef HAVE_MESSAGES
MHD_DLOG (con->daemon,
- "Error preparing select\n");
+ _("Error preparing select\n"));
#endif
break;
}
@@ -1153,7 +1176,7 @@ thread_main_connection_upgrade (struct MHD_Connection *con)
continue;
#ifdef HAVE_MESSAGES
MHD_DLOG (con->daemon,
- "Error during select (%d): `%s'\n",
+ _("Error during select (%d): `%s'\n"),
err,
MHD_socket_strerr_ (err));
#endif
@@ -1178,7 +1201,9 @@ thread_main_connection_upgrade (struct MHD_Connection *con)
{
struct pollfd p[2];
- memset (p, 0, sizeof (struct pollfd) * 2);
+ memset (p,
+ 0,
+ sizeof (struct pollfd) * 2);
p[0].fd = urh->connection->socket_fd;
p[1].fd = urh->mhd.socket;
if (urh->in_buffer_off < urh->in_buffer_size)
@@ -1201,7 +1226,7 @@ thread_main_connection_upgrade (struct MHD_Connection *con)
continue;
#ifdef HAVE_MESSAGES
MHD_DLOG (con->daemon,
- "Error during poll: `%s'\n",
+ _("Error during poll: `%s'\n"),
MHD_socket_strerr_ (err));
#endif
break;
@@ -1362,7 +1387,7 @@ thread_main_handle_connection (void *data)
{
#ifdef HAVE_MESSAGES
MHD_DLOG (con->daemon,
- "Can't add FD to fd_set\n");
+ _("Failed to add FD to fd_set\n"));
#endif
goto exit;
}
@@ -1380,7 +1405,7 @@ thread_main_handle_connection (void *data)
continue;
#ifdef HAVE_MESSAGES
MHD_DLOG (con->daemon,
- "Error during select (%d): `%s'\n",
+ _("Error during select (%d): `%s'\n"),
err,
MHD_socket_strerr_ (err));
#endif
@@ -1389,7 +1414,8 @@ thread_main_handle_connection (void *data)
#if WINDOWS
/* drain signaling pipe before other processing */
if ( (MHD_INVALID_PIPE_ != spipe) &&
- (FD_ISSET (spipe, &rs)) )
+ (FD_ISSET (spipe,
+ &rs)) )
MHD_pipe_drain_ (spipe);
#endif
if (MHD_NO ==
@@ -1452,7 +1478,7 @@ thread_main_handle_connection (void *data)
continue;
#ifdef HAVE_MESSAGES
MHD_DLOG (con->daemon,
- "Error during poll: `%s'\n",
+ _("Error during poll: `%s'\n"),
MHD_socket_last_strerr_ ());
#endif
break;
@@ -1482,7 +1508,7 @@ thread_main_handle_connection (void *data)
#if DEBUG_CLOSE
#ifdef HAVE_MESSAGES
MHD_DLOG (con->daemon,
- "Processing thread terminating, closing connection\n");
+ _("Processing thread terminating. Closing connection\n"));
#endif
#endif
if (MHD_CONNECTION_CLOSED != con->state)
@@ -1507,7 +1533,7 @@ exit:
shutdown (con->socket_fd,
SHUT_WR);
if (0 != MHD_socket_close_ (con->socket_fd))
- MHD_PANIC ("close failed\n");
+ MHD_PANIC (_("close failed\n"));
con->socket_fd = MHD_INVALID_SOCKET;
}
return (MHD_THRD_RTRN_TYPE_) 0;
@@ -1617,11 +1643,17 @@ send_param_adapter (struct MHD_Connection *connection,
#ifndef HAVE_SENDFILE64
offset = (off_t) offsetu64;
if ( (offsetu64 <= (uint64_t) OFF_T_MAX) &&
- (0 < (ret = sendfile (connection->socket_fd, fd, &offset, left))) )
+ (0 < (ret = sendfile (connection->socket_fd,
+ fd,
+ &offset,
+ left))) )
#else /* HAVE_SENDFILE64 */
offset = (off64_t) offsetu64;
if ( (offsetu64 <= (uint64_t) OFF64_T_MAX) &&
- (0 < (ret = sendfile64 (connection->socket_fd, fd, &offset, left))) )
+ (0 < (ret = sendfile64 (connection->socket_fd,
+ fd,
+ &offset,
+ left))) )
#endif /* HAVE_SENDFILE64 */
{
/* write successful */
@@ -1635,9 +1667,11 @@ send_param_adapter (struct MHD_Connection *connection,
connection->epoll_state &= ~MHD_EPOLL_STATE_WRITE_READY;
}
#endif
- if (MHD_SCKT_ERR_IS_EINTR_ (err) || MHD_SCKT_ERR_IS_EAGAIN_ (err))
+ if (MHD_SCKT_ERR_IS_EINTR_ (err) ||
+ MHD_SCKT_ERR_IS_EAGAIN_ (err))
return 0;
- if (MHD_SCKT_ERR_IS_(err, MHD_SCKT_EBADF_))
+ if (MHD_SCKT_ERR_IS_(err,
+ MHD_SCKT_EBADF_))
return -1;
/* sendfile() failed with EINVAL if mmap()-like operations are not
supported for FD or other 'unusual' errors occurred, so we should try
@@ -1646,10 +1680,14 @@ send_param_adapter (struct MHD_Connection *connection,
http://lists.gnu.org/archive/html/libmicrohttpd/2011-02/msg00015.html */
}
#endif
- ret = (ssize_t) send (connection->socket_fd, other, (MHD_SCKT_SEND_SIZE_)i, MSG_NOSIGNAL);
+ ret = (ssize_t) send (connection->socket_fd,
+ other,
+ (MHD_SCKT_SEND_SIZE_) i,
+ MSG_NOSIGNAL);
err = MHD_socket_get_error_();
#ifdef EPOLL_SUPPORT
- if ( (0 > ret) && (MHD_SCKT_ERR_IS_EAGAIN_(err)) )
+ if ( (0 > ret) &&
+ (MHD_SCKT_ERR_IS_EAGAIN_(err)) )
{
/* EAGAIN --- no longer write-ready */
connection->epoll_state &= ~MHD_EPOLL_STATE_WRITE_READY;
@@ -1658,7 +1696,8 @@ send_param_adapter (struct MHD_Connection *connection,
/* Handle broken kernel / libc, returning -1 but not setting errno;
kill connection as that should be safe; reported on mailinglist here:
http://lists.gnu.org/archive/html/libmicrohttpd/2014-10/msg00023.html */
- if ( (0 > ret) && (0 == err) )
+ if ( (0 > ret) &&
+ (0 == err) )
MHD_socket_set_error_ (MHD_SCKT_ECONNRESET_);
return ret;
}
@@ -1727,7 +1766,8 @@ internal_add_connection (struct MHD_Daemon *daemon,
if (worker->connections < worker->connection_limit)
return internal_add_connection (worker,
client_socket,
- addr, addrlen,
+ addr,
+ addrlen,
external_add);
}
/* all pools are at their connection limit, must refuse */
@@ -1739,17 +1779,18 @@ internal_add_connection (struct MHD_Daemon *daemon,
return MHD_NO;
}
- if ( (! MHD_SCKT_FD_FITS_FDSET_(client_socket, NULL)) &&
+ if ( (! MHD_SCKT_FD_FITS_FDSET_(client_socket,
+ NULL)) &&
(0 == (daemon->options & (MHD_USE_POLL | MHD_USE_EPOLL))) )
{
#ifdef HAVE_MESSAGES
MHD_DLOG (daemon,
- "Socket descriptor larger than FD_SETSIZE: %d > %d\n",
- (int)client_socket,
- (int)FD_SETSIZE);
+ _("Socket descriptor larger than FD_SETSIZE: %d > %d\n"),
+ (int) client_socket,
+ (int) FD_SETSIZE);
#endif
if (0 != MHD_socket_close_ (client_socket))
- MHD_PANIC ("close failed\n");
+ MHD_PANIC (_("close failed\n"));
#if EINVAL
errno = EINVAL;
#endif
@@ -1760,20 +1801,22 @@ internal_add_connection (struct MHD_Daemon *daemon,
#ifdef HAVE_MESSAGES
#if DEBUG_CONNECT
MHD_DLOG (daemon,
- "Accepted connection on socket %d\n",
+ _("Accepted connection on socket %d\n"),
client_socket);
#endif
#endif
if ( (daemon->connections == daemon->connection_limit) ||
- (MHD_NO == MHD_ip_limit_add (daemon, addr, addrlen)) )
+ (MHD_NO == MHD_ip_limit_add (daemon,
+ addr,
+ addrlen)) )
{
/* above connection limit - reject */
#ifdef HAVE_MESSAGES
MHD_DLOG (daemon,
- "Server reached connection limit (closing inbound connection)\n");
+ _("Server reached connection limit. Closing inbound connection.\n"));
#endif
if (0 != MHD_socket_close_ (client_socket))
- MHD_PANIC ("close failed\n");
+ MHD_PANIC (_("close failed\n"));
#if ENFILE
errno = ENFILE;
#endif
@@ -1783,17 +1826,20 @@ internal_add_connection (struct MHD_Daemon *daemon,
/* apply connection acceptance policy if present */
if ( (NULL != daemon->apc) &&
(MHD_NO == daemon->apc (daemon->apc_cls,
- addr, addrlen)) )
+ addr,
+ addrlen)) )
{
#if DEBUG_CLOSE
#ifdef HAVE_MESSAGES
MHD_DLOG (daemon,
- "Connection rejected, closing connection\n");
+ _("Connection rejected by application. Closing connection.\n"));
#endif
#endif
if (0 != MHD_socket_close_ (client_socket))
- MHD_PANIC ("close failed\n");
- MHD_ip_limit_del (daemon, addr, addrlen);
+ MHD_PANIC (_("close failed\n"));
+ MHD_ip_limit_del (daemon,
+ addr,
+ addrlen);
#if EACCESS
errno = EACCESS;
#endif
@@ -1804,8 +1850,10 @@ internal_add_connection (struct MHD_Daemon *daemon,
#ifdef SOL_SOCKET
#ifdef SO_NOSIGPIPE
setsockopt (client_socket,
- SOL_SOCKET, SO_NOSIGPIPE,
- &on, sizeof (on));
+ SOL_SOCKET,
+ SO_NOSIGPIPE,
+ &on,
+ sizeof (on));
#endif
#endif
#endif
@@ -1820,7 +1868,9 @@ internal_add_connection (struct MHD_Daemon *daemon,
#endif
if (0 != MHD_socket_close_ (client_socket))
MHD_PANIC ("close failed\n");
- MHD_ip_limit_del (daemon, addr, addrlen);
+ MHD_ip_limit_del (daemon,
+ addr,
+ addrlen);
errno = eno;
return MHD_NO;
}
@@ -1832,12 +1882,14 @@ internal_add_connection (struct MHD_Daemon *daemon,
{
#ifdef HAVE_MESSAGES
MHD_DLOG (daemon,
- "Error allocating memory: %s\n",
+ _("Error allocating memory: %s\n"),
MHD_strerror_ (errno));
#endif
if (0 != MHD_socket_close_ (client_socket))
- MHD_PANIC ("close failed\n");
- MHD_ip_limit_del (daemon, addr, addrlen);
+ MHD_PANIC (_("close failed\n"));
+ MHD_ip_limit_del (daemon,
+ addr,
+ addrlen);
free (connection);
#if ENOMEM
errno = ENOMEM;
@@ -1851,18 +1903,22 @@ internal_add_connection (struct MHD_Daemon *daemon,
eno = errno;
#ifdef HAVE_MESSAGES
MHD_DLOG (daemon,
- "Error allocating memory: %s\n",
+ _("Error allocating memory: %s\n"),
MHD_strerror_ (errno));
#endif
if (0 != MHD_socket_close_ (client_socket))
- MHD_PANIC ("close failed\n");
- MHD_ip_limit_del (daemon, addr, addrlen);
+ MHD_PANIC (_("close failed\n"));
+ MHD_ip_limit_del (daemon,
+ addr,
+ addrlen);
MHD_pool_destroy (connection->pool);
free (connection);
errno = eno;
return MHD_NO;
}
- memcpy (connection->addr, addr, addrlen);
+ memcpy (connection->addr,
+ addr,
+ addrlen);
connection->addr_len = addrlen;
connection->socket_fd = client_socket;
connection->daemon = daemon;
@@ -1881,7 +1937,7 @@ internal_add_connection (struct MHD_Daemon *daemon,
{
#ifdef HAVE_MESSAGES
MHD_DLOG (connection->daemon,
- "Failed to set nonblocking mode on connection socket: %s\n",
+ _("Failed to set nonblocking mode on connection socket: %s\n"),
MHD_socket_last_strerr_());
#endif
}
@@ -1894,7 +1950,8 @@ internal_add_connection (struct MHD_Daemon *daemon,
connection->send_cls = &send_tls_adapter;
connection->state = MHD_TLS_CONNECTION_INIT;
MHD_set_https_callbacks (connection);
- gnutls_init (&connection->tls_session, GNUTLS_SERVER);
+ gnutls_init (&connection->tls_session,
+ GNUTLS_SERVER);
gnutls_priority_set (connection->tls_session,
daemon->priority_cache);
switch (daemon->cred_type)
@@ -1908,15 +1965,17 @@ internal_add_connection (struct MHD_Daemon *daemon,
default:
#ifdef HAVE_MESSAGES
MHD_DLOG (connection->daemon,
- "Failed to setup TLS credentials: unknown credential type %d\n",
+ _("Failed to setup TLS credentials: unknown credential type %d\n"),
daemon->cred_type);
#endif
if (0 != MHD_socket_close_ (client_socket))
MHD_PANIC ("close failed\n");
- MHD_ip_limit_del (daemon, addr, addrlen);
+ MHD_ip_limit_del (daemon,
+ addr,
+ addrlen);
free (connection->addr);
free (connection);
- MHD_PANIC ("Unknown credential type");
+ MHD_PANIC (_("Unknown credential type"));
#if EINVAL
errno = EINVAL;
#endif
@@ -1938,7 +1997,7 @@ internal_add_connection (struct MHD_Daemon *daemon,
if (0 != (daemon->options & MHD_USE_THREAD_PER_CONNECTION))
{
if (! MHD_mutex_lock_ (&daemon->cleanup_connection_mutex))
- MHD_PANIC ("Failed to acquire cleanup mutex\n");
+ MHD_PANIC (_("Failed to acquire cleanup mutex\n"));
}
else
XDLL_insert (daemon->normal_timeout_head,
@@ -1949,7 +2008,7 @@ internal_add_connection (struct MHD_Daemon *daemon,
connection);
if ( (0 != (daemon->options & MHD_USE_THREAD_PER_CONNECTION)) &&
(!MHD_mutex_unlock_ (&daemon->cleanup_connection_mutex)) )
- MHD_PANIC ("Failed to release cleanup mutex\n");
+ MHD_PANIC (_("Failed to release cleanup mutex\n"));
if (NULL != daemon->notify_connection)
daemon->notify_connection (daemon->notify_connection_cls,
@@ -1960,11 +2019,11 @@ internal_add_connection (struct MHD_Daemon *daemon,
/* attempt to create handler thread */
if (0 != (daemon->options & MHD_USE_THREAD_PER_CONNECTION))
{
- if (! MHD_create_named_thread_(&connection->pid,
- "MHD-connection",
- daemon->thread_stack_size,
- &thread_main_handle_connection,
- connection))
+ if (! MHD_create_named_thread_ (&connection->pid,
+ "MHD-connection",
+ daemon->thread_stack_size,
+ &thread_main_handle_connection,
+ connection))
{
eno = errno;
#ifdef HAVE_MESSAGES
@@ -1978,11 +2037,13 @@ internal_add_connection (struct MHD_Daemon *daemon,
else
if ( (MHD_YES == external_add) &&
(MHD_INVALID_PIPE_ != daemon->wpipe[1]) &&
- (1 != MHD_pipe_write_ (daemon->wpipe[1], "n", 1)) )
+ (1 != MHD_pipe_write_ (daemon->wpipe[1],
+ "n",
+ 1)) )
{
#ifdef HAVE_MESSAGES
MHD_DLOG (daemon,
- "failed to signal new connection via pipe");
+ _("Failed to signal new connection via pipe."));
#endif
}
#ifdef EPOLL_SUPPORT
@@ -2002,7 +2063,7 @@ internal_add_connection (struct MHD_Daemon *daemon,
eno = errno;
#ifdef HAVE_MESSAGES
MHD_DLOG (daemon,
- "Call to epoll_ctl failed: %s\n",
+ _("Call to epoll_ctl failed: %s\n"),
MHD_socket_last_strerr_ ());
#endif
goto cleanup;
@@ -2028,12 +2089,12 @@ internal_add_connection (struct MHD_Daemon *daemon,
&connection->socket_context,
MHD_CONNECTION_NOTIFY_CLOSED);
if (0 != MHD_socket_close_ (client_socket))
- MHD_PANIC ("close failed\n");
+ MHD_PANIC (_("close failed\n"));
MHD_ip_limit_del (daemon, addr, addrlen);
if (0 != (daemon->options & MHD_USE_THREAD_PER_CONNECTION))
{
if (!MHD_mutex_lock_ (&daemon->cleanup_connection_mutex))
- MHD_PANIC ("Failed to acquire cleanup mutex\n");
+ MHD_PANIC (_("Failed to acquire cleanup mutex\n"));
}
else
XDLL_remove (daemon->normal_timeout_head,
@@ -2044,7 +2105,7 @@ internal_add_connection (struct MHD_Daemon *daemon,
connection);
if ( (0 != (daemon->options & MHD_USE_THREAD_PER_CONNECTION)) &&
(!MHD_mutex_unlock_ (&daemon->cleanup_connection_mutex)) )
- MHD_PANIC ("Failed to release cleanup mutex\n");
+ MHD_PANIC (_("Failed to release cleanup mutex\n"));
MHD_pool_destroy (connection->pool);
free (connection->addr);
free (connection);
@@ -2087,11 +2148,11 @@ MHD_suspend_connection (struct MHD_Connection *connection)
daemon = connection->daemon;
if (MHD_USE_SUSPEND_RESUME != (daemon->options & MHD_USE_SUSPEND_RESUME))
- MHD_PANIC ("Cannot suspend connections without enabling MHD_USE_SUSPEND_RESUME!\n");
+ MHD_PANIC (_("Cannot suspend connections without enabling MHD_USE_SUSPEND_RESUME!\n"));
if (0 != (daemon->options & MHD_USE_THREAD_PER_CONNECTION))
{
- if (!MHD_mutex_lock_ (&daemon->cleanup_connection_mutex))
- MHD_PANIC ("Failed to acquire cleanup mutex\n");
+ if (! MHD_mutex_lock_ (&daemon->cleanup_connection_mutex))
+ MHD_PANIC (_("Failed to acquire cleanup mutex\n"));
}
else
{
@@ -2126,7 +2187,7 @@ MHD_suspend_connection (struct MHD_Connection *connection)
EPOLL_CTL_DEL,
connection->socket_fd,
NULL))
- MHD_PANIC ("Failed to remove FD from epoll set\n");
+ MHD_PANIC (_("Failed to remove FD from epoll set\n"));
connection->epoll_state &= ~MHD_EPOLL_STATE_IN_EPOLL_SET;
}
connection->epoll_state |= MHD_EPOLL_STATE_SUSPENDED;
@@ -2134,8 +2195,8 @@ MHD_suspend_connection (struct MHD_Connection *connection)
#endif
connection->suspended = MHD_YES;
if ( (0 != (daemon->options & MHD_USE_THREAD_PER_CONNECTION)) &&
- (!MHD_mutex_unlock_ (&daemon->cleanup_connection_mutex)) )
- MHD_PANIC ("Failed to release cleanup mutex\n");
+ (! MHD_mutex_unlock_ (&daemon->cleanup_connection_mutex)) )
+ MHD_PANIC (_("Failed to release cleanup mutex\n"));
}
@@ -2154,10 +2215,10 @@ MHD_resume_connection (struct MHD_Connection *connection)
daemon = connection->daemon;
if (MHD_USE_SUSPEND_RESUME != (daemon->options & MHD_USE_SUSPEND_RESUME))
- MHD_PANIC ("Cannot resume connections without enabling MHD_USE_SUSPEND_RESUME!\n");
+ MHD_PANIC (_("Cannot resume connections without enabling MHD_USE_SUSPEND_RESUME!\n"));
if ( (0 != (daemon->options & MHD_USE_THREAD_PER_CONNECTION)) &&
(! MHD_mutex_lock_ (&daemon->cleanup_connection_mutex)) )
- MHD_PANIC ("Failed to acquire cleanup mutex\n");
+ MHD_PANIC (_("Failed to acquire cleanup mutex\n"));
connection->resuming = MHD_YES;
daemon->resuming = MHD_YES;
if ( (MHD_INVALID_PIPE_ != daemon->wpipe[1]) &&
@@ -2165,12 +2226,12 @@ MHD_resume_connection (struct MHD_Connection *connection)
{
#ifdef HAVE_MESSAGES
MHD_DLOG (daemon,
- "failed to signal resume via pipe");
+ _("Failed to signal resume via pipe."));
#endif
}
if ( (0 != (daemon->options & MHD_USE_THREAD_PER_CONNECTION)) &&
(! MHD_mutex_unlock_ (&daemon->cleanup_connection_mutex)) )
- MHD_PANIC ("Failed to release cleanup mutex\n");
+ MHD_PANIC (_("Failed to release cleanup mutex\n"));
}
@@ -2190,8 +2251,8 @@ resume_suspended_connections (struct MHD_Daemon *daemon)
ret = MHD_NO;
if ( (0 != (daemon->options & MHD_USE_THREAD_PER_CONNECTION)) &&
- (!MHD_mutex_lock_ (&daemon->cleanup_connection_mutex)) )
- MHD_PANIC ("Failed to acquire cleanup mutex\n");
+ (! MHD_mutex_lock_ (&daemon->cleanup_connection_mutex)) )
+ MHD_PANIC (_("Failed to acquire cleanup mutex\n"));
if (MHD_NO != daemon->resuming)
next = daemon->suspended_connections_head;
@@ -2246,8 +2307,8 @@ resume_suspended_connections (struct MHD_Daemon *daemon)
pos->resuming = MHD_NO;
}
if ( (0 != (daemon->options & MHD_USE_THREAD_PER_CONNECTION)) &&
- (!MHD_mutex_unlock_ (&daemon->cleanup_connection_mutex)) )
- MHD_PANIC ("Failed to release cleanup mutex\n");
+ (! MHD_mutex_unlock_ (&daemon->cleanup_connection_mutex)) )
+ MHD_PANIC (_("Failed to release cleanup mutex\n"));
return ret;
}
@@ -2295,7 +2356,7 @@ MHD_add_connection (struct MHD_Daemon *daemon,
{
#ifdef HAVE_MESSAGES
MHD_DLOG (daemon,
- "Failed to set nonblocking mode on new client socket: %s\n",
+ _("Failed to set nonblocking mode on new client socket: %s\n"),
MHD_socket_last_strerr_());
#endif
}
@@ -2303,13 +2364,14 @@ MHD_add_connection (struct MHD_Daemon *daemon,
{
#ifdef HAVE_MESSAGES
MHD_DLOG (daemon,
- "Failed to set noninheritable mode on new client socket.\n");
+ _("Failed to set noninheritable mode on new client socket.\n"));
#endif
}
}
return internal_add_connection (daemon,
client_socket,
- addr, addrlen,
+ addr,
+ addrlen,
MHD_YES);
}
@@ -2340,19 +2402,29 @@ MHD_accept_connection (struct MHD_Daemon *daemon)
MHD_socket fd;
addrlen = sizeof (addrstorage);
- memset (addr, 0, sizeof (addrstorage));
+ memset (addr,
+ 0,
+ sizeof (addrstorage));
if (MHD_INVALID_SOCKET == (fd = daemon->socket_fd))
return MHD_NO;
#ifdef USE_ACCEPT4
- s = accept4 (fd, addr, &addrlen, MAYBE_SOCK_CLOEXEC | MAYBE_SOCK_NONBLOCK);
+ s = accept4 (fd,
+ addr,
+ &addrlen,
+ MAYBE_SOCK_CLOEXEC | MAYBE_SOCK_NONBLOCK);
#else /* ! USE_ACCEPT4 */
- s = accept (fd, addr, &addrlen);
+ s = accept (fd,
+ addr,
+ &addrlen);
#endif /* ! USE_ACCEPT4 */
- if ((MHD_INVALID_SOCKET == s) || (addrlen <= 0))
+ if ( (MHD_INVALID_SOCKET == s) ||
+ (addrlen <= 0) )
{
const int err = MHD_socket_get_error_ ();
+
/* This could be a common occurance with multiple worker threads */
- if ( (MHD_SCKT_ERR_IS_ (err, MHD_SCKT_EINVAL_)) &&
+ if ( (MHD_SCKT_ERR_IS_ (err,
+ MHD_SCKT_EINVAL_)) &&
(MHD_INVALID_SOCKET == daemon->socket_fd) )
return MHD_NO; /* can happen during shutdown */
if (MHD_SCKT_ERR_IS_DISCNN_BEFORE_ACCEPT_(err))
@@ -2360,13 +2432,13 @@ MHD_accept_connection (struct MHD_Daemon *daemon)
#ifdef HAVE_MESSAGES
if (! MHD_SCKT_ERR_IS_EAGAIN_ (err) )
MHD_DLOG (daemon,
- "Error accepting connection: %s\n",
+ _("Error accepting connection: %s\n"),
MHD_socket_strerr_(err));
#endif
if (MHD_INVALID_SOCKET != s)
{
if (0 != MHD_socket_close_ (s))
- MHD_PANIC ("close failed\n");
+ MHD_PANIC (_("close failed\n"));
/* just in case */
}
if ( MHD_SCKT_ERR_IS_LOW_RESOURCES_ (err) )
@@ -2379,7 +2451,7 @@ MHD_accept_connection (struct MHD_Daemon *daemon)
would ever be cleared. Instead trying to produce
bit fat ugly warning. */
MHD_DLOG (daemon,
- "Hit process or system resource limit at FIRST connection. This is really bad as there is no sane way to proceed. Will try busy waiting for system resources to become magically available.\n");
+ _("Hit process or system resource limit at FIRST connection. This is really bad as there is no sane way to proceed. Will try busy waiting for system resources to become magically available.\n"));
#endif
}
else
@@ -2387,7 +2459,7 @@ MHD_accept_connection (struct MHD_Daemon *daemon)
daemon->at_limit = MHD_YES;
#ifdef HAVE_MESSAGES
MHD_DLOG (daemon,
- "Hit process or system resource limit at %u connections, temporarily suspending accept(). Consider setting a lower MHD_OPTION_CONNECTION_LIMIT.\n",
+ _("Hit process or system resource limit at %u connections, temporarily suspending accept(). Consider setting a lower MHD_OPTION_CONNECTION_LIMIT.\n"),
(unsigned int) daemon->connections);
#endif
}
@@ -2399,7 +2471,7 @@ MHD_accept_connection (struct MHD_Daemon *daemon)
{
#ifdef HAVE_MESSAGES
MHD_DLOG (daemon,
- "Failed to set nonblocking mode on incoming connection socket: %s\n",
+ _("Failed to set nonblocking mode on incoming connection socket: %s\n"),
MHD_socket_last_strerr_());
#endif
}
@@ -2409,14 +2481,14 @@ MHD_accept_connection (struct MHD_Daemon *daemon)
{
#ifdef HAVE_MESSAGES
MHD_DLOG (daemon,
- "Failed to set noninheritable mode on incoming connection socket.\n");
+ _("Failed to set noninheritable mode on incoming connection socket.\n"));
#endif
}
#endif /* !USE_ACCEPT4 || !SOCK_CLOEXEC */
#ifdef HAVE_MESSAGES
#if DEBUG_CONNECT
MHD_DLOG (daemon,
- "Accepted connection on socket %d\n",
+ _("Accepted connection on socket %d\n"),
s);
#endif
#endif
@@ -2443,7 +2515,7 @@ MHD_cleanup_connections (struct MHD_Daemon *daemon)
if ( (0 != (daemon->options & MHD_USE_THREAD_PER_CONNECTION)) &&
(! MHD_mutex_lock_ (&daemon->cleanup_connection_mutex)) )
- MHD_PANIC ("Failed to acquire cleanup mutex\n");
+ MHD_PANIC (_("Failed to acquire cleanup mutex\n"));
while (NULL != (pos = daemon->cleanup_head))
{
DLL_remove (daemon->cleanup_head,
@@ -2454,7 +2526,7 @@ MHD_cleanup_connections (struct MHD_Daemon *daemon)
{
if (! MHD_join_thread_ (pos->pid))
{
- MHD_PANIC ("Failed to join a thread\n");
+ MHD_PANIC (_("Failed to join a thread\n"));
}
}
MHD_pool_destroy (pos->pool);
@@ -2471,7 +2543,9 @@ MHD_cleanup_connections (struct MHD_Daemon *daemon)
pos,
&pos->socket_context,
MHD_CONNECTION_NOTIFY_CLOSED);
- MHD_ip_limit_del (daemon, pos->addr, pos->addr_len);
+ MHD_ip_limit_del (daemon,
+ pos->addr,
+ pos->addr_len);
#ifdef EPOLL_SUPPORT
if (0 != (daemon->options & MHD_USE_EPOLL))
{
@@ -2495,7 +2569,7 @@ MHD_cleanup_connections (struct MHD_Daemon *daemon)
EPOLL_CTL_DEL,
pos->socket_fd,
NULL))
- MHD_PANIC ("Failed to remove FD from epoll set\n");
+ MHD_PANIC (_("Failed to remove FD from epoll set\n"));
pos->epoll_state &= ~MHD_EPOLL_STATE_IN_EPOLL_SET;
}
}
@@ -2508,7 +2582,7 @@ MHD_cleanup_connections (struct MHD_Daemon *daemon)
if (MHD_INVALID_SOCKET != pos->socket_fd)
{
if (0 != MHD_socket_close_ (pos->socket_fd))
- MHD_PANIC ("close failed\n");
+ MHD_PANIC (_("close failed\n"));
}
if (NULL != pos->addr)
free (pos->addr);
@@ -2516,7 +2590,7 @@ MHD_cleanup_connections (struct MHD_Daemon *daemon)
}
if ( (0 != (daemon->options & MHD_USE_THREAD_PER_CONNECTION)) &&
(! MHD_mutex_unlock_ (&daemon->cleanup_connection_mutex)) )
- MHD_PANIC ("Failed to release cleanup mutex\n");
+ MHD_PANIC (_("Failed to release cleanup mutex\n"));
}
@@ -2547,7 +2621,7 @@ MHD_get_timeout (struct MHD_Daemon *daemon,
{
#ifdef HAVE_MESSAGES
MHD_DLOG (daemon,
- "Illegal call to MHD_get_timeout\n");
+ _("Illegal call to MHD_get_timeout\n"));
#endif
return MHD_NO;
}
@@ -2651,7 +2725,8 @@ MHD_run_from_select (struct MHD_Daemon *daemon,
/* Do it before any other processing so new signals
will trigger select again and will be processed */
if ((MHD_INVALID_PIPE_ != daemon->wpipe[0]) &&
- (FD_ISSET (daemon->wpipe[0], read_fd_set)))
+ (FD_ISSET (daemon->wpipe[0],
+ read_fd_set)))
MHD_pipe_drain_ (daemon->wpipe[0]);
/* Resuming external connections when using an extern mainloop */
@@ -2663,9 +2738,11 @@ MHD_run_from_select (struct MHD_Daemon *daemon,
{
/* we're in epoll mode, the epoll FD stands for
the entire event set! */
- if (! MHD_SCKT_FD_FITS_FDSET_(daemon->epoll_fd, NULL))
+ if (! MHD_SCKT_FD_FITS_FDSET_(daemon->epoll_fd,
+ NULL))
return MHD_NO; /* poll fd too big, fail hard */
- if (FD_ISSET (daemon->epoll_fd, read_fd_set))
+ if (FD_ISSET (daemon->epoll_fd,
+ read_fd_set))
return MHD_run (daemon);
return MHD_YES;
}
@@ -2673,7 +2750,8 @@ MHD_run_from_select (struct MHD_Daemon *daemon,
/* select connection thread handling type */
if ( (MHD_INVALID_SOCKET != (ds = daemon->socket_fd)) &&
- (FD_ISSET (ds, read_fd_set)) )
+ (FD_ISSET (ds,
+ read_fd_set)) )
(void) MHD_accept_connection (daemon);
if (0 == (daemon->options & MHD_USE_THREAD_PER_CONNECTION))
@@ -2687,8 +2765,10 @@ MHD_run_from_select (struct MHD_Daemon *daemon,
if (MHD_INVALID_SOCKET == ds)
continue;
call_handlers (pos,
- FD_ISSET (ds, read_fd_set),
- FD_ISSET (ds, write_fd_set),
+ FD_ISSET (ds,
+ read_fd_set),
+ FD_ISSET (ds,
+ write_fd_set),
MHD_NO);
}
}
@@ -2759,7 +2839,7 @@ MHD_select (struct MHD_Daemon *daemon,
{
#ifdef HAVE_MESSAGES
MHD_DLOG (daemon,
- "Could not obtain daemon fdsets");
+ _("Could not obtain daemon fdsets"));
#endif
err_state = MHD_YES;
}
@@ -2775,7 +2855,7 @@ MHD_select (struct MHD_Daemon *daemon,
{
#ifdef HAVE_MESSAGES
MHD_DLOG (daemon,
- "Could not add listen socket to fdset");
+ _("Could not add listen socket to fdset"));
#endif
return MHD_NO;
}
@@ -2792,7 +2872,8 @@ MHD_select (struct MHD_Daemon *daemon,
from fdset and retry to add pipe FD. */
if (MHD_INVALID_SOCKET != daemon->socket_fd)
{
- FD_CLR (daemon->socket_fd, &rs);
+ FD_CLR (daemon->socket_fd,
+ &rs);
if (! MHD_add_to_fd_set_ (daemon->wpipe[0],
&rs,
&maxsock,
@@ -2801,7 +2882,7 @@ MHD_select (struct MHD_Daemon *daemon,
#endif /* MHD_WINSOCK_SOCKETS */
#ifdef HAVE_MESSAGES
MHD_DLOG (daemon,
- "Could not add control pipe FD to fdset");
+ _("Could not add control pipe FD to fdset"));
#endif
err_state = MHD_YES;
#if defined(MHD_WINSOCK_SOCKETS)
@@ -2858,12 +2939,15 @@ MHD_select (struct MHD_Daemon *daemon,
return (MHD_NO == err_state) ? MHD_YES : MHD_NO;
#ifdef HAVE_MESSAGES
MHD_DLOG (daemon,
- "select failed: %s\n",
+ _("select failed: %s\n"),
MHD_socket_strerr_ (err));
#endif
return MHD_NO;
}
- if (MHD_YES == MHD_run_from_select (daemon, &rs, &ws, &es))
+ if (MHD_YES == MHD_run_from_select (daemon,
+ &rs,
+ &ws,
+ &es))
return (MHD_NO == err_state) ? MHD_YES : MHD_NO;
return MHD_NO;
}
@@ -2915,13 +2999,15 @@ MHD_poll_all (struct MHD_Daemon *daemon,
if (NULL == p)
{
#ifdef HAVE_MESSAGES
- MHD_DLOG(daemon,
- "Error allocating memory: %s\n",
- MHD_strerror_(errno));
+ MHD_DLOG (daemon,
+ _("Error allocating memory: %s\n"),
+ MHD_strerror_(errno));
#endif
return MHD_NO;
}
- memset (p, 0, sizeof (struct pollfd) * (2 + num_connections));
+ memset (p,
+ 0,
+ sizeof (struct pollfd) * (2 + num_connections));
poll_server = 0;
poll_listen = -1;
if ( (MHD_INVALID_SOCKET != daemon->socket_fd) &&
@@ -2947,7 +3033,8 @@ MHD_poll_all (struct MHD_Daemon *daemon,
if (may_block == MHD_NO)
timeout = 0;
else if ( (0 != (daemon->options & MHD_USE_THREAD_PER_CONNECTION)) ||
- (MHD_YES != MHD_get_timeout (daemon, &ltimeout)) )
+ (MHD_YES != MHD_get_timeout (daemon,
+ &ltimeout)) )
timeout = -1;
else
timeout = (ltimeout > INT_MAX) ? INT_MAX : (int) ltimeout;
@@ -3010,7 +3097,7 @@ MHD_poll_all (struct MHD_Daemon *daemon,
}
#ifdef HAVE_MESSAGES
MHD_DLOG (daemon,
- "poll failed: %s\n",
+ _("poll failed: %s\n"),
MHD_socket_strerr_ (err));
#endif
free(p);
@@ -3101,7 +3188,9 @@ MHD_poll_listen_socket (struct MHD_Daemon *daemon,
unsigned int poll_count;
int poll_listen;
- memset (&p, 0, sizeof (p));
+ memset (&p,
+ 0,
+ sizeof (p));
poll_count = 0;
poll_listen = -1;
if (MHD_INVALID_SOCKET != daemon->socket_fd)
@@ -3125,14 +3214,17 @@ MHD_poll_listen_socket (struct MHD_Daemon *daemon,
timeout = -1;
if (0 == poll_count)
return MHD_YES;
- if (MHD_sys_poll_(p, poll_count, timeout) < 0)
+ if (MHD_sys_poll_(p,
+ poll_count,
+ timeout) < 0)
{
const int err = MHD_socket_get_error_ ();
+
if (MHD_SCKT_ERR_IS_EINTR_ (err))
return MHD_YES;
#ifdef HAVE_MESSAGES
MHD_DLOG (daemon,
- "poll failed: %s\n",
+ _("poll failed: %s\n"),
MHD_socket_strerr_ (err));
#endif
return MHD_NO;
@@ -3163,9 +3255,10 @@ MHD_poll (struct MHD_Daemon *daemon,
if (MHD_YES == daemon->shutdown)
return MHD_NO;
if (0 == (daemon->options & MHD_USE_THREAD_PER_CONNECTION))
- return MHD_poll_all (daemon, may_block);
- else
- return MHD_poll_listen_socket (daemon, may_block);
+ return MHD_poll_all (daemon,
+ may_block);
+ return MHD_poll_listen_socket (daemon,
+ may_block);
#else
return MHD_NO;
#endif
@@ -3216,7 +3309,7 @@ run_epoll_for_upgrade (struct MHD_Daemon *daemon)
return MHD_YES;
#ifdef HAVE_MESSAGES
MHD_DLOG (daemon,
- "Call to epoll_wait failed: %s\n",
+ _("Call to epoll_wait failed: %s\n"),
MHD_socket_strerr_ (err));
#endif
return MHD_NO;
@@ -3311,7 +3404,7 @@ MHD_epoll (struct MHD_Daemon *daemon,
{
#ifdef HAVE_MESSAGES
MHD_DLOG (daemon,
- "Call to epoll_ctl failed: %s\n",
+ _("Call to epoll_ctl failed: %s\n"),
MHD_socket_last_strerr_ ());
#endif
return MHD_NO;
@@ -3331,7 +3424,7 @@ MHD_epoll (struct MHD_Daemon *daemon,
{
#ifdef HAVE_MESSAGES
MHD_DLOG (daemon,
- "Call to epoll_ctl failed: %s\n",
+ _("Call to epoll_ctl failed: %s\n"),
MHD_socket_last_strerr_ ());
#endif
return MHD_NO;
@@ -3349,7 +3442,7 @@ MHD_epoll (struct MHD_Daemon *daemon,
EPOLL_CTL_DEL,
daemon->socket_fd,
NULL))
- MHD_PANIC ("Failed to remove listen FD from epoll set\n");
+ MHD_PANIC (_("Failed to remove listen FD from epoll set\n"));
daemon->listen_socket_in_epoll = MHD_NO;
}
if (MHD_YES == may_block)
@@ -3387,7 +3480,7 @@ MHD_epoll (struct MHD_Daemon *daemon,
return MHD_YES;
#ifdef HAVE_MESSAGES
MHD_DLOG (daemon,
- "Call to epoll_wait failed: %s\n",
+ _("Call to epoll_wait failed: %s\n"),
MHD_socket_strerr_ (err));
#endif
return MHD_NO;
@@ -3566,7 +3659,7 @@ MHD_run (struct MHD_Daemon *daemon)
* Thread that runs the select loop until the daemon
* is explicitly shut down.
*
- * @param cls 'struct MHD_Deamon' to run select loop in a thread for
+ * @param cls `struct MHD_Deamon` to run select loop in a thread for
* @return always 0 (on shutdown)
*/
static MHD_THRD_RTRN_TYPE_ MHD_THRD_CALL_SPEC_
@@ -3631,13 +3724,22 @@ MHD_start_daemon (unsigned int flags,
uint16_t port,
MHD_AcceptPolicyCallback apc,
void *apc_cls,
- MHD_AccessHandlerCallback dh, void *dh_cls, ...)
+ MHD_AccessHandlerCallback dh,
+ void *dh_cls,
+ ...)
{
struct MHD_Daemon *daemon;
va_list ap;
- va_start (ap, dh_cls);
- daemon = MHD_start_daemon_va (flags, port, apc, apc_cls, dh, dh_cls, ap);
+ va_start (ap,
+ dh_cls);
+ daemon = MHD_start_daemon_va (flags,
+ port,
+ apc,
+ apc_cls,
+ dh,
+ dh_cls,
+ ap);
va_end (ap);
return daemon;
}
@@ -3694,15 +3796,17 @@ MHD_quiesce_daemon (struct MHD_Daemon *daemon)
EPOLL_CTL_DEL,
ret,
NULL))
- MHD_PANIC ("Failed to remove listen FD from epoll set\n");
+ MHD_PANIC (_("Failed to remove listen FD from epoll set\n"));
daemon->worker_pool[i].listen_socket_in_epoll = MHD_NO;
}
else
#endif
if (MHD_INVALID_PIPE_ != daemon->worker_pool[i].wpipe[1])
{
- if (1 != MHD_pipe_write_ (daemon->worker_pool[i].wpipe[1], "q", 1))
- MHD_PANIC ("failed to signal quiesce via pipe");
+ if (1 != MHD_pipe_write_ (daemon->worker_pool[i].wpipe[1],
+ "q",
+ 1))
+ MHD_PANIC (_("Failed to signal quiesce via pipe"));
}
}
daemon->socket_fd = MHD_INVALID_SOCKET;
@@ -3722,8 +3826,10 @@ MHD_quiesce_daemon (struct MHD_Daemon *daemon)
#endif
if (MHD_INVALID_PIPE_ != daemon->wpipe[1])
{
- if (1 != MHD_pipe_write_ (daemon->wpipe[1], "q", 1))
- MHD_PANIC ("failed to signal quiesce via pipe");
+ if (1 != MHD_pipe_write_ (daemon->wpipe[1],
+ "q",
+ 1))
+ MHD_PANIC (_("failed to signal quiesce via pipe"));
}
return ret;
@@ -3774,7 +3880,9 @@ parse_options (struct MHD_Daemon *daemon,
int ret;
va_start (ap, servaddr);
- ret = parse_options_va (daemon, servaddr, ap);
+ ret = parse_options_va (daemon,
+ servaddr,
+ ap);
va_end (ap);
return ret;
}
@@ -3806,45 +3914,55 @@ parse_options_va (struct MHD_Daemon *daemon,
switch (opt)
{
case MHD_OPTION_CONNECTION_MEMORY_LIMIT:
- daemon->pool_size = va_arg (ap, size_t);
+ daemon->pool_size = va_arg (ap,
+ size_t);
break;
case MHD_OPTION_CONNECTION_MEMORY_INCREMENT:
- daemon->pool_increment= va_arg (ap, size_t);
+ daemon->pool_increment= va_arg (ap,
+ size_t);
break;
case MHD_OPTION_CONNECTION_LIMIT:
- daemon->connection_limit = va_arg (ap, unsigned int);
+ daemon->connection_limit = va_arg (ap,
+ unsigned int);
break;
case MHD_OPTION_CONNECTION_TIMEOUT:
- daemon->connection_timeout = va_arg (ap, unsigned int);
+ daemon->connection_timeout = va_arg (ap,
+ unsigned int);
break;
case MHD_OPTION_NOTIFY_COMPLETED:
- daemon->notify_completed =
- va_arg (ap, MHD_RequestCompletedCallback);
- daemon->notify_completed_cls = va_arg (ap, void *);
+ daemon->notify_completed = va_arg (ap,
+ MHD_RequestCompletedCallback);
+ daemon->notify_completed_cls = va_arg (ap,
+ void *);
break;
case MHD_OPTION_NOTIFY_CONNECTION:
- daemon->notify_connection =
- va_arg (ap, MHD_NotifyConnectionCallback);
- daemon->notify_connection_cls = va_arg (ap, void *);
+ daemon->notify_connection = va_arg (ap,
+ MHD_NotifyConnectionCallback);
+ daemon->notify_connection_cls = va_arg (ap,
+ void *);
break;
case MHD_OPTION_PER_IP_CONNECTION_LIMIT:
- daemon->per_ip_connection_limit = va_arg (ap, unsigned int);
+ daemon->per_ip_connection_limit = va_arg (ap,
+ unsigned int);
break;
case MHD_OPTION_SOCK_ADDR:
- *servaddr = va_arg (ap, const struct sockaddr *);
+ *servaddr = va_arg (ap,
+ const struct sockaddr *);
break;
case MHD_OPTION_URI_LOG_CALLBACK:
- daemon->uri_log_callback =
- va_arg (ap, LogCallback);
- daemon->uri_log_callback_cls = va_arg (ap, void *);
+ daemon->uri_log_callback = va_arg (ap,
+ LogCallback);
+ daemon->uri_log_callback_cls = va_arg (ap,
+ void *);
break;
case MHD_OPTION_THREAD_POOL_SIZE:
- daemon->worker_pool_size = va_arg (ap, unsigned int);
+ daemon->worker_pool_size = va_arg (ap,
+ unsigned int);
if (daemon->worker_pool_size >= (SIZE_MAX / sizeof (struct MHD_Daemon)))
{
#ifdef HAVE_MESSAGES
MHD_DLOG (daemon,
- "Specified thread pool size (%u) too big\n",
+ _("Specified thread pool size (%u) too big\n"),
daemon->worker_pool_size);
#endif
return MHD_NO;
@@ -3853,69 +3971,76 @@ parse_options_va (struct MHD_Daemon *daemon,
#if HTTPS_SUPPORT
case MHD_OPTION_HTTPS_MEM_KEY:
if (0 != (daemon->options & MHD_USE_SSL))
- daemon->https_mem_key = va_arg (ap, const char *);
+ daemon->https_mem_key = va_arg (ap,
+ const char *);
#ifdef HAVE_MESSAGES
else
MHD_DLOG (daemon,
- "MHD HTTPS option %d passed to MHD but MHD_USE_SSL not set\n",
+ _("MHD HTTPS option %d passed to MHD but MHD_USE_SSL not set\n"),
opt);
#endif
break;
case MHD_OPTION_HTTPS_KEY_PASSWORD:
if (0 != (daemon->options & MHD_USE_SSL))
- daemon->https_key_password = va_arg (ap, const char *);
+ daemon->https_key_password = va_arg (ap,
+ const char *);
#ifdef HAVE_MESSAGES
else
MHD_DLOG (daemon,
- "MHD HTTPS option %d passed to MHD but MHD_USE_SSL not set\n",
+ _("MHD HTTPS option %d passed to MHD but MHD_USE_SSL not set\n"),
opt);
#endif
break;
case MHD_OPTION_HTTPS_MEM_CERT:
if (0 != (daemon->options & MHD_USE_SSL))
- daemon->https_mem_cert = va_arg (ap, const char *);
+ daemon->https_mem_cert = va_arg (ap,
+ const char *);
#ifdef HAVE_MESSAGES
else
MHD_DLOG (daemon,
- "MHD HTTPS option %d passed to MHD but MHD_USE_SSL not set\n",
+ _("MHD HTTPS option %d passed to MHD but MHD_USE_SSL not set\n"),
opt);
#endif
break;
case MHD_OPTION_HTTPS_MEM_TRUST:
if (0 != (daemon->options & MHD_USE_SSL))
- daemon->https_mem_trust = va_arg (ap, const char *);
+ daemon->https_mem_trust = va_arg (ap,
+ const char *);
#ifdef HAVE_MESSAGES
else
MHD_DLOG (daemon,
- "MHD HTTPS option %d passed to MHD but MHD_USE_SSL not set\n",
+ _("MHD HTTPS option %d passed to MHD but MHD_USE_SSL not set\n"),
opt);
#endif
break;
case MHD_OPTION_HTTPS_CRED_TYPE:
- daemon->cred_type = (gnutls_credentials_type_t) va_arg (ap, int);
+ daemon->cred_type = (gnutls_credentials_type_t) va_arg (ap,
+ int);
break;
case MHD_OPTION_HTTPS_MEM_DHPARAMS:
if (0 != (daemon->options & MHD_USE_SSL))
{
- const char *arg = va_arg (ap, const char *);
+ const char *arg = va_arg (ap,
+ const char *);
gnutls_datum_t dhpar;
if (gnutls_dh_params_init (&daemon->https_mem_dhparams) < 0)
{
#ifdef HAVE_MESSAGES
MHD_DLOG (daemon,
- "Error initializing DH parameters\n");
+ _("Error initializing DH parameters\n"));
#endif
return MHD_NO;
}
dhpar.data = (unsigned char *) arg;
dhpar.size = strlen (arg);
- if (gnutls_dh_params_import_pkcs3 (daemon->https_mem_dhparams, &dhpar,
+ if (gnutls_dh_params_import_pkcs3 (daemon->https_mem_dhparams,
+ &dhpar,
GNUTLS_X509_FMT_PEM) < 0)
{
#ifdef HAVE_MESSAGES
MHD_DLOG (daemon,
- "Bad Diffie-Hellman parameters format\n");
+ _("Bad Diffie-Hellman parameters format\n"));
#endif
gnutls_dh_params_deinit (daemon->https_mem_dhparams);
return MHD_NO;
@@ -3926,7 +4051,7 @@ parse_options_va (struct MHD_Daemon *daemon,
{
#ifdef HAVE_MESSAGES
MHD_DLOG (daemon,
- "MHD HTTPS option %d passed to MHD but MHD_USE_SSL not set\n",
+ _("MHD HTTPS option %d passed to MHD but MHD_USE_SSL not set\n"),
opt);
#endif
return MHD_NO;
@@ -3943,7 +4068,7 @@ parse_options_va (struct MHD_Daemon *daemon,
{
#ifdef HAVE_MESSAGES
MHD_DLOG (daemon,
- "Setting priorities to `%s' failed: %s\n",
+ _("Setting priorities to `%s' failed: %s\n"),
pstr,
gnutls_strerror (ret));
#endif
@@ -3956,50 +4081,62 @@ parse_options_va (struct MHD_Daemon *daemon,
#if GNUTLS_VERSION_MAJOR < 3
#ifdef HAVE_MESSAGES
MHD_DLOG (daemon,
- "MHD_OPTION_HTTPS_CERT_CALLBACK requires building MHD with GnuTLS >= 3.0\n");
+ _("MHD_OPTION_HTTPS_CERT_CALLBACK requires building MHD with GnuTLS >= 3.0\n"));
#endif
return MHD_NO;
#else
if (0 != (daemon->options & MHD_USE_SSL))
- daemon->cert_callback = va_arg (ap, gnutls_certificate_retrieve_function2 *);
+ daemon->cert_callback = va_arg (ap,
+ gnutls_certificate_retrieve_function2 *);
break;
#endif
#endif
#ifdef DAUTH_SUPPORT
case MHD_OPTION_DIGEST_AUTH_RANDOM:
- daemon->digest_auth_rand_size = va_arg (ap, size_t);
- daemon->digest_auth_random = va_arg (ap, const char *);
+ daemon->digest_auth_rand_size = va_arg (ap,
+ size_t);
+ daemon->digest_auth_random = va_arg (ap,
+ const char *);
break;
case MHD_OPTION_NONCE_NC_SIZE:
- daemon->nonce_nc_size = va_arg (ap, unsigned int);
+ daemon->nonce_nc_size = va_arg (ap,
+ unsigned int);
break;
#endif
case MHD_OPTION_LISTEN_SOCKET:
- daemon->socket_fd = va_arg (ap, MHD_socket);
+ daemon->socket_fd = va_arg (ap,
+ MHD_socket);
break;
case MHD_OPTION_EXTERNAL_LOGGER:
#ifdef HAVE_MESSAGES
- daemon->custom_error_log =
- va_arg (ap, VfprintfFunctionPointerType);
- daemon->custom_error_log_cls = va_arg (ap, void *);
+ daemon->custom_error_log = va_arg (ap,
+ VfprintfFunctionPointerType);
+ daemon->custom_error_log_cls = va_arg (ap,
+ void *);
#else
- va_arg (ap, VfprintfFunctionPointerType);
- va_arg (ap, void *);
+ va_arg (ap,
+ VfprintfFunctionPointerType);
+ va_arg (ap,
+ void *);
#endif
break;
case MHD_OPTION_THREAD_STACK_SIZE:
- daemon->thread_stack_size = va_arg (ap, size_t);
+ daemon->thread_stack_size = va_arg (ap,
+ size_t);
break;
#ifdef TCP_FASTOPEN
case MHD_OPTION_TCP_FASTOPEN_QUEUE_SIZE:
- daemon->fastopen_queue_size = va_arg (ap, unsigned int);
+ daemon->fastopen_queue_size = va_arg (ap,
+ unsigned int);
break;
#endif
case MHD_OPTION_LISTENING_ADDRESS_REUSE:
- daemon->listening_address_reuse = va_arg (ap, unsigned int) ? 1 : -1;
+ daemon->listening_address_reuse = va_arg (ap,
+ unsigned int) ? 1 : -1;
break;
case MHD_OPTION_LISTEN_BACKLOG_SIZE:
- daemon->listen_backlog_size = va_arg (ap, unsigned int);
+ daemon->listen_backlog_size = va_arg (ap,
+ unsigned int);
break;
case MHD_OPTION_ARRAY:
oa = va_arg (ap, struct MHD_OptionItem*);
@@ -4101,23 +4238,25 @@ parse_options_va (struct MHD_Daemon *daemon,
}
break;
case MHD_OPTION_UNESCAPE_CALLBACK:
- daemon->unescape_callback =
- va_arg (ap, UnescapeCallback);
- daemon->unescape_callback_cls = va_arg (ap, void *);
+ daemon->unescape_callback = va_arg (ap,
+ UnescapeCallback);
+ daemon->unescape_callback_cls = va_arg (ap,
+ void *);
break;
default:
#ifdef HAVE_MESSAGES
- if (((opt >= MHD_OPTION_HTTPS_MEM_KEY) &&
- (opt <= MHD_OPTION_HTTPS_PRIORITIES)) || (opt == MHD_OPTION_HTTPS_MEM_TRUST))
+ if ( ( (opt >= MHD_OPTION_HTTPS_MEM_KEY) &&
+ (opt <= MHD_OPTION_HTTPS_PRIORITIES) ) ||
+ (opt == MHD_OPTION_HTTPS_MEM_TRUST))
{
MHD_DLOG (daemon,
- "MHD HTTPS option %d passed to MHD compiled without HTTPS support\n",
+ _("MHD HTTPS option %d passed to MHD compiled without HTTPS support\n"),
opt);
}
else
{
MHD_DLOG (daemon,
- "Invalid option %d! (Did you terminate the list with MHD_OPTION_END?)\n",
+ _("Invalid option %d! (Did you terminate the list with MHD_OPTION_END?)\n"),
opt);
}
#endif
@@ -4143,7 +4282,7 @@ setup_epoll_fd (struct MHD_Daemon *daemon)
{
#ifdef HAVE_MESSAGES
MHD_DLOG (daemon,
- "Call to epoll_create1 failed: %s\n",
+ _("Call to epoll_create1 failed: %s\n"),
MHD_socket_last_strerr_ ());
#endif
return MHD_INVALID_SOCKET;
@@ -4153,7 +4292,7 @@ setup_epoll_fd (struct MHD_Daemon *daemon)
{
#ifdef HAVE_MESSAGES
MHD_DLOG (daemon,
- "Failed to set noninheritable mode on epoll FD.\n");
+ _("Failed to set noninheritable mode on epoll FD.\n"));
#endif
}
#endif /* ! USE_EPOLL_CREATE1 */
@@ -4195,7 +4334,7 @@ setup_epoll_to_listen (struct MHD_Daemon *daemon)
{
#ifdef HAVE_MESSAGES
MHD_DLOG (daemon,
- "Call to epoll_ctl failed: %s\n",
+ _("Call to epoll_ctl failed: %s\n"),
MHD_socket_last_strerr_ ());
#endif
return MHD_NO;
@@ -4213,7 +4352,7 @@ setup_epoll_to_listen (struct MHD_Daemon *daemon)
{
#ifdef HAVE_MESSAGES
MHD_DLOG (daemon,
- "Call to epoll_ctl failed: %s\n",
+ _("Call to epoll_ctl failed: %s\n"),
MHD_socket_last_strerr_ ());
#endif
return MHD_NO;
@@ -4247,7 +4386,8 @@ MHD_start_daemon_va (unsigned int flags,
uint16_t port,
MHD_AcceptPolicyCallback apc,
void *apc_cls,
- MHD_AccessHandlerCallback dh, void *dh_cls,
+ MHD_AccessHandlerCallback dh,
+ void *dh_cls,
va_list ap)
{
const MHD_SCKT_OPT_BOOL_ on = 1;
@@ -4282,7 +4422,9 @@ MHD_start_daemon_va (unsigned int flags,
return NULL;
if (NULL == (daemon = malloc (sizeof (struct MHD_Daemon))))
return NULL;
- memset (daemon, 0, sizeof (struct MHD_Daemon));
+ memset (daemon,
+ 0,
+ sizeof (struct MHD_Daemon));
#ifdef EPOLL_SUPPORT
daemon->epoll_fd = -1;
#if HTTPS_SUPPORT
@@ -4332,11 +4474,11 @@ MHD_start_daemon_va (unsigned int flags,
use_pipe = 0; /* useless if we are using 'external' select */
if (use_pipe)
{
- if (!MHD_pipe_ (daemon->wpipe))
+ if (! MHD_pipe_ (daemon->wpipe))
{
#ifdef HAVE_MESSAGES
MHD_DLOG (daemon,
- "Failed to create control pipe: %s\n",
+ _("Failed to create control pipe: %s\n"),
MHD_pipe_last_strerror_ ());
#endif
free (daemon);
@@ -4346,13 +4488,13 @@ MHD_start_daemon_va (unsigned int flags,
{
#ifdef HAVE_MESSAGES
MHD_DLOG (daemon,
- "Failed to make read side of inter-thread control channel non-blocking: %s\n",
+ _("Failed to make read side of inter-thread control channel non-blocking: %s\n"),
MHD_pipe_last_strerror_ ());
#endif
if (0 != MHD_pipe_close_ (daemon->wpipe[0]))
- MHD_PANIC ("close failed\n");
+ MHD_PANIC (_("close failed\n"));
if (0 != MHD_pipe_close_ (daemon->wpipe[1]))
- MHD_PANIC ("close failed\n");
+ MHD_PANIC (_("close failed\n"));
free (daemon);
return NULL;
}
@@ -4360,23 +4502,24 @@ MHD_start_daemon_va (unsigned int flags,
{
#ifdef HAVE_MESSAGES
MHD_DLOG (daemon,
- "Failed to make write side of inter-thread control channel non-blocking: %s\n",
+ _("Failed to make write side of inter-thread control channel non-blocking: %s\n"),
MHD_pipe_last_strerror_ ());
#endif
}
}
if ( (0 == (flags & (MHD_USE_POLL | MHD_USE_EPOLL))) &&
(1 == use_pipe) &&
- (! MHD_SCKT_FD_FITS_FDSET_(daemon->wpipe[0], NULL)) )
+ (! MHD_SCKT_FD_FITS_FDSET_(daemon->wpipe[0],
+ NULL)) )
{
#ifdef HAVE_MESSAGES
MHD_DLOG (daemon,
- "file descriptor for control pipe exceeds maximum value\n");
+ _("file descriptor for control pipe exceeds maximum value\n"));
#endif
if (0 != MHD_pipe_close_ (daemon->wpipe[0]))
- MHD_PANIC ("close failed\n");
+ MHD_PANIC (_("close failed\n"));
if (0 != MHD_pipe_close_ (daemon->wpipe[1]))
- MHD_PANIC ("close failed\n");
+ MHD_PANIC (_("close failed\n"));
free (daemon);
return NULL;
}
@@ -4393,7 +4536,9 @@ MHD_start_daemon_va (unsigned int flags,
#endif
- if (MHD_YES != parse_options_va (daemon, &servaddr, ap))
+ if (MHD_YES != parse_options_va (daemon,
+ &servaddr,
+ ap))
{
#if HTTPS_SUPPORT
if ( (0 != (flags & MHD_USE_SSL)) &&
@@ -4411,7 +4556,7 @@ MHD_start_daemon_va (unsigned int flags,
{
#ifdef HAVE_MESSAGES
MHD_DLOG (daemon,
- "Specified value for NC_SIZE too large\n");
+ _("Specified value for NC_SIZE too large\n"));
#endif
#if HTTPS_SUPPORT
if (0 != (flags & MHD_USE_SSL))
@@ -4425,7 +4570,7 @@ MHD_start_daemon_va (unsigned int flags,
{
#ifdef HAVE_MESSAGES
MHD_DLOG (daemon,
- "Failed to allocate memory for nonce-nc map: %s\n",
+ _("Failed to allocate memory for nonce-nc map: %s\n"),
MHD_strerror_ (errno));
#endif
#if HTTPS_SUPPORT
@@ -4437,11 +4582,11 @@ MHD_start_daemon_va (unsigned int flags,
}
}
- if (!MHD_mutex_init_ (&daemon->nnc_lock))
+ if (! MHD_mutex_init_ (&daemon->nnc_lock))
{
#ifdef HAVE_MESSAGES
MHD_DLOG (daemon,
- "MHD failed to initialize nonce-nc mutex\n");
+ _("MHD failed to initialize nonce-nc mutex\n"));
#endif
#if HTTPS_SUPPORT
if (0 != (flags & MHD_USE_SSL))
@@ -4459,7 +4604,7 @@ MHD_start_daemon_va (unsigned int flags,
{
#ifdef HAVE_MESSAGES
MHD_DLOG (daemon,
- "MHD thread pooling only works with MHD_USE_SELECT_INTERNALLY\n");
+ _("MHD thread pooling only works with MHD_USE_SELECT_INTERNALLY\n"));
#endif
goto free_and_fail;
}
@@ -4469,7 +4614,7 @@ MHD_start_daemon_va (unsigned int flags,
{
#ifdef HAVE_MESSAGES
MHD_DLOG (daemon,
- "Combining MHD_USE_THREAD_PER_CONNECTION and MHD_USE_SUSPEND_RESUME is not supported.\n");
+ _("Combining MHD_USE_THREAD_PER_CONNECTION and MHD_USE_SUSPEND_RESUME is not supported.\n"));
#endif
goto free_and_fail;
}
@@ -4479,7 +4624,7 @@ MHD_start_daemon_va (unsigned int flags,
{
#ifdef HAVE_MESSAGES
MHD_DLOG (daemon,
- "Threaded operations are not supported on Symbian.\n");
+ _("Threaded operations are not supported on Symbian.\n"));
#endif
goto free_and_fail;
}
@@ -4493,7 +4638,7 @@ MHD_start_daemon_va (unsigned int flags,
{
#ifdef HAVE_MESSAGES
MHD_DLOG (daemon,
- "Failed to create socket for listening: %s\n",
+ _("Failed to create socket for listening: %s\n"),
MHD_socket_last_strerr_ ());
#endif
goto free_and_fail;
@@ -4511,7 +4656,7 @@ MHD_start_daemon_va (unsigned int flags,
{
#ifdef HAVE_MESSAGES
MHD_DLOG (daemon,
- "setsockopt failed: %s\n",
+ _("setsockopt failed: %s\n"),
MHD_socket_last_strerr_ ());
#endif
}
@@ -4550,11 +4695,12 @@ MHD_start_daemon_va (unsigned int flags,
if (0 > setsockopt (socket_fd,
SOL_SOCKET,
SO_REUSEPORT,
- (void*)&on, sizeof (on)))
+ (void *) &on,
+ sizeof (on)))
{
#ifdef HAVE_MESSAGES
MHD_DLOG (daemon,
- "setsockopt failed: %s\n",
+ _("setsockopt failed: %s\n"),
MHD_socket_last_strerr_ ());
#endif
goto free_and_fail;
@@ -4564,7 +4710,7 @@ MHD_start_daemon_va (unsigned int flags,
on this platform we cannot; fail hard */
#ifdef HAVE_MESSAGES
MHD_DLOG (daemon,
- "Cannot allow listening address reuse: SO_REUSEPORT not defined\n");
+ _("Cannot allow listening address reuse: SO_REUSEPORT not defined\n"));
#endif
goto free_and_fail;
#endif
@@ -4581,11 +4727,12 @@ MHD_start_daemon_va (unsigned int flags,
if (0 > setsockopt (socket_fd,
SOL_SOCKET,
SO_EXCLUSIVEADDRUSE,
- (void*)&on, sizeof (on)))
+ (void *) &on,
+ sizeof (on)))
{
#ifdef HAVE_MESSAGES
MHD_DLOG (daemon,
- "setsockopt failed: %s\n",
+ _("setsockopt failed: %s\n"),
MHD_socket_last_strerr_ ());
#endif
goto free_and_fail;
@@ -4593,7 +4740,7 @@ MHD_start_daemon_va (unsigned int flags,
#else /* SO_EXCLUSIVEADDRUSE not defined on W32? */
#ifdef HAVE_MESSAGES
MHD_DLOG (daemon,
- "Cannot disallow listening address reuse: SO_EXCLUSIVEADDRUSE not defined\n");
+ _("Cannot disallow listening address reuse: SO_EXCLUSIVEADDRUSE not defined\n"));
#endif
goto free_and_fail;
#endif
@@ -4612,7 +4759,9 @@ MHD_start_daemon_va (unsigned int flags,
#if HAVE_INET6
if (0 != (flags & MHD_USE_IPv6))
{
- memset (&servaddr6, 0, sizeof (struct sockaddr_in6));
+ memset (&servaddr6,
+ 0,
+ sizeof (struct sockaddr_in6));
servaddr6.sin6_family = AF_INET6;
servaddr6.sin6_port = htons (port);
#if HAVE_SOCKADDR_IN_SIN_LEN
@@ -4623,7 +4772,9 @@ MHD_start_daemon_va (unsigned int flags,
else
#endif
{
- memset (&servaddr4, 0, sizeof (struct sockaddr_in));
+ memset (&servaddr4,
+ 0,
+ sizeof (struct sockaddr_in));
servaddr4.sin_family = AF_INET;
servaddr4.sin_port = htons (port);
#if HAVE_SOCKADDR_IN_SIN_LEN
@@ -4646,11 +4797,12 @@ MHD_start_daemon_va (unsigned int flags,
(MHD_USE_DUAL_STACK != (flags & MHD_USE_DUAL_STACK));
if (0 > setsockopt (socket_fd,
IPPROTO_IPV6, IPV6_V6ONLY,
- (const void*)&v6_only, sizeof (v6_only)))
+ (const void *) &v6_only,
+ sizeof (v6_only)))
{
#ifdef HAVE_MESSAGES
MHD_DLOG (daemon,
- "setsockopt failed: %s\n",
+ _("setsockopt failed: %s\n"),
MHD_socket_last_strerr_ ());
#endif
}
@@ -4661,12 +4813,12 @@ MHD_start_daemon_va (unsigned int flags,
{
#ifdef HAVE_MESSAGES
MHD_DLOG (daemon,
- "Failed to bind to port %u: %s\n",
+ _("Failed to bind to port %u: %s\n"),
(unsigned int) port,
MHD_socket_last_strerr_ ());
#endif
if (0 != MHD_socket_close_ (socket_fd))
- MHD_PANIC ("close failed\n");
+ MHD_PANIC (_("close failed\n"));
goto free_and_fail;
}
#ifdef TCP_FASTOPEN
@@ -4675,27 +4827,29 @@ MHD_start_daemon_va (unsigned int flags,
if (0 == daemon->fastopen_queue_size)
daemon->fastopen_queue_size = MHD_TCP_FASTOPEN_QUEUE_SIZE_DEFAULT;
if (0 != setsockopt (socket_fd,
- IPPROTO_TCP, TCP_FASTOPEN,
+ IPPROTO_TCP,
+ TCP_FASTOPEN,
&daemon->fastopen_queue_size,
sizeof (daemon->fastopen_queue_size)))
{
#ifdef HAVE_MESSAGES
MHD_DLOG (daemon,
- "setsockopt failed: %s\n",
+ _("setsockopt failed: %s\n"),
MHD_socket_last_strerr_ ());
#endif
}
}
#endif
- if (listen (socket_fd, daemon->listen_backlog_size) < 0)
+ if (listen (socket_fd,
+ daemon->listen_backlog_size) < 0)
{
#ifdef HAVE_MESSAGES
MHD_DLOG (daemon,
- "Failed to listen for connections: %s\n",
+ _("Failed to listen for connections: %s\n"),
MHD_socket_last_strerr_ ());
#endif
if (0 != MHD_socket_close_ (socket_fd))
- MHD_PANIC ("close failed\n");
+ MHD_PANIC (_("close failed\n"));
goto free_and_fail;
}
}
@@ -4708,7 +4862,7 @@ MHD_start_daemon_va (unsigned int flags,
{
#ifdef HAVE_MESSAGES
MHD_DLOG (daemon,
- "Failed to set nonblocking mode on listening socket: %s\n",
+ _("Failed to set nonblocking mode on listening socket: %s\n"),
MHD_socket_last_strerr_());
#endif
if (0 != (flags & MHD_USE_EPOLL) ||
@@ -4718,21 +4872,22 @@ MHD_start_daemon_va (unsigned int flags,
* to handle a new connection, but only one will win the race.
* The others must immediately return. */
if (0 != MHD_socket_close_ (socket_fd))
- MHD_PANIC ("close failed\n");
+ MHD_PANIC (_("close failed\n"));
goto free_and_fail;
}
}
- if ( (!MHD_SCKT_FD_FITS_FDSET_(socket_fd, NULL)) &&
+ if ( (!MHD_SCKT_FD_FITS_FDSET_(socket_fd,
+ NULL)) &&
(0 == (flags & (MHD_USE_POLL | MHD_USE_EPOLL)) ) )
{
#ifdef HAVE_MESSAGES
MHD_DLOG (daemon,
- "Socket descriptor larger than FD_SETSIZE: %d > %d\n",
+ _("Socket descriptor larger than FD_SETSIZE: %d > %d\n"),
socket_fd,
FD_SETSIZE);
#endif
if (0 != MHD_socket_close_ (socket_fd))
- MHD_PANIC ("close failed\n");
+ MHD_PANIC (_("close failed\n"));
goto free_and_fail;
}
@@ -4745,7 +4900,7 @@ MHD_start_daemon_va (unsigned int flags,
{
#ifdef HAVE_MESSAGES
MHD_DLOG (daemon,
- "Combining MHD_USE_THREAD_PER_CONNECTION and MHD_USE_EPOLL is not supported.\n");
+ _("Combining MHD_USE_THREAD_PER_CONNECTION and MHD_USE_EPOLL is not supported.\n"));
#endif
goto free_and_fail;
}
@@ -4757,7 +4912,7 @@ MHD_start_daemon_va (unsigned int flags,
{
#ifdef HAVE_MESSAGES
MHD_DLOG (daemon,
- "epoll is not supported on this platform by this build.\n");
+ _("epoll is not supported on this platform by this build.\n"));
#endif
goto free_and_fail;
}
@@ -4767,37 +4922,38 @@ MHD_start_daemon_va (unsigned int flags,
{
#ifdef HAVE_MESSAGES
MHD_DLOG (daemon,
- "MHD failed to initialize IP connection limit mutex\n");
+ _("MHD failed to initialize IP connection limit mutex\n"));
#endif
if ( (MHD_INVALID_SOCKET != socket_fd) &&
(0 != MHD_socket_close_ (socket_fd)) )
- MHD_PANIC ("close failed\n");
+ MHD_PANIC (_("close failed\n"));
goto free_and_fail;
}
if (! MHD_mutex_init_ (&daemon->cleanup_connection_mutex))
{
#ifdef HAVE_MESSAGES
MHD_DLOG (daemon,
- "MHD failed to initialize IP connection limit mutex\n");
+ _("MHD failed to initialize IP connection limit mutex\n"));
#endif
(void) MHD_mutex_destroy_ (&daemon->cleanup_connection_mutex);
if ( (MHD_INVALID_SOCKET != socket_fd) &&
(0 != MHD_socket_close_ (socket_fd)) )
- MHD_PANIC ("close failed\n");
+ MHD_PANIC (_("close failed\n"));
goto free_and_fail;
}
#if HTTPS_SUPPORT
/* initialize HTTPS daemon certificate aspects & send / recv functions */
- if ((0 != (flags & MHD_USE_SSL)) && (0 != MHD_TLS_init (daemon)))
+ if ( (0 != (flags & MHD_USE_SSL)) &&
+ (0 != MHD_TLS_init (daemon)) )
{
#ifdef HAVE_MESSAGES
MHD_DLOG (daemon,
- "Failed to initialize TLS support\n");
+ _("Failed to initialize TLS support\n"));
#endif
if ( (MHD_INVALID_SOCKET != socket_fd) &&
(0 != MHD_socket_close_ (socket_fd)) )
- MHD_PANIC ("close failed\n");
+ MHD_PANIC (_("close failed\n"));
(void) MHD_mutex_destroy_ (&daemon->cleanup_connection_mutex);
(void) MHD_mutex_destroy_ (&daemon->per_ip_connection_mutex);
goto free_and_fail;
@@ -4816,14 +4972,14 @@ MHD_start_daemon_va (unsigned int flags,
{
#ifdef HAVE_MESSAGES
MHD_DLOG (daemon,
- "Failed to create listen thread: %s\n",
+ _("Failed to create listen thread: %s\n"),
MHD_strerror_ (errno));
#endif
(void) MHD_mutex_destroy_ (&daemon->cleanup_connection_mutex);
(void) MHD_mutex_destroy_ (&daemon->per_ip_connection_mutex);
if ( (MHD_INVALID_SOCKET != socket_fd) &&
(0 != MHD_socket_close_ (socket_fd)) )
- MHD_PANIC ("close failed\n");
+ MHD_PANIC (_("close failed\n"));
goto free_and_fail;
}
if ( (daemon->worker_pool_size > 0) &&
@@ -4862,44 +5018,45 @@ MHD_start_daemon_va (unsigned int flags,
/* Always use individual control pipes */
if (1)
{
- if (!MHD_pipe_ (d->wpipe))
+ if (! MHD_pipe_ (d->wpipe))
{
#ifdef HAVE_MESSAGES
MHD_DLOG (daemon,
- "Failed to create worker control pipe: %s\n",
+ _("Failed to create worker control pipe: %s\n"),
MHD_pipe_last_strerror_() );
#endif
goto thread_failed;
}
- if (!MHD_itc_nonblocking_(d->wpipe[0]))
+ if (! MHD_itc_nonblocking_(d->wpipe[0]))
{
#ifdef HAVE_MESSAGES
MHD_DLOG (daemon,
- "Failed to make read side of worker inter-thread control channel non-blocking: %s\n",
+ _("Failed to make read side of worker inter-thread control channel non-blocking: %s\n"),
MHD_pipe_last_strerror_ ());
#endif
goto thread_failed;
}
- if (!MHD_itc_nonblocking_(d->wpipe[1]))
+ if (! MHD_itc_nonblocking_(d->wpipe[1]))
{
#ifdef HAVE_MESSAGES
MHD_DLOG (daemon,
- "Failed to make write side of worker inter-thread control channel non-blocking: %s\n",
+ _("Failed to make write side of worker inter-thread control channel non-blocking: %s\n"),
MHD_pipe_last_strerror_ ());
#endif
}
}
if ( (0 == (flags & (MHD_USE_POLL | MHD_USE_EPOLL))) &&
- (!MHD_SCKT_FD_FITS_FDSET_(d->wpipe[0], NULL)) )
+ (! MHD_SCKT_FD_FITS_FDSET_(d->wpipe[0],
+ NULL)) )
{
#ifdef HAVE_MESSAGES
MHD_DLOG (daemon,
- "File descriptor for worker control pipe exceeds maximum value\n");
+ _("File descriptor for worker control pipe exceeds maximum value\n"));
#endif
if (0 != MHD_pipe_close_ (d->wpipe[0]))
- MHD_PANIC ("close failed\n");
+ MHD_PANIC (_("close failed\n"));
if (0 != MHD_pipe_close_ (d->wpipe[1]))
- MHD_PANIC ("close failed\n");
+ MHD_PANIC (_("close failed\n"));
goto thread_failed;
}
@@ -4915,11 +5072,11 @@ MHD_start_daemon_va (unsigned int flags,
goto thread_failed;
#endif
/* Must init cleanup connection mutex for each worker */
- if (!MHD_mutex_init_ (&d->cleanup_connection_mutex))
+ if (! MHD_mutex_init_ (&d->cleanup_connection_mutex))
{
#ifdef HAVE_MESSAGES
MHD_DLOG (daemon,
- "MHD failed to initialize cleanup connection mutex for thread worker %d\n", i);
+ _("MHD failed to initialize cleanup connection mutex\n"));
#endif
goto thread_failed;
}
@@ -4933,7 +5090,7 @@ MHD_start_daemon_va (unsigned int flags,
{
#ifdef HAVE_MESSAGES
MHD_DLOG (daemon,
- "Failed to create pool thread: %s\n",
+ _("Failed to create pool thread: %s\n"),
MHD_strerror_ (errno));
#endif
/* Free memory for this worker; cleanup below handles
@@ -4960,7 +5117,7 @@ thread_failed:
{
if ( (MHD_INVALID_SOCKET != socket_fd) &&
(0 != MHD_socket_close_ (socket_fd)) )
- MHD_PANIC ("close failed\n");
+ MHD_PANIC (_("close failed\n"));
(void) MHD_mutex_destroy_ (&daemon->cleanup_connection_mutex);
(void) MHD_mutex_destroy_ (&daemon->per_ip_connection_mutex);
if (NULL != daemon->worker_pool)
@@ -4987,7 +5144,7 @@ thread_failed:
EPOLL_CTL_DEL,
daemon->epoll_upgrade_fd,
NULL))
- MHD_PANIC ("Failed to remove FD from epoll set\n");
+ MHD_PANIC (_("Failed to remove FD from epoll set\n"));
daemon->upgrade_fd_in_epoll = MHD_NO;
}
#endif
@@ -5008,10 +5165,10 @@ thread_failed:
#endif
if ( (MHD_INVALID_PIPE_ != daemon->wpipe[0]) &&
(0 != MHD_pipe_close_ (daemon->wpipe[0])) )
- MHD_PANIC ("close failed\n");
+ MHD_PANIC (_("close failed\n"));
if ( (MHD_INVALID_PIPE_ != daemon->wpipe[1]) &&
(0 != MHD_pipe_close_ (daemon->wpipe[1])) )
- MHD_PANIC ("close failed\n");
+ MHD_PANIC (_("close failed\n"));
free (daemon);
return NULL;
}
@@ -5065,10 +5222,10 @@ close_all_connections (struct MHD_Daemon *daemon)
/* first, make sure all threads are aware of shutdown; need to
traverse DLLs in peace... */
if ( (0 != (daemon->options & MHD_USE_THREAD_PER_CONNECTION)) &&
- (!MHD_mutex_lock_ (&daemon->cleanup_connection_mutex)) )
- MHD_PANIC ("Failed to acquire cleanup mutex\n");
+ (! MHD_mutex_lock_ (&daemon->cleanup_connection_mutex)) )
+ MHD_PANIC (_("Failed to acquire cleanup mutex\n"));
if (NULL != daemon->suspended_connections_head)
- MHD_PANIC ("MHD_stop_daemon() called while we have suspended connections.\n");
+ MHD_PANIC (_("MHD_stop_daemon() called while we have suspended connections.\n"));
for (pos = daemon->connections_head; NULL != pos; pos = pos->next)
{
shutdown (pos->socket_fd, SHUT_RDWR);
@@ -5076,12 +5233,12 @@ close_all_connections (struct MHD_Daemon *daemon)
if ( (0 != (daemon->options & MHD_USE_THREAD_PER_CONNECTION)) &&
(MHD_INVALID_PIPE_ != daemon->wpipe[1]) &&
(1 != MHD_pipe_write_ (daemon->wpipe[1], "e", 1)) )
- MHD_PANIC ("Failed to signal shutdown via pipe");
+ MHD_PANIC (_("Failed to signal shutdown via pipe"));
#endif
}
if ( (0 != (daemon->options & MHD_USE_THREAD_PER_CONNECTION)) &&
- (!MHD_mutex_unlock_ (&daemon->cleanup_connection_mutex)) )
- MHD_PANIC ("Failed to release cleanup mutex\n");
+ (! MHD_mutex_unlock_ (&daemon->cleanup_connection_mutex)) )
+ MHD_PANIC (_("Failed to release cleanup mutex\n"));
/* now, collect per-connection threads */
if (0 != (daemon->options & MHD_USE_THREAD_PER_CONNECTION))
@@ -5091,8 +5248,8 @@ close_all_connections (struct MHD_Daemon *daemon)
{
if (MHD_YES != pos->thread_joined)
{
- if (!MHD_join_thread_ (pos->pid))
- MHD_PANIC ("Failed to join a thread\n");
+ if (! MHD_join_thread_ (pos->pid))
+ MHD_PANIC (_("Failed to join a thread\n"));
pos->thread_joined = MHD_YES;
/* The thread may have concurrently modified the DLL,
need to restart from the beginning */
@@ -5107,7 +5264,7 @@ close_all_connections (struct MHD_Daemon *daemon)
{
if ( (0 != (daemon->options & MHD_USE_THREAD_PER_CONNECTION)) &&
(MHD_YES != pos->thread_joined) )
- MHD_PANIC ("Failed to join a thread\n");
+ MHD_PANIC (_("Failed to join a thread\n"));
close_connection (pos);
}
MHD_cleanup_connections (daemon);
@@ -5128,7 +5285,7 @@ epoll_shutdown (struct MHD_Daemon *daemon)
if (MHD_INVALID_PIPE_ == daemon->wpipe[1])
{
/* wpipe was required in this mode, how could this happen? */
- MHD_PANIC ("Internal error\n");
+ MHD_PANIC (_("Internal error\n"));
}
event.events = EPOLLOUT;
event.data.ptr = NULL;
@@ -5136,7 +5293,7 @@ epoll_shutdown (struct MHD_Daemon *daemon)
EPOLL_CTL_ADD,
daemon->wpipe[1],
&event))
- MHD_PANIC ("Failed to add wpipe to epoll set to signal termination\n");
+ MHD_PANIC (_("Failed to add wpipe to epoll set to signal termination\n"));
}
#endif
@@ -5180,7 +5337,7 @@ MHD_stop_daemon (struct MHD_Daemon *daemon)
if (MHD_INVALID_PIPE_ != daemon->wpipe[1])
{
if (1 != MHD_pipe_write_ (daemon->wpipe[1], "e", 1))
- MHD_PANIC ("failed to signal shutdown via pipe");
+ MHD_PANIC (_("Failed to signal shutdown via pipe"));
}
#ifdef HAVE_LISTEN_SHUTDOWN
else
@@ -5188,7 +5345,8 @@ MHD_stop_daemon (struct MHD_Daemon *daemon)
/* fd might be MHD_INVALID_SOCKET here due to 'MHD_quiesce_daemon' */
if ( (MHD_INVALID_SOCKET != fd) &&
(0 == (daemon->options & MHD_USE_PIPE_FOR_SHUTDOWN)) )
- (void) shutdown (fd, SHUT_RDWR);
+ (void) shutdown (fd,
+ SHUT_RDWR);
}
#endif
#ifdef EPOLL_SUPPORT
@@ -5201,7 +5359,7 @@ MHD_stop_daemon (struct MHD_Daemon *daemon)
#if DEBUG_CLOSE
#ifdef HAVE_MESSAGES
MHD_DLOG (daemon,
- "MHD listen socket shutdown\n");
+ _("MHD listen socket shutdown\n"));
#endif
#endif
@@ -5214,21 +5372,23 @@ MHD_stop_daemon (struct MHD_Daemon *daemon)
{
if (MHD_INVALID_PIPE_ != daemon->worker_pool[i].wpipe[1])
{
- if (1 != MHD_pipe_write_ (daemon->worker_pool[i].wpipe[1], "e", 1))
- MHD_PANIC ("failed to signal shutdown via pipe");
+ if (1 != MHD_pipe_write_ (daemon->worker_pool[i].wpipe[1],
+ "e",
+ 1))
+ MHD_PANIC (_("Failed to signal shutdown via pipe."));
}
if (!MHD_join_thread_ (daemon->worker_pool[i].pid))
- MHD_PANIC ("Failed to join a thread\n");
+ MHD_PANIC (_("Failed to join a thread\n"));
close_all_connections (&daemon->worker_pool[i]);
(void) MHD_mutex_destroy_ (&daemon->worker_pool[i].cleanup_connection_mutex);
#ifdef EPOLL_SUPPORT
if ( (-1 != daemon->worker_pool[i].epoll_fd) &&
(0 != MHD_socket_close_ (daemon->worker_pool[i].epoll_fd)) )
- MHD_PANIC ("close failed\n");
+ MHD_PANIC (_("close failed\n"));
#if HTTPS_SUPPORT
if ( (-1 != daemon->worker_pool[i].epoll_upgrade_fd) &&
(0 != MHD_socket_close_ (daemon->worker_pool[i].epoll_upgrade_fd)) )
- MHD_PANIC ("close failed\n");
+ MHD_PANIC (_("close failed\n"));
#endif
#endif
/* Individual pipes are always used */
@@ -5237,9 +5397,9 @@ MHD_stop_daemon (struct MHD_Daemon *daemon)
if (MHD_INVALID_PIPE_ != daemon->worker_pool[i].wpipe[1])
{
if (0 != MHD_pipe_close_ (daemon->worker_pool[i].wpipe[0]))
- MHD_PANIC ("close failed\n");
+ MHD_PANIC (_("close failed\n"));
if (0 != MHD_pipe_close_ (daemon->worker_pool[i].wpipe[1]))
- MHD_PANIC ("close failed\n");
+ MHD_PANIC (_("close failed\n"));
}
}
}
@@ -5254,14 +5414,14 @@ MHD_stop_daemon (struct MHD_Daemon *daemon)
{
if (!MHD_join_thread_ (daemon->pid))
{
- MHD_PANIC ("Failed to join a thread\n");
+ MHD_PANIC (_("Failed to join a thread\n"));
}
}
}
close_all_connections (daemon);
if ( (MHD_INVALID_SOCKET != fd) &&
(0 != MHD_socket_close_ (fd)) )
- MHD_PANIC ("close failed\n");
+ MHD_PANIC (_("close failed\n"));
/* TLS clean up */
#if HTTPS_SUPPORT
@@ -5281,12 +5441,12 @@ MHD_stop_daemon (struct MHD_Daemon *daemon)
if ( (0 != (daemon->options & MHD_USE_EPOLL)) &&
(-1 != daemon->epoll_fd) &&
(0 != MHD_socket_close_ (daemon->epoll_fd)) )
- MHD_PANIC ("close failed\n");
+ MHD_PANIC (_("close failed\n"));
#if HTTPS_SUPPORT
if ( (0 != (daemon->options & MHD_USE_EPOLL)) &&
(-1 != daemon->epoll_upgrade_fd) &&
(0 != MHD_socket_close_ (daemon->epoll_upgrade_fd)) )
- MHD_PANIC ("close failed\n");
+ MHD_PANIC (_("close failed\n"));
#endif
#endif
@@ -5300,9 +5460,9 @@ MHD_stop_daemon (struct MHD_Daemon *daemon)
if (MHD_INVALID_PIPE_ != daemon->wpipe[1])
{
if (0 != MHD_pipe_close_ (daemon->wpipe[0]))
- MHD_PANIC ("close failed\n");
+ MHD_PANIC (_("close failed\n"));
if (0 != MHD_pipe_close_ (daemon->wpipe[1]))
- MHD_PANIC ("close failed\n");
+ MHD_PANIC (_("close failed\n"));
}
free (daemon);
}
@@ -5397,7 +5557,9 @@ MHD_get_version (void)
static char ver[12] = "\0\0\0\0\0\0\0\0\0\0\0";
if (0 == ver[0])
{
- int res = MHD_snprintf_(ver, sizeof(ver), "%x.%x.%x",
+ int res = MHD_snprintf_(ver,
+ sizeof(ver),
+ "%x.%x.%x",
(((int)MHD_VERSION >> 24) & 0xFF),
(((int)MHD_VERSION >> 16) & 0xFF),
(((int)MHD_VERSION >> 8) & 0xFF));
@@ -5596,24 +5758,26 @@ MHD_init(void)
#ifdef _WIN32
if (0 != WSAStartup(MAKEWORD(2, 2), &wsd))
- MHD_PANIC ("Failed to initialize winsock\n");
+ MHD_PANIC (_("Failed to initialize winsock\n"));
mhd_winsock_inited_ = 1;
if (2 != LOBYTE(wsd.wVersion) && 2 != HIBYTE(wsd.wVersion))
- MHD_PANIC ("Winsock version 2.2 is not available\n");
+ MHD_PANIC (_("Winsock version 2.2 is not available\n"));
#endif
#if HTTPS_SUPPORT
#if GCRYPT_VERSION_NUMBER < 0x010600
#if defined(MHD_USE_POSIX_THREADS)
- if (0 != gcry_control (GCRYCTL_SET_THREAD_CBS, &gcry_threads_pthread))
- MHD_PANIC ("Failed to initialise multithreading in libgcrypt\n");
+ if (0 != gcry_control (GCRYCTL_SET_THREAD_CBS,
+ &gcry_threads_pthread))
+ MHD_PANIC (_("Failed to initialise multithreading in libgcrypt\n"));
#elif defined(MHD_W32_MUTEX_)
- if (0 != gcry_control (GCRYCTL_SET_THREAD_CBS, &gcry_threads_w32))
- MHD_PANIC ("Failed to initialise multithreading in libgcrypt\n");
+ if (0 != gcry_control (GCRYCTL_SET_THREAD_CBS,
+ &gcry_threads_w32))
+ MHD_PANIC (_("Failed to initialise multithreading in libgcrypt\n"));
#endif /* defined(MHD_W32_MUTEX_) */
gcry_check_version (NULL);
#else
if (NULL == gcry_check_version ("1.6.0"))
- MHD_PANIC ("libgcrypt is too old. MHD was compiled for libgcrypt 1.6.0 or newer\n");
+ MHD_PANIC (_("libgcrypt is too old. MHD was compiled for libgcrypt 1.6.0 or newer\n"));
#endif
gnutls_global_init ();
#endif