diff --git a/ChangeLog b/ChangeLog
index 3ce14755..9fede6ae 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -6,6 +6,12 @@ Wed 08 Apr 2020 10:53:01 PM CEST
the code more robust in the future. For conditional compilation, test
for "MHD_VERSION >= 0x00097002". -CG
+Tue 07 Apr 2020 02:58:39 PM BRT
+ Fixed #5501 (Added example for how to provide a tiny threaded websocket server). -SC
+
+Tue 31 Mar 2020 02:36:40 PM BRT
+ Fixed #6142 (applied several spelling fixes). -DKG/-SC
+
Sat 07 Mar 2020 05:20:33 PM CET
Fixed #6090 (misc. severe socket handling bugs on OS X). -CG
@@ -581,7 +587,7 @@ Sun Apr 23 20:05:44 CEST 2017
field names if MHD_USE_PEDANTIC_CHECKS is set. -CG
Sun Apr 23 19:20:33 CEST 2017
- Replace remaining occurences of sprintf() with
+ Replace remaining occurrences of sprintf() with
MHD_snprintf_(). Thanks to Ram for pointing this out. -CG
Sat Apr 22 20:39:00 MSK 2017
@@ -1180,7 +1186,7 @@ Tue Dec 1 10:01:12 CET 2015
Wed Nov 25 17:02:53 CET 2015
Remove 200ms delay observable with keep-alive on Darwin
- and *BSD platfroms. -EG
+ and *BSD platforms. -EG
Tue Nov 10 15:25:48 CET 2015
Fix issue with shutdown if connection was resumed just
@@ -1544,7 +1550,7 @@ Wed Mar 05 13:15:05 CET 2014
Changed configure flag from '--disable-pipe' to
'--enable-socketpair'.
Added configure flags '--disable-doc' and '--disable-examples'.
- Narrowed down extrenal lib specific compiler and linker flags
+ Narrowed down external lib specific compiler and linker flags
usage. -EG
Wed Feb 26 17:42:34 CET 2014
@@ -1650,7 +1656,7 @@ Tue Dec 3 21:05:38 CET 2013
Fri Nov 29 20:17:03 CET 2013
Eliminating theoretical stack overflow by limiting length
of URIs in authentication headers to 32k (only applicable
- if the application explicitly raised the memroy limits,
+ if the application explicitly raised the memory limits,
and only applies to MHD_digest_auth_check). Issue was
reported by Florian Weimer. -CG
@@ -1878,7 +1884,7 @@ Sun Mar 31 20:03:48 CEST 2013
at ~1500 MB/s on this system). -CG
Fri Mar 29 16:44:29 CET 2013
- Renaming testcases to consistenly begin with test_;
+ Renaming testcases to consistently begin with test_;
Changing build system to build examples in doc/.
Releasing libmicrohttpd 0.9.26. -CG
@@ -2598,11 +2604,11 @@ Sun May 17 03:29:46 MDT 2009
Fri May 15 11:00:20 MDT 2009
Grow reserved read buffer more aggressively so that we are not
- needlessly stuck reading only a handfull of bytes in each iteration. -CG
+ needlessly stuck reading only a handful of bytes in each iteration. -CG
Thu May 14 21:20:30 MDT 2009
Fixed issue where the "NOTIFY_COMPLETED" handler could be called
- twice (if a socket error or timeout occured for a pipelined
+ twice (if a socket error or timeout occurred for a pipelined
connection after successfully completing a request and before
the next request was successfully transmitted). This could
confuse applications not expecting to see a connection "complete"
@@ -2766,7 +2772,7 @@ Sat Apr 12 15:14:05 MDT 2008
Fixed a problem (introduced in 0.2.3) with handling very
large requests (the code did not return proper error code).
If "--enable-messages" is specified, the code now includes
- reasonable default HTML webpages for various build-in
+ reasonable default HTML webpages for various built-in
errors (such as request too large and malformed requests).
Without that flag, the webpages returned will still be
empty.
@@ -2892,7 +2898,7 @@ Sun Aug 26 03:11:46 MDT 2007
HTTP 400 status back if this is violated). - CG
Tue Aug 21 01:01:46 MDT 2007
- Fixing assertion failure that occured when a client
+ Fixing assertion failure that occurred when a client
closed the connection after sending some data but
not the full headers. - CG
diff --git a/configure.ac b/configure.ac
index 52789081..ae85dc0c 100644
--- a/configure.ac
+++ b/configure.ac
@@ -243,7 +243,7 @@ AX_CHECK_COMPILE_FLAG([[-Werror=attributes]],
CFLAGS="$save_CFLAGS"
],
[[errattr_CFLAGS=""]], [], [])
-AC_MSG_CHECKING([[for function inline keywords suppoted by $CC]])
+AC_MSG_CHECKING([[for function inline keywords supported by $CC]])
save_CFLAGS="$CFLAGS"
CFLAGS="$CFLAGS $errattr_CFLAGS"
inln_prfx="none"
@@ -319,7 +319,7 @@ AS_CASE(["$host_os"],
AC_MSG_RESULT([[$mhd_host_os]])],
[*solaris*],
[AC_DEFINE_UNQUOTED(SOLARIS,1,[This is a Solaris system])
- AC_DEFINE_UNQUOTED(_REENTRANT,1,[Need with solaris or errno doesnt work])
+ AC_DEFINE_UNQUOTED(_REENTRANT,1,[Need with solaris or errno does not work])
mhd_host_os='Solaris'
AC_MSG_RESULT([[$mhd_host_os]])
AC_SEARCH_LIBS(gethostbyname, nsl)
@@ -525,7 +525,7 @@ AC_INCLUDES_DEFAULT
)
])
- # Try to find how to set thread name for started thread - less convinent
+ # Try to find how to set thread name for started thread - less convenient
# than setting name by attributes.
# If pthread_setname_np(3) is not declared, it's not possible to detect
# form of pthread_setname_np(3) due to C "feature" "implicit declaration".
@@ -1095,7 +1095,7 @@ AC_INCLUDES_DEFAULT
])
])
-AS_IF([[test -z "$use_itc"]], [AC_MSG_ERROR([[cannot find useable type of inter-thread communication]])])
+AS_IF([[test -z "$use_itc"]], [AC_MSG_ERROR([[cannot find usable type of inter-thread communication]])])
AC_CHECK_FUNCS_ONCE([accept4 gmtime_r memmem snprintf])
diff --git a/contrib/uncrustify_precommit b/contrib/uncrustify_precommit
index fd29998c..24873330 100755
--- a/contrib/uncrustify_precommit
+++ b/contrib/uncrustify_precommit
@@ -30,6 +30,6 @@ if [ $RET = 1 ];
then
echo "Run"
echo "uncrustify --no-backup -c uncrustify.cfg ${crustified}"
- echo "before commiting."
+ echo "before committing."
fi
exit $RET
diff --git a/doc/chapters/basicauthentication.inc b/doc/chapters/basicauthentication.inc
index bbdd3641..cfcc96ff 100644
--- a/doc/chapters/basicauthentication.inc
+++ b/doc/chapters/basicauthentication.inc
@@ -14,7 +14,7 @@ GET /picture.png?mypassword
In the rare situation where the client is customized enough and the connection occurs
through secured lines (e.g., a embedded device directly attached to another via wire)
-and where the ability to embedd a password in the URI or to pass on a URI with a
+and where the ability to embed a password in the URI or to pass on a URI with a
password are desired, this can be a reasonable choice.
But when it is assumed that the user connecting does so with an ordinary Internet browser,
@@ -37,7 +37,7 @@ Initially, the pointer this parameter references is set by @emph{MHD} in the cal
also be "remembered" on the next call (for the same connection).
Thus, we will generate no response until the parameter is non-null---implying the callback was
called before at least once. We do not need to share information between different calls of the callback,
-so we can set the parameter to any adress that is assured to be not null. The pointer to the
+so we can set the parameter to any address that is assured to be not null. The pointer to the
@code{connection} structure will be pointing to a legal address, so we take this.
The first time @code{answer_to_connection} is called, we will not even look at the headers.
diff --git a/doc/chapters/hellobrowser.inc b/doc/chapters/hellobrowser.inc
index 983cfb6a..ac7a5fe1 100644
--- a/doc/chapters/hellobrowser.inc
+++ b/doc/chapters/hellobrowser.inc
@@ -116,7 +116,7 @@ information (which could be passed via the next parameter) so the next (sixth) p
we do not need to pass extra options to the daemon so we just write the MHD_OPTION_END as the last parameter.
As the server daemon runs in the background in its own thread, the execution flow in our main
-function will contine right after the call. Because of this, we must delay the execution flow in the
+function will continue right after the call. Because of this, we must delay the execution flow in the
main thread or else the program will terminate prematurely. We let it pause in a processing-time
friendly manner by waiting for the enter key to be pressed. In the end, we stop the daemon so it can
do its cleanup tasks.
@@ -161,7 +161,7 @@ right after the response has been transferred then. This is typically not what
disables HTTP pipelining. The correct approach is to simply not queue a message on the first
callback unless there is an error. The @code{void**} argument to the callback provides a location
for storing information about the history of the connection; for the first call, the pointer
-will point to NULL. A simplistic way to differenciate the first call from others is to check
+will point to NULL. A simplistic way to differentiate the first call from others is to check
if the pointer is NULL and set it to a non-NULL value during the first call.
Both of these issues you will find addressed in the official @code{minimal_example.c} residing in
diff --git a/doc/chapters/introduction.inc b/doc/chapters/introduction.inc
index 95caf9a5..2845d35b 100644
--- a/doc/chapters/introduction.inc
+++ b/doc/chapters/introduction.inc
@@ -19,5 +19,5 @@ built on similar systems.
@section History
This tutorial was originally written by Sebastian Gerhardt for MHD
-0.4.0. It was slighly polished and updated to MHD 0.9.0 by Christian
+0.4.0. It was slightly polished and updated to MHD 0.9.0 by Christian
Grothoff.
\ No newline at end of file
diff --git a/doc/chapters/largerpost.inc b/doc/chapters/largerpost.inc
index 1f60028f..11479382 100644
--- a/doc/chapters/largerpost.inc
+++ b/doc/chapters/largerpost.inc
@@ -49,7 +49,7 @@ We want the server to report internal errors, such as memory shortage or file ac
adequately.
@verbatim
const char* servererrorpage
- = "
An internal server error has occured.";
+ = "An internal server error has occurred.";
const char* fileexistspage
= "This file already exists.";
@end verbatim
diff --git a/doc/chapters/responseheaders.inc b/doc/chapters/responseheaders.inc
index ece7ce1c..0b1c67e2 100644
--- a/doc/chapters/responseheaders.inc
+++ b/doc/chapters/responseheaders.inc
@@ -60,7 +60,7 @@ server side and if so, the client should be informed with @code{MHD_HTTP_INTERNA
/* error accessing file */
if (fd != -1) close (fd);
const char *errorstr =
- "An internal server error has occured!\
+ "An internal server error has occurred!\
";
response =
MHD_create_response_from_buffer (strlen (errorstr),
@@ -79,7 +79,7 @@ server side and if so, the client should be informed with @code{MHD_HTTP_INTERNA
return MHD_NO;
if (!ret)
{
- const char *errorstr = "An internal server error has occured!\
+ const char *errorstr = "An internal server error has occurred!\
";
if (buffer) free(buffer);
@@ -120,7 +120,7 @@ But in the case of success a response will be constructed directly from the file
@end verbatim
@noindent
-Note that the response object will take care of closing the file desciptor for us.
+Note that the response object will take care of closing the file descriptor for us.
Up to this point, there was little new. The actual novelty is that we enhance the header with the
meta data about the content. Aware of the field's name we want to add, it is as easy as that:
diff --git a/doc/chapters/tlsauthentication.inc b/doc/chapters/tlsauthentication.inc
index 8bdfa764..fdb3d920 100644
--- a/doc/chapters/tlsauthentication.inc
+++ b/doc/chapters/tlsauthentication.inc
@@ -65,7 +65,7 @@ main ()
@end verbatim
@noindent
-and then we point the @emph{MHD} daemon to it upon initalization.
+and then we point the @emph{MHD} daemon to it upon initialization.
@verbatim
daemon = MHD_start_daemon (MHD_USE_INTERNAL_POLLING_THREAD | MHD_USE_SSL,
diff --git a/doc/examples/responseheaders.c b/doc/examples/responseheaders.c
index 5c0580b6..f1cf939c 100644
--- a/doc/examples/responseheaders.c
+++ b/doc/examples/responseheaders.c
@@ -43,7 +43,7 @@ answer_to_connection (void *cls, struct MHD_Connection *connection,
(0 != fstat (fd, &sbuf)) )
{
const char *errorstr =
- "An internal server error has occured!\
+ "An internal server error has occurred!\
";
/* error accessing file */
if (fd != -1)
diff --git a/doc/examples/sessions.c b/doc/examples/sessions.c
index adabc610..6d6cf5ba 100644
--- a/doc/examples/sessions.c
+++ b/doc/examples/sessions.c
@@ -557,7 +557,7 @@ post_iterator (void *cls,
* can be set with the MHD_OPTION_NOTIFY_COMPLETED).
* Initially, *con_cls will be NULL.
* @return MHS_YES if the connection was handled successfully,
- * MHS_NO if the socket must be closed due to a serios
+ * MHS_NO if the socket must be closed due to a serious
* error while handling the request
*/
static enum MHD_Result
diff --git a/doc/libmicrohttpd.texi b/doc/libmicrohttpd.texi
index e89f75ed..419cf44a 100644
--- a/doc/libmicrohttpd.texi
+++ b/doc/libmicrohttpd.texi
@@ -539,7 +539,7 @@ connections).
Enable optimizations to aggressively improve performance.
Currently, the optimizations this option enables are based on
-opportunistic reads and writes. Bascially, MHD will simply try to
+opportunistic reads and writes. Basically, MHD will simply try to
read or write or accept on a socket before checking that the socket is
ready for IO using the event loop mechanism. As the sockets are
non-blocking, this may fail (at a loss of performance), but generally
@@ -1761,7 +1761,7 @@ will be set to the timeout (in milliseconds).
@end table
Return @code{MHD_YES} on success, @code{MHD_NO} if timeouts are not used
-(or no connections exist that would necessiate the use of a timeout
+(or no connections exist that would necessitate the use of a timeout
right now).
@end deftypefun
diff --git a/m4/libgcrypt.m4 b/m4/libgcrypt.m4
index d89fe113..dd167f81 100644
--- a/m4/libgcrypt.m4
+++ b/m4/libgcrypt.m4
@@ -15,7 +15,7 @@
dnl AM_PATH_LIBGCRYPT([MINIMUM-VERSION,
dnl [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND ]]])
dnl Test for libgcrypt and define LIBGCRYPT_CFLAGS and LIBGCRYPT_LIBS.
-dnl MINIMUM-VERSION is a string with the version number optionalliy prefixed
+dnl MINIMUM-VERSION is a string with the version number optionally prefixed
dnl with the API version to also check the API compatibility. Example:
dnl a MINIMUM-VERSION of 1:1.2.5 won't pass the test unless the installed
dnl version of libgcrypt is at least 1.2.5 *and* the API number is 1. Using
diff --git a/m4/mhd_sys_extentions.m4 b/m4/mhd_sys_extentions.m4
index 51b8aeca..13da648e 100644
--- a/m4/mhd_sys_extentions.m4
+++ b/m4/mhd_sys_extentions.m4
@@ -333,7 +333,7 @@ ${mhd_mse_sys_features_src}
m4_ifblank([$1], [dnl
AH_TEMPLATE([[_XOPEN_SOURCE]], [Define to maximum value supported by system headers])dnl
AH_TEMPLATE([[_XOPEN_SOURCE_EXTENDED]], [Define to 1 if _XOPEN_SOURCE is defined to value less than 500 ]dnl
- [and system headers requre this symbol])dnl
+ [and system headers require this symbol])dnl
AH_TEMPLATE([[_XOPEN_VERSION]], [Define to maximum value supported by system headers if _XOPEN_SOURCE ]dnl
[is defined to value less than 500 and headers do not support _XOPEN_SOURCE_EXTENDED])dnl
AH_TEMPLATE([[_GNU_SOURCE]], [Define to 1 to enable GNU-related header features])dnl
@@ -436,8 +436,8 @@ AC_DEFUN([_MHD_CHECK_POSIX2008], [dnl
_MHD_CHECK_POSIX_FEATURES_SINGLE([
_MHD_BASIC_INCLUDES
[
-/* Check will be passed if ALL features are avalable
- * and failed if ANY feature is not avalable. */
+/* Check will be passed if ALL features are available
+ * and failed if ANY feature is not available. */
int main()
{
diff --git a/m4/pkg.m4 b/m4/pkg.m4
index 13a88901..f9075e56 100644
--- a/m4/pkg.m4
+++ b/m4/pkg.m4
@@ -86,7 +86,7 @@ dnl Check to see whether a particular set of modules exists. Similar to
dnl PKG_CHECK_MODULES(), but does not set variables or print errors.
dnl
dnl Please remember that m4 expands AC_REQUIRE([PKG_PROG_PKG_CONFIG])
-dnl only at the first occurence in configure.ac, so if the first place
+dnl only at the first occurrence in configure.ac, so if the first place
dnl it's called might be skipped (such as if it is within an "if", you
dnl have to call PKG_CHECK_EXISTS manually
AC_DEFUN([PKG_CHECK_EXISTS],
diff --git a/po/libmicrohttpd.pot b/po/libmicrohttpd.pot
index b6df2361..e36cd81e 100644
--- a/po/libmicrohttpd.pot
+++ b/po/libmicrohttpd.pot
@@ -72,7 +72,7 @@ msgid "Authentication failed, arguments do not match.\n"
msgstr ""
#: src/microhttpd/digestauth.c:1281
-msgid "digest size missmatch"
+msgid "digest size mismatch"
msgstr ""
#: src/microhttpd/digestauth.c:1374
diff --git a/src/examples/.gitignore b/src/examples/.gitignore
index 7fa3e9b8..7a64ff40 100644
--- a/src/examples/.gitignore
+++ b/src/examples/.gitignore
@@ -32,6 +32,7 @@
/https_echo_client_example.c
/authorization_example
upgrade_example
+websocket_threaded_example
/timeout
http_chunked_compression
http_compression
diff --git a/src/examples/Makefile.am b/src/examples/Makefile.am
index 5dcee4d2..1f0a65af 100644
--- a/src/examples/Makefile.am
+++ b/src/examples/Makefile.am
@@ -67,7 +67,8 @@ endif
if HAVE_POSIX_THREADS
if ENABLE_UPGRADE
noinst_PROGRAMS += \
- upgrade_example
+ upgrade_example \
+ websocket_threaded_example
endif
endif
@@ -104,6 +105,14 @@ upgrade_example_LDADD = \
$(top_builddir)/src/microhttpd/libmicrohttpd.la \
$(PTHREAD_LIBS)
+websocket_threaded_example_SOURCES = \
+ websocket_threaded_example.c
+websocket_threaded_example_CFLAGS = \
+ $(PTHREAD_CFLAGS) $(AM_CFLAGS)
+websocket_threaded_example_LDADD = \
+ $(top_builddir)/src/microhttpd/libmicrohttpd.la \
+ $(PTHREAD_LIBS)
+
timeout_SOURCES = \
timeout.c
timeout_LDADD = \
diff --git a/src/examples/demo.c b/src/examples/demo.c
index 978bd235..eb974d3a 100644
--- a/src/examples/demo.c
+++ b/src/examples/demo.c
@@ -204,7 +204,7 @@ static magic_t magic;
/**
- * Mark the given response as HTML for the brower.
+ * Mark the given response as HTML for the browser.
*
* @param response response to mark
*/
diff --git a/src/examples/demo_https.c b/src/examples/demo_https.c
index 2a60fcda..6e42f3a5 100644
--- a/src/examples/demo_https.c
+++ b/src/examples/demo_https.c
@@ -207,7 +207,7 @@ static magic_t magic;
/**
- * Mark the given response as HTML for the brower.
+ * Mark the given response as HTML for the browser.
*
* @param response response to mark
*/
diff --git a/src/examples/msgs_i18n.c b/src/examples/msgs_i18n.c
index e5f92bb5..56f9f501 100644
--- a/src/examples/msgs_i18n.c
+++ b/src/examples/msgs_i18n.c
@@ -24,7 +24,7 @@
*/
/*
- * suposing you are in Brazil:
+ * supposing you are in Brazil:
*
* # generate the PO file
* $ msginit --input=po/libmicrohttpd.pot --locale=pt_BR --output=libmicrohttpd.po
diff --git a/src/examples/post_example.c b/src/examples/post_example.c
index 55ca3aa8..9f4fbcf9 100644
--- a/src/examples/post_example.c
+++ b/src/examples/post_example.c
@@ -551,7 +551,7 @@ post_iterator (void *cls,
* can be set with the MHD_OPTION_NOTIFY_COMPLETED).
* Initially, *con_cls will be NULL.
* @return MHS_YES if the connection was handled successfully,
- * MHS_NO if the socket must be closed due to a serios
+ * MHS_NO if the socket must be closed due to a serious
* error while handling the request
*/
static enum MHD_Result
diff --git a/src/examples/websocket_threaded_example.c b/src/examples/websocket_threaded_example.c
new file mode 100644
index 00000000..69abb0f3
--- /dev/null
+++ b/src/examples/websocket_threaded_example.c
@@ -0,0 +1,863 @@
+/*
+ This file is part of libmicrohttpd
+ Copyright (C) 2020 Christian Grothoff (and other contributing authors)
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with this library; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
+ USA
+*/
+
+/**
+ * @file websocket_threaded_example.c
+ * @brief example for how to provide a tiny threaded websocket server
+ * @author Silvio Clecio (silvioprog)
+ */
+
+#include "platform.h"
+#include
+#include
+
+#define CHAT_PAGE \
+ "\n" \
+ "\n" \
+ "WebSocket chat\n" \
+ "\n" \
+ "\n" \
+ "\n" \
+ "\n" \
+ "
\n" \
+ "\n" \
+ "\n" \
+ ""
+#define BAD_REQUEST_PAGE \
+ "\n" \
+ "\n" \
+ "WebSocket chat\n" \
+ "\n" \
+ "\n" \
+ "Bad Request\n" \
+ "\n" \
+ "\n"
+#define UPGRADE_REQUIRED_PAGE \
+ "\n" \
+ "\n" \
+ "WebSocket chat\n" \
+ "\n" \
+ "\n" \
+ "Upgrade required\n" \
+ "\n" \
+ "\n"
+
+#define WS_SEC_WEBSOCKET_VERSION "13"
+#define WS_UPGRADE_VALUE "websocket"
+#define WS_GUID "258EAFA5-E914-47DA-95CA-C5AB0DC85B11"
+#define WS_GUID_LEN 36
+#define WS_KEY_LEN 24
+#define WS_KEY_GUID_LEN ((WS_KEY_LEN) + (WS_GUID_LEN))
+#define WS_FIN 128
+#define WS_OPCODE_TEXT_FRAME 1
+#define WS_OPCODE_CON_CLOSE_FRAME 8
+
+#define MAX_CLIENTS 10
+
+static int CLIENT_SOCKS[MAX_CLIENTS];
+
+static pthread_mutex_t MUTEX = PTHREAD_MUTEX_INITIALIZER;
+
+struct WsData
+{
+ struct MHD_UpgradeResponseHandle *urh;
+ MHD_socket sock;
+};
+
+/********** begin SHA-1 **********/
+
+#define SHA1HashSize 20
+
+#define SHA1CircularShift(bits, word) \
+ (((word) << (bits)) | ((word) >> (32 - (bits))))
+
+enum SHA1_RESULT
+{
+ SHA1_RESULT_SUCCESS = 0,
+ SHA1_RESULT_NULL = 1,
+ SHA1_RESULT_STATE_ERROR = 2
+};
+
+struct SHA1Context
+{
+ uint32_t intermediate_hash[SHA1HashSize / 4];
+ uint32_t length_low;
+ uint32_t length_high;
+ int_least16_t message_block_index;
+ uint8_t message_block[64];
+ int computed;
+ int corrupted;
+};
+
+static void
+SHA1ProcessMessageBlock (struct SHA1Context *context)
+{
+ const uint32_t K[] = { 0x5A827999, 0x6ED9EBA1, 0x8F1BBCDC, 0xCA62C1D6 };
+ int i;
+ uint32_t temp;
+ uint32_t W[80];
+ uint32_t A, B, C, D, E;
+ for (i = 0; i < 16; i++)
+ {
+ W[i] = context->message_block[i * 4] << 24;
+ W[i] |= context->message_block[i * 4 + 1] << 16;
+ W[i] |= context->message_block[i * 4 + 2] << 8;
+ W[i] |= context->message_block[i * 4 + 3];
+ }
+ for (i = 16; i < 80; i++)
+ {
+ W[i]
+ = SHA1CircularShift (1, W[i - 3] ^ W[i - 8] ^ W[i - 14] ^ W[i - 16]);
+ }
+ A = context->intermediate_hash[0];
+ B = context->intermediate_hash[1];
+ C = context->intermediate_hash[2];
+ D = context->intermediate_hash[3];
+ E = context->intermediate_hash[4];
+ for (i = 0; i < 20; i++)
+ {
+ temp = SHA1CircularShift (5, A) + ((B & C) | ((~B) & D)) + E + W[i]
+ + K[0];
+ E = D;
+ D = C;
+ C = SHA1CircularShift (30, B);
+ B = A;
+ A = temp;
+ }
+ for (i = 20; i < 40; i++)
+ {
+ temp = SHA1CircularShift (5, A) + (B ^ C ^ D) + E + W[i] + K[1];
+ E = D;
+ D = C;
+ C = SHA1CircularShift (30, B);
+ B = A;
+ A = temp;
+ }
+ for (i = 40; i < 60; i++)
+ {
+ temp = SHA1CircularShift (5, A) + ((B & C) | (B & D) | (C & D)) + E
+ + W[i] + K[2];
+ E = D;
+ D = C;
+ C = SHA1CircularShift (30, B);
+ B = A;
+ A = temp;
+ }
+ for (i = 60; i < 80; i++)
+ {
+ temp = SHA1CircularShift (5, A) + (B ^ C ^ D) + E + W[i] + K[3];
+ E = D;
+ D = C;
+ C = SHA1CircularShift (30, B);
+ B = A;
+ A = temp;
+ }
+ context->intermediate_hash[0] += A;
+ context->intermediate_hash[1] += B;
+ context->intermediate_hash[2] += C;
+ context->intermediate_hash[3] += D;
+ context->intermediate_hash[4] += E;
+ context->message_block_index = 0;
+}
+
+
+static void
+SHA1PadMessage (struct SHA1Context *context)
+{
+ if (context->message_block_index > 55)
+ {
+ context->message_block[context->message_block_index++] = 0x80;
+ while (context->message_block_index < 64)
+ {
+ context->message_block[context->message_block_index++] = 0;
+ }
+ SHA1ProcessMessageBlock (context);
+ while (context->message_block_index < 56)
+ {
+ context->message_block[context->message_block_index++] = 0;
+ }
+ }
+ else
+ {
+ context->message_block[context->message_block_index++] = 0x80;
+ while (context->message_block_index < 56)
+ {
+ context->message_block[context->message_block_index++] = 0;
+ }
+ }
+ context->message_block[56] = context->length_high >> 24;
+ context->message_block[57] = context->length_high >> 16;
+ context->message_block[58] = context->length_high >> 8;
+ context->message_block[59] = context->length_high;
+ context->message_block[60] = context->length_low >> 24;
+ context->message_block[61] = context->length_low >> 16;
+ context->message_block[62] = context->length_low >> 8;
+ context->message_block[63] = context->length_low;
+ SHA1ProcessMessageBlock (context);
+}
+
+
+static enum SHA1_RESULT
+SHA1Reset (struct SHA1Context *context)
+{
+ if (! context)
+ {
+ return SHA1_RESULT_NULL;
+ }
+ context->length_low = 0;
+ context->length_high = 0;
+ context->message_block_index = 0;
+ context->intermediate_hash[0] = 0x67452301;
+ context->intermediate_hash[1] = 0xEFCDAB89;
+ context->intermediate_hash[2] = 0x98BADCFE;
+ context->intermediate_hash[3] = 0x10325476;
+ context->intermediate_hash[4] = 0xC3D2E1F0;
+ context->computed = 0;
+ context->corrupted = 0;
+ return SHA1_RESULT_SUCCESS;
+}
+
+
+static enum SHA1_RESULT
+SHA1Result (struct SHA1Context *context, uint8_t Message_Digest[SHA1HashSize])
+{
+ int i;
+ if (! context || ! Message_Digest)
+ {
+ return SHA1_RESULT_NULL;
+ }
+ if (context->corrupted)
+ {
+ return context->corrupted;
+ }
+ if (! context->computed)
+ {
+ SHA1PadMessage (context);
+ for (i = 0; i < 64; ++i)
+ {
+ context->message_block[i] = 0;
+ }
+ context->length_low = 0;
+ context->length_high = 0;
+ context->computed = 1;
+ }
+ for (i = 0; i < SHA1HashSize; ++i)
+ {
+ Message_Digest[i]
+ = context->intermediate_hash[i >> 2] >> 8 * (3 - (i & 0x03));
+ }
+ return SHA1_RESULT_SUCCESS;
+}
+
+
+static enum SHA1_RESULT
+SHA1Input (struct SHA1Context *context, const uint8_t *message_array,
+ unsigned length)
+{
+ if (! length)
+ {
+ return SHA1_RESULT_SUCCESS;
+ }
+ if (! context || ! message_array)
+ {
+ return SHA1_RESULT_NULL;
+ }
+ if (context->computed)
+ {
+ context->corrupted = SHA1_RESULT_STATE_ERROR;
+ return SHA1_RESULT_STATE_ERROR;
+ }
+ if (context->corrupted)
+ {
+ return context->corrupted;
+ }
+ while (length-- && ! context->corrupted)
+ {
+ context->message_block[context->message_block_index++]
+ = (*message_array & 0xFF);
+ context->length_low += 8;
+ if (context->length_low == 0)
+ {
+ context->length_high++;
+ if (context->length_high == 0)
+ {
+ context->corrupted = 1;
+ }
+ }
+ if (context->message_block_index == 64)
+ {
+ SHA1ProcessMessageBlock (context);
+ }
+ message_array++;
+ }
+ return SHA1_RESULT_SUCCESS;
+}
+
+
+/********** end SHA-1 **********/
+
+/********** begin Base64 **********/
+
+ssize_t
+BASE64Encode (const void *in, size_t len, unsigned char **output)
+{
+#define FILLCHAR '='
+ const unsigned char *cvt = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
+ "abcdefghijklmnopqrstuvwxyz"
+ "0123456789+/";
+ const unsigned char *data = in;
+ unsigned char *opt;
+ ssize_t ret;
+ ssize_t i;
+ char c;
+ ret = 0;
+ opt = malloc (2 + (len * 4 / 3) + 8);
+ if (NULL == opt)
+ {
+ return -1;
+ }
+ for (i = 0; i < len; ++i)
+ {
+ c = (data[i] >> 2) & 0x3F;
+ opt[ret++] = cvt[(unsigned int) c];
+ c = (data[i] << 4) & 0x3F;
+ if (++i < len)
+ {
+ c |= (data[i] >> 4) & 0x0F;
+ }
+ opt[ret++] = cvt[(unsigned int) c];
+ if (i < len)
+ {
+ c = (data[i] << 2) & 0x3F;
+ if (++i < len)
+ {
+ c |= (data[i] >> 6) & 0x03;
+ }
+ opt[ret++] = cvt[(unsigned int) c];
+ }
+ else
+ {
+ ++i;
+ opt[ret++] = FILLCHAR;
+ }
+ if (i < len)
+ {
+ c = data[i] & 0x3F;
+ opt[ret++] = cvt[(unsigned int) c];
+ }
+ else
+ {
+ opt[ret++] = FILLCHAR;
+ }
+ }
+ *output = opt;
+ return ret;
+}
+
+
+/********** end Base64 **********/
+
+static int
+is_websocket_request (struct MHD_Connection *con, const char *upg_header,
+ const char *con_header)
+{
+ return (upg_header != NULL) && (con_header != NULL)
+ && (0 == strcmp (upg_header, WS_UPGRADE_VALUE))
+ && (NULL != strstr (con_header, "Upgrade"))
+ ? MHD_YES
+ : MHD_NO;
+}
+
+
+static int
+send_chat_page (struct MHD_Connection *con, uint16_t port)
+{
+ struct MHD_Response *res;
+ int ret;
+ res = MHD_create_response_from_buffer (strlen (CHAT_PAGE), (void *) CHAT_PAGE,
+ MHD_RESPMEM_PERSISTENT);
+ ret = MHD_queue_response (con, MHD_HTTP_OK, res);
+ MHD_destroy_response (res);
+ return ret;
+}
+
+
+static int
+send_bad_request (struct MHD_Connection *con)
+{
+ struct MHD_Response *res;
+ int ret;
+ res = MHD_create_response_from_buffer (strlen (BAD_REQUEST_PAGE),
+ (void *) BAD_REQUEST_PAGE,
+ MHD_RESPMEM_PERSISTENT);
+ ret = MHD_queue_response (con, MHD_HTTP_BAD_REQUEST, res);
+ MHD_destroy_response (res);
+ return ret;
+}
+
+
+static int
+send_upgrade_required (struct MHD_Connection *con)
+{
+ struct MHD_Response *res;
+ int ret;
+ res = MHD_create_response_from_buffer (strlen (UPGRADE_REQUIRED_PAGE),
+ (void *) UPGRADE_REQUIRED_PAGE,
+ MHD_RESPMEM_PERSISTENT);
+ MHD_add_response_header (res, MHD_HTTP_HEADER_SEC_WEBSOCKET_VERSION,
+ WS_SEC_WEBSOCKET_VERSION);
+ ret = MHD_queue_response (con, MHD_HTTP_UPGRADE_REQUIRED, res);
+ MHD_destroy_response (res);
+ return ret;
+}
+
+
+static int
+ws_get_accept_value (char *key, unsigned char **val)
+{
+ struct SHA1Context ctx;
+ unsigned char hash[SHA1HashSize];
+ char *str;
+ ssize_t len;
+ if (NULL == key)
+ {
+ return MHD_NO;
+ }
+ str = malloc (WS_KEY_LEN + WS_GUID_LEN + 1);
+ if (NULL == str)
+ {
+ return MHD_NO;
+ }
+ strcpy (str, key);
+ strcat (str, WS_GUID);
+ SHA1Reset (&ctx);
+ SHA1Input (&ctx, (const uint8_t *) str, WS_KEY_GUID_LEN);
+ SHA1Result (&ctx, hash);
+ free (str);
+ len = BASE64Encode (hash, SHA1HashSize, val);
+ if (-1 == len)
+ {
+ return MHD_NO;
+ }
+ (*val)[len] = '\0';
+ return MHD_YES;
+}
+
+
+static void
+make_blocking (MHD_socket fd)
+{
+#if defined(MHD_POSIX_SOCKETS)
+ int flags;
+ flags = fcntl (fd, F_GETFL);
+ if (-1 == flags)
+ return;
+ if ((flags & ~O_NONBLOCK) != flags)
+ if (-1 == fcntl (fd, F_SETFL, flags & ~O_NONBLOCK))
+ abort ();
+#elif defined(MHD_WINSOCK_SOCKETS)
+ unsigned long flags = 1;
+ ioctlsocket (fd, FIONBIO, &flags);
+#endif /* MHD_WINSOCK_SOCKETS */
+}
+
+
+static size_t
+send_all (MHD_socket sock, const char *buf, size_t len)
+{
+ ssize_t ret;
+ size_t off;
+ for (off = 0; off < len; off += ret)
+ {
+ ret = send (sock, &buf[off], len - off, 0);
+ if (0 > ret)
+ {
+ if (EAGAIN == errno)
+ {
+ ret = 0;
+ continue;
+ }
+ break;
+ }
+ if (0 == ret)
+ {
+ break;
+ }
+ }
+ return off;
+}
+
+
+static int
+ws_send_frame (int sock, const char *msg, size_t length)
+{
+ unsigned char *response;
+ unsigned char frame[10];
+ uint8_t idx_first_rdata;
+ int idx_response;
+ int output;
+ int isock;
+ int i;
+ frame[0] = (WS_FIN | WS_OPCODE_TEXT_FRAME);
+ if (length <= 125)
+ {
+ frame[1] = length & 0x7F;
+ idx_first_rdata = 2;
+ }
+ else if ((length >= 126) && (length <= 0xFFFF))
+ {
+ frame[1] = 126;
+ frame[2] = (length >> 8) & 0xFF;
+ frame[3] = length & 0xFF;
+ idx_first_rdata = 4;
+ }
+ else
+ {
+ frame[1] = 127;
+ frame[2] = (unsigned char) ((length >> 56) & 0xFF);
+ frame[3] = (unsigned char) ((length >> 48) & 0xFF);
+ frame[4] = (unsigned char) ((length >> 40) & 0xFF);
+ frame[5] = (unsigned char) ((length >> 32) & 0xFF);
+ frame[6] = (unsigned char) ((length >> 24) & 0xFF);
+ frame[7] = (unsigned char) ((length >> 16) & 0xFF);
+ frame[8] = (unsigned char) ((length >> 8) & 0xFF);
+ frame[9] = (unsigned char) (length & 0xFF);
+ idx_first_rdata = 10;
+ }
+ idx_response = 0;
+ response = malloc (idx_first_rdata + length + 1);
+ if (NULL == response)
+ {
+ return -1;
+ }
+ for (i = 0; i < idx_first_rdata; i++)
+ {
+ response[i] = frame[i];
+ idx_response++;
+ }
+ for (i = 0; i < length; i++)
+ {
+ response[idx_response] = msg[i];
+ idx_response++;
+ }
+ response[idx_response] = '\0';
+ output = 0;
+ pthread_mutex_lock (&MUTEX);
+ for (i = 0; i < MAX_CLIENTS; i++)
+ {
+ isock = CLIENT_SOCKS[i];
+ if ((isock > -1) && (isock != sock))
+ {
+ output += send_all (isock, response, idx_response);
+ }
+ }
+ pthread_mutex_unlock (&MUTEX);
+ free (response);
+ return output;
+}
+
+
+static unsigned char *
+ws_receive_frame (unsigned char *frame, ssize_t *length, int *type)
+{
+ unsigned char *msg;
+ uint8_t masks[4];
+ uint8_t mask;
+ uint8_t flength;
+ uint8_t idx_first_mask;
+ uint8_t idx_first_data;
+ ssize_t data_length;
+ int i;
+ int j;
+ msg = NULL;
+ if (frame[0] == (WS_FIN | WS_OPCODE_TEXT_FRAME))
+ {
+ *type = WS_OPCODE_TEXT_FRAME;
+ idx_first_mask = 2;
+ mask = frame[1];
+ flength = mask & 0x7F;
+ if (flength == 126)
+ {
+ idx_first_mask = 4;
+ }
+ else if (flength == 127)
+ {
+ idx_first_mask = 10;
+ }
+ idx_first_data = idx_first_mask + 4;
+ data_length = *length - idx_first_data;
+ masks[0] = frame[idx_first_mask + 0];
+ masks[1] = frame[idx_first_mask + 1];
+ masks[2] = frame[idx_first_mask + 2];
+ masks[3] = frame[idx_first_mask + 3];
+ msg = malloc (data_length + 1);
+ if (NULL != msg)
+ {
+ for (i = idx_first_data, j = 0; i < *length; i++, j++)
+ {
+ msg[j] = frame[i] ^ masks[j % 4];
+ }
+ *length = data_length;
+ msg[j] = '\0';
+ }
+ }
+ else if (frame[0] == (WS_FIN | WS_OPCODE_CON_CLOSE_FRAME))
+ {
+ *type = WS_OPCODE_CON_CLOSE_FRAME;
+ }
+ else
+ {
+ *type = frame[0] & 0x0F;
+ }
+ return msg;
+}
+
+
+static void *
+run_usock (void *cls)
+{
+ struct WsData *ws = cls;
+ struct MHD_UpgradeResponseHandle *urh = ws->urh;
+ unsigned char *msg;
+ unsigned char *text;
+ unsigned char client[20];
+ char buf[2048];
+ ssize_t got;
+ size_t size;
+ int type;
+ int sent;
+ int i;
+ make_blocking (ws->sock);
+ while (1)
+ {
+ got = recv (ws->sock, buf, sizeof (buf), 0);
+ if (0 >= got)
+ {
+ break;
+ }
+ msg = ws_receive_frame (buf, &got, &type);
+ if (NULL == msg)
+ {
+ break;
+ }
+ if (type == WS_OPCODE_TEXT_FRAME)
+ {
+ size = sprintf (client, "User#%d: ", ws->sock);
+ size += got;
+ text = malloc (size);
+ if (NULL != buf)
+ {
+ sprintf (text, "%s%s", client, msg);
+ sent = ws_send_frame (ws->sock, text, size);
+ }
+ else
+ {
+ sent = -1;
+ }
+ free (text);
+ free (msg);
+ if (-1 == sent)
+ {
+ break;
+ }
+ }
+ else
+ {
+ if (type == WS_OPCODE_CON_CLOSE_FRAME)
+ {
+ free (msg);
+ pthread_mutex_lock (&MUTEX);
+ for (i = 0; i < MAX_CLIENTS; i++)
+ {
+ if (CLIENT_SOCKS[i] == ws->sock)
+ {
+ CLIENT_SOCKS[i] = -1;
+ break;
+ }
+ }
+ pthread_mutex_unlock (&MUTEX);
+ break;
+ }
+ }
+ }
+ free (ws);
+ MHD_upgrade_action (urh, MHD_UPGRADE_ACTION_CLOSE);
+ return NULL;
+}
+
+
+static int
+uh_cb (void *cls, struct MHD_Connection *con, void *con_cls,
+ const char *extra_in, size_t extra_in_size, MHD_socket sock,
+ struct MHD_UpgradeResponseHandle *urh)
+{
+ struct WsData *ws;
+ pthread_t pt;
+ int sock_overflow;
+ int i;
+ (void) cls;
+ (void) con;
+ (void) con_cls;
+ sock_overflow = MHD_YES;
+ ws = malloc (sizeof (struct WsData));
+ if (NULL == ws)
+ abort ();
+ memset (ws, 0, sizeof (struct WsData));
+ ws->sock = sock;
+ ws->urh = urh;
+ pthread_mutex_lock (&MUTEX);
+ for (i = 0; i < MAX_CLIENTS; i++)
+ {
+ if (-1 == CLIENT_SOCKS[i])
+ {
+ CLIENT_SOCKS[i] = ws->sock;
+ sock_overflow = MHD_NO;
+ break;
+ }
+ }
+ if (sock_overflow)
+ {
+ free (ws);
+ MHD_upgrade_action (urh, MHD_UPGRADE_ACTION_CLOSE);
+ return;
+ }
+ pthread_mutex_unlock (&MUTEX);
+ if (0 != pthread_create (&pt, NULL, &run_usock, ws))
+ abort ();
+ /* Note that by detaching like this we make it impossible to ensure
+ a clean shutdown, as the we stop the daemon even if a worker thread
+ is still running. Alas, this is a simple example... */
+ pthread_detach (pt);
+}
+
+
+static int
+ahc_cb (void *cls, struct MHD_Connection *con, const char *url,
+ const char *method, const char *version, const char *upload_data,
+ size_t *upload_data_size, void **ptr)
+{
+ struct MHD_Response *res;
+ const char *upg_header;
+ const char *con_header;
+ const char *ws_version_header;
+ const char *ws_key_header;
+ char ws_ac_header[60];
+ char *ws_ac_value;
+ int ret;
+ (void) url;
+ (void) upload_data;
+ (void) upload_data_size;
+ if (NULL == *ptr)
+ {
+ *ptr = (void *) 1;
+ return MHD_YES;
+ }
+ *ptr = NULL;
+ upg_header = MHD_lookup_connection_value (con, MHD_HEADER_KIND,
+ MHD_HTTP_HEADER_UPGRADE);
+ con_header = MHD_lookup_connection_value (con, MHD_HEADER_KIND,
+ MHD_HTTP_HEADER_CONNECTION);
+ if (MHD_NO == is_websocket_request (con, upg_header, con_header))
+ {
+ return send_chat_page (con, *(uint16_t *) cls);
+ }
+ if ((0 != strcmp (method, MHD_HTTP_METHOD_GET))
+ || (0 != strcmp (version, MHD_HTTP_VERSION_1_1)))
+ {
+ return send_bad_request (con);
+ }
+ ws_version_header = MHD_lookup_connection_value (
+ con, MHD_HEADER_KIND, MHD_HTTP_HEADER_SEC_WEBSOCKET_VERSION);
+ if ((NULL == ws_version_header)
+ || (0 != strcmp (ws_version_header, WS_SEC_WEBSOCKET_VERSION)))
+ {
+ return send_upgrade_required (con);
+ }
+ ws_key_header = MHD_lookup_connection_value (
+ con, MHD_HEADER_KIND, MHD_HTTP_HEADER_SEC_WEBSOCKET_KEY);
+ if ((NULL == ws_key_header) || (strlen (ws_key_header) != 24))
+ {
+ return send_bad_request (con);
+ }
+ ret = ws_get_accept_value (ws_key_header, &ws_ac_value);
+ if (MHD_NO == ret)
+ {
+ return ret;
+ }
+ res = MHD_create_response_for_upgrade (&uh_cb, NULL);
+ MHD_add_response_header (res, MHD_HTTP_HEADER_UPGRADE, WS_UPGRADE_VALUE);
+ MHD_add_response_header (res, MHD_HTTP_HEADER_SEC_WEBSOCKET_ACCEPT,
+ ws_ac_value);
+ free (ws_ac_value);
+ ret = MHD_queue_response (con, MHD_HTTP_SWITCHING_PROTOCOLS, res);
+ MHD_destroy_response (res);
+ return ret;
+}
+
+
+int
+main (int argc, char *const *argv)
+{
+ struct MHD_Daemon *d;
+ uint16_t port;
+ if (argc != 2)
+ {
+ printf ("%s PORT\n", argv[0]);
+ return 1;
+ }
+ port = atoi (argv[1]);
+ d = MHD_start_daemon (MHD_ALLOW_UPGRADE | MHD_USE_AUTO_INTERNAL_THREAD
+ | MHD_USE_ERROR_LOG,
+ port, NULL, NULL, &ahc_cb, &port, MHD_OPTION_END);
+ if (NULL == d)
+ return 1;
+ memset (CLIENT_SOCKS, -1, sizeof (CLIENT_SOCKS));
+ (void) getc (stdin);
+ MHD_stop_daemon (d);
+ return 0;
+}
diff --git a/src/include/microhttpd.h b/src/include/microhttpd.h
index f0daa3df..00d4f9bd 100644
--- a/src/include/microhttpd.h
+++ b/src/include/microhttpd.h
@@ -43,7 +43,7 @@
*
* MHD understands POST data and is able to decode certain formats
* (at the moment only "application/x-www-form-urlencoded" and
- * "mulitpart/formdata"). Unsupported encodings and large POST
+ * "multipart/formdata"). Unsupported encodings and large POST
* submissions may require the application to manually process
* the stream, which is provided to the main application (and thus can be
* processed, just not conveniently by MHD).
@@ -132,7 +132,7 @@ typedef intptr_t ssize_t;
* Current version of the library.
* 0x01093001 = 1.9.30-1.
*/
-#define MHD_VERSION 0x00097001
+#define MHD_VERSION 0x00097002
/**
* Operational results from MHD calls.
@@ -530,7 +530,7 @@ MHD_get_reason_phrase_for (unsigned int code);
/**
* Flag to be or-ed with MHD_HTTP status code for
* SHOUTcast. This will cause the response to begin
- * with the SHOUTcast "ICY" line instad of "HTTP".
+ * with the SHOUTcast "ICY" line instead of "HTTP".
* @ingroup specialized
*/
#define MHD_ICY_FLAG ((uint32_t) (((uint32_t) 1) << 31))
@@ -1570,7 +1570,7 @@ enum MHD_OPTION
* of the buffer pointed to by the second argument in bytes.
* Note that the application must ensure that the buffer of the
* second argument remains allocated and unmodified while the
- * deamon is running.
+ * daemon is running.
*/
MHD_OPTION_DIGEST_AUTH_RANDOM = 17,
@@ -1636,7 +1636,7 @@ enum MHD_OPTION
* If present and set to true, allow reusing address:port socket
* (by using SO_REUSEPORT on most platform, or platform-specific ways).
* If present and set to false, disallow reusing address:port socket
- * (does nothing on most plaform, but uses SO_EXCLUSIVEADDRUSE on Windows).
+ * (does nothing on most platform, but uses SO_EXCLUSIVEADDRUSE on Windows).
* This option must be followed by a `unsigned int` argument.
*/
MHD_OPTION_LISTENING_ADDRESS_REUSE = 25,
@@ -2046,7 +2046,7 @@ enum MHD_ConnectionInfoType
/**
* Values of this enum are used to specify what
- * information about a deamon is desired.
+ * information about a daemon is desired.
*/
enum MHD_DaemonInfoType
{
@@ -2107,8 +2107,8 @@ enum MHD_DaemonInfoType
* an error message and `abort()`.
*
* @param cls user specified value
- * @param file where the error occured
- * @param line where the error occured
+ * @param file where the error occurred
+ * @param line where the error occurred
* @param reason error detail, may be NULL
* @ingroup logging
*/
@@ -2168,7 +2168,7 @@ typedef enum MHD_Result
* can be set with the #MHD_OPTION_NOTIFY_COMPLETED).
* Initially, `*con_cls` will be NULL.
* @return #MHD_YES if the connection was handled successfully,
- * #MHD_NO if the socket must be closed due to a serios
+ * #MHD_NO if the socket must be closed due to a serious
* error while handling the request
*/
typedef enum MHD_Result
@@ -3348,7 +3348,7 @@ MHD_create_response_for_upgrade (MHD_UpgradeHandler upgrade_handler,
* Destroy a response object and associated resources. Note that
* libmicrohttpd may keep some of the resources around if the response
* is still in the queue for some clients, so the memory may not
- * necessarily be freed immediatley.
+ * necessarily be freed immediately.
*
* @param response response to destroy
* @ingroup response
@@ -3584,7 +3584,7 @@ MHD_digest_auth_check2 (struct MHD_Connection *connection,
* Uses #MHD_DIGEST_ALG_MD5 (for now, for backwards-compatibility).
* Note that this MAY change to #MHD_DIGEST_ALG_AUTO in the future.
* If you want to be sure you get MD5, use #MHD_digest_auth_check2()
- * and specifiy MD5 explicitly.
+ * and specify MD5 explicitly.
*
* @param connection The MHD connection structure
* @param realm The realm presented to the client
diff --git a/src/include/microhttpd2.h b/src/include/microhttpd2.h
index 1262c7a8..7c1b5187 100644
--- a/src/include/microhttpd2.h
+++ b/src/include/microhttpd2.h
@@ -536,7 +536,7 @@ enum MHD_StatusCode
MHD_SC_TLS_DISABLED = 50000,
/**
- * The application attempted to setup TLS paramters before
+ * The application attempted to setup TLS parameters before
* enabling TLS.
*/
MHD_SC_TLS_BACKEND_UNINITIALIZED = 50003,
@@ -1469,7 +1469,7 @@ enum MHD_Method
* @param method the HTTP method used (#MHD_HTTP_METHOD_GET,
* #MHD_HTTP_METHOD_PUT, etc.)
* @return action how to proceed, NULL
- * if the socket must be closed due to a serios
+ * if the socket must be closed due to a serious
* error while handling the request
*/
typedef const struct MHD_Action *
@@ -2005,7 +2005,7 @@ MHD_NONNULL (1);
* If present true, allow reusing address:port socket (by using
* SO_REUSEPORT on most platform, or platform-specific ways). If
* present and set to false, disallow reusing address:port socket
- * (does nothing on most plaform, but uses SO_EXCLUSIVEADDRUSE on
+ * (does nothing on most platform, but uses SO_EXCLUSIVEADDRUSE on
* Windows).
* Ineffective in conjunction with #MHD_daemon_listen_socket().
*
@@ -2124,7 +2124,7 @@ MHD_NONNULL (1);
/**
* Use SHOUTcast. This will cause the response to begin
- * with the SHOUTcast "ICY" line instad of "HTTP".
+ * with the SHOUTcast "ICY" line instead of "HTTP".
*
* @param daemon daemon to set SHOUTcast option for
*/
@@ -2566,7 +2566,7 @@ MHD_NONNULL (1);
/**
* Set random values to be used by the Digest Auth module. Note that
* the application must ensure that @a buf remains allocated and
- * unmodified while the deamon is running.
+ * unmodified while the daemon is running.
*
* @param daemon daemon to configure
* @param buf_size number of bytes in @a buf
@@ -3886,7 +3886,7 @@ MHD_NONNULL (1,3);
/**
* Values of this enum are used to specify what
- * information about a deamon is desired.
+ * information about a daemon is desired.
*/
enum MHD_DaemonInformationType
{
@@ -3996,8 +3996,8 @@ MHD_NONNULL (1,3);
* an error message and `abort()`.
*
* @param cls user specified value
- * @param file where the error occured
- * @param line where the error occured
+ * @param file where the error occurred
+ * @param line where the error occurred
* @param reason error detail, may be NULL
* @ingroup logging
*/
diff --git a/src/lib/connection_add.c b/src/lib/connection_add.c
index be75946d..878380ae 100644
--- a/src/lib/connection_add.c
+++ b/src/lib/connection_add.c
@@ -1044,7 +1044,7 @@ MHD_accept_connection_ (struct MHD_Daemon *daemon)
{
const int err = MHD_socket_get_error_ ();
- /* This could be a common occurance with multiple worker threads */
+ /* This could be a common occurrence with multiple worker threads */
if (MHD_SCKT_ERR_IS_ (err,
MHD_SCKT_EINVAL_))
return MHD_SC_DAEMON_ALREADY_SHUTDOWN; /* can happen during shutdown, let's hope this is the cause... */
diff --git a/src/lib/connection_call_handlers.c b/src/lib/connection_call_handlers.c
index 148e6345..fa79952b 100644
--- a/src/lib/connection_call_handlers.c
+++ b/src/lib/connection_call_handlers.c
@@ -158,7 +158,7 @@ MHD_conn_init_static_ (void)
/**
- * A serious error occured, close the
+ * A serious error occurred, close the
* connection (and notify the application).
*
* @param connection connection to close with error
diff --git a/src/lib/daemon_destroy.c b/src/lib/daemon_destroy.c
index 41e5c057..e40ff520 100644
--- a/src/lib/daemon_destroy.c
+++ b/src/lib/daemon_destroy.c
@@ -30,7 +30,7 @@
/**
* Stop all worker threads from the worker pool.
*
- * @param daemon master daemon controling the workers
+ * @param daemon master daemon controlling the workers
*/
static void
stop_workers (struct MHD_Daemon *daemon)
diff --git a/src/lib/daemon_options.c b/src/lib/daemon_options.c
index 04c9cb2f..fa84fe83 100644
--- a/src/lib/daemon_options.c
+++ b/src/lib/daemon_options.c
@@ -233,7 +233,7 @@ MHD_daemon_listen_backlog (struct MHD_Daemon *daemon,
* If present true, allow reusing address:port socket (by using
* SO_REUSEPORT on most platform, or platform-specific ways). If
* present and set to false, disallow reusing address:port socket
- * (does nothing on most plaform, but uses SO_EXCLUSIVEADDRUSE on
+ * (does nothing on most platform, but uses SO_EXCLUSIVEADDRUSE on
* Windows).
* Ineffective in conjunction with #MHD_daemon_listen_socket().
*
@@ -248,7 +248,7 @@ MHD_daemon_listen_allow_address_reuse (struct MHD_Daemon *daemon)
/**
* Use SHOUTcast. This will cause the response to begin
- * with the SHOUTcast "ICY" line instad of "HTTP".
+ * with the SHOUTcast "ICY" line instead of "HTTP".
*
* @param daemon daemon to set SHOUTcast option for
*/
@@ -452,7 +452,7 @@ MHD_daemon_tls_mem_dhparams (struct MHD_Daemon *daemon,
/**
* Memory pointer for the certificate (ca.pem) to be used by the
- * HTTPS daemon for client authentification.
+ * HTTPS daemon for client authentication.
*
* @param daemon daemon to configure tls for
* @param mem_trust memory pointer to the certificate
@@ -707,7 +707,7 @@ MHD_daemon_unescape_cb (struct MHD_Daemon *daemon,
/**
* Set random values to be used by the Digest Auth module. Note that
* the application must ensure that @a buf remains allocated and
- * unmodified while the deamon is running.
+ * unmodified while the daemon is running.
*
* @param daemon daemon to configure
* @param buf_size number of bytes in @a buf
diff --git a/src/lib/internal.h b/src/lib/internal.h
index 6c43fc20..c9971999 100644
--- a/src/lib/internal.h
+++ b/src/lib/internal.h
@@ -1410,7 +1410,7 @@ struct MHD_Daemon
struct MHD_itc_ itc;
/**
- * Which threading mode do we use? Postive
+ * Which threading mode do we use? Positive
* numbers indicate the number of worker threads to be used.
* Values larger than 1 imply a thread pool.
*/
diff --git a/src/microhttpd/connection.c b/src/microhttpd/connection.c
index 5d4df248..44fc86a2 100644
--- a/src/microhttpd/connection.c
+++ b/src/microhttpd/connection.c
@@ -835,7 +835,7 @@ MHD_connection_finish_forward_ (struct MHD_Connection *connection)
/**
- * A serious error occured, close the
+ * A serious error occurred, close the
* connection (and notify the application).
*
* @param connection connection to close with error
diff --git a/src/microhttpd/daemon.c b/src/microhttpd/daemon.c
index f23080ef..660ee61e 100644
--- a/src/microhttpd/daemon.c
+++ b/src/microhttpd/daemon.c
@@ -3223,7 +3223,7 @@ MHD_accept_connection (struct MHD_Daemon *daemon)
{
const int err = MHD_socket_get_error_ ();
- /* This could be a common occurance with multiple worker threads */
+ /* This could be a common occurrence with multiple worker threads */
if (MHD_SCKT_ERR_IS_ (err,
MHD_SCKT_EINVAL_))
return MHD_NO; /* can happen during shutdown */
diff --git a/src/microhttpd/digestauth.c b/src/microhttpd/digestauth.c
index 1fc931ad..49ce4dce 100644
--- a/src/microhttpd/digestauth.c
+++ b/src/microhttpd/digestauth.c
@@ -1140,7 +1140,7 @@ digest_auth_check_all (struct MHD_Connection *connection,
* Uses #MHD_DIGEST_ALG_MD5 (for now, for backwards-compatibility).
* Note that this MAY change to #MHD_DIGEST_ALG_AUTO in the future.
* If you want to be sure you get MD5, use #MHD_digest_auth_check2
- * and specifiy MD5 explicitly.
+ * and specify MD5 explicitly.
*
* @param connection The MHD connection structure
* @param realm The realm presented to the client
@@ -1278,7 +1278,7 @@ MHD_digest_auth_check_digest2 (struct MHD_Connection *connection,
mhd_assert (NULL != digest);
if (da.digest_size != digest_size)
- MHD_PANIC (_ ("digest size missmatch")); /* API violation! */
+ MHD_PANIC (_ ("digest size mismatch")); /* API violation! */
return digest_auth_check_all (connection,
&da,
realm,
diff --git a/src/microhttpd/internal.h b/src/microhttpd/internal.h
index d5d9b0d1..4cec6787 100644
--- a/src/microhttpd/internal.h
+++ b/src/microhttpd/internal.h
@@ -1546,7 +1546,7 @@ struct MHD_Daemon
volatile bool shutdown;
/**
- * Has this deamon been quiesced via #MHD_quiesce_daemon()?
+ * Has this daemon been quiesced via #MHD_quiesce_daemon()?
* If so, we should no longer use the @e listen_fd (including
* removing it from the @e epoll_fd when possible).
*/
diff --git a/src/microhttpd/memorypool.h b/src/microhttpd/memorypool.h
index 6f5d539d..2d1fd119 100644
--- a/src/microhttpd/memorypool.h
+++ b/src/microhttpd/memorypool.h
@@ -44,7 +44,7 @@
struct MemoryPool;
/**
- * Initilise values for memory pools
+ * Initialize values for memory pools
*/
void
MHD_init_mem_pools_ (void);
diff --git a/src/microhttpd/mhd_bithelpers.h b/src/microhttpd/mhd_bithelpers.h
index 34e49d15..e023bf12 100644
--- a/src/microhttpd/mhd_bithelpers.h
+++ b/src/microhttpd/mhd_bithelpers.h
@@ -100,7 +100,7 @@
#define _MHD_PUT_64BIT_LE(addr, value64) \
((*(uint64_t*) (addr)) = _MHD_BYTES_SWAP64 (value64))
#else /* _MHD_BYTE_ORDER != _MHD_BIG_ENDIAN */
-/* Endianess was not detected or non-standard like PDP-endian */
+/* Endianness was not detected or non-standard like PDP-endian */
#define _MHD_PUT_64BIT_LE(addr, value64) do { \
((uint8_t*) (addr))[0] = (uint8_t) ((uint64_t) (value64)); \
((uint8_t*) (addr))[1] = (uint8_t) (((uint64_t) (value64)) >> 8); \
@@ -124,7 +124,7 @@
#define _MHD_PUT_32BIT_LE(addr, value32) \
((*(uint32_t*) (addr)) = _MHD_BYTES_SWAP32 (value32))
#else /* _MHD_BYTE_ORDER != _MHD_BIG_ENDIAN */
-/* Endianess was not detected or non-standard like PDP-endian */
+/* Endianness was not detected or non-standard like PDP-endian */
#define _MHD_PUT_32BIT_LE(addr, value32) do { \
((uint8_t*) (addr))[0] = (uint8_t) ((uint32_t) (value32)); \
((uint8_t*) (addr))[1] = (uint8_t) (((uint32_t) (value32)) >> 8); \
@@ -144,7 +144,7 @@
#define _MHD_GET_32BIT_LE(addr) \
_MHD_BYTES_SWAP32 (*(const uint32_t*) (addr))
#else /* _MHD_BYTE_ORDER != _MHD_BIG_ENDIAN */
-/* Endianess was not detected or non-standard like PDP-endian */
+/* Endianness was not detected or non-standard like PDP-endian */
#define _MHD_GET_32BIT_LE(addr) \
( ( (uint32_t) (((const uint8_t*) addr)[0])) \
| (((uint32_t) (((const uint8_t*) addr)[1])) << 8) \
@@ -164,7 +164,7 @@
#define _MHD_PUT_64BIT_BE(addr, value64) \
((*(uint64_t*) (addr)) = _MHD_BYTES_SWAP64 (value64))
#else /* _MHD_BYTE_ORDER != _MHD_LITTLE_ENDIAN */
-/* Endianess was not detected or non-standard like PDP-endian */
+/* Endianness was not detected or non-standard like PDP-endian */
#define _MHD_PUT_64BIT_BE(addr, value64) do { \
((uint8_t*) (addr))[7] = (uint8_t) ((uint64_t) (value64)); \
((uint8_t*) (addr))[6] = (uint8_t) (((uint64_t) (value64)) >> 8); \
@@ -188,7 +188,7 @@
#define _MHD_PUT_32BIT_BE(addr, value32) \
((*(uint32_t*) (addr)) = _MHD_BYTES_SWAP32 (value32))
#else /* _MHD_BYTE_ORDER != _MHD_LITTLE_ENDIAN */
-/* Endianess was not detected or non-standard like PDP-endian */
+/* Endianness was not detected or non-standard like PDP-endian */
#define _MHD_PUT_32BIT_BE(addr, value32) do { \
((uint8_t*) (addr))[3] = (uint8_t) ((uint32_t) (value32)); \
((uint8_t*) (addr))[2] = (uint8_t) (((uint32_t) (value32)) >> 8); \
@@ -208,7 +208,7 @@
#define _MHD_GET_32BIT_BE(addr) \
_MHD_BYTES_SWAP32 (*(const uint32_t*) (addr))
#else /* _MHD_BYTE_ORDER != _MHD_LITTLE_ENDIAN */
-/* Endianess was not detected or non-standard like PDP-endian */
+/* Endianness was not detected or non-standard like PDP-endian */
#define _MHD_GET_32BIT_BE(addr) \
( (((uint32_t) (((const uint8_t*) addr)[0])) << 24) \
| (((uint32_t) (((const uint8_t*) addr)[1])) << 16) \
diff --git a/src/microhttpd/mhd_send.c b/src/microhttpd/mhd_send.c
index b0c0842b..cc75bbde 100644
--- a/src/microhttpd/mhd_send.c
+++ b/src/microhttpd/mhd_send.c
@@ -86,11 +86,11 @@ pre_cork_setsockopt (struct MHD_Connection *connection,
#endif
break;
case EFAULT:
- /* wopsie, should at leats log this, FIXME: maybe die */
+ /* wopsie, should at least log this, FIXME: maybe die */
#ifdef HAVE_MESSAGES
MHD_DLOG (connection->daemon,
_ (
- "The addresss pointed to by optval is not a valid part of the process address space: %s\n"),
+ "The address pointed to by optval is not a valid part of the process address space: %s\n"),
MHD_socket_last_strerr_ ());
#endif
break;
@@ -173,11 +173,11 @@ post_cork_setsockopt (struct MHD_Connection *connection,
#endif
break;
case EFAULT:
- /* wopsie, should at leats log this, FIXME: maybe die */
+ /* wopsie, should at least log this, FIXME: maybe die */
#ifdef HAVE_MESSAGES
MHD_DLOG (connection->daemon,
_ (
- "The addresss pointed to by optval is not a valid part of the process address space: %s\n"),
+ "The address pointed to by optval is not a valid part of the process address space: %s\n"),
MHD_socket_last_strerr_ ());
#endif
break;
diff --git a/src/microhttpd/test_md5.c b/src/microhttpd/test_md5.c
index 2825c09f..9d3ff63f 100644
--- a/src/microhttpd/test_md5.c
+++ b/src/microhttpd/test_md5.c
@@ -243,16 +243,16 @@ bin2hex (const uint8_t *bin,
static int
check_result (const char *test_name,
unsigned int check_num,
- const uint8_t calcualted[MD5_DIGEST_SIZE],
+ const uint8_t calculated[MD5_DIGEST_SIZE],
const uint8_t expected[MD5_DIGEST_SIZE])
{
- int failed = memcmp (calcualted, expected, MD5_DIGEST_SIZE);
+ int failed = memcmp (calculated, expected, MD5_DIGEST_SIZE);
check_num++; /* Print 1-based numbers */
if (failed)
{
char calc_str[MD5_DIGEST_STRING_LENGTH];
char expc_str[MD5_DIGEST_STRING_LENGTH];
- bin2hex (calcualted, MD5_DIGEST_SIZE, calc_str);
+ bin2hex (calculated, MD5_DIGEST_SIZE, calc_str);
bin2hex (expected, MD5_DIGEST_SIZE, expc_str);
fprintf (stderr,
"FAILED: %s check %u: calculated digest %s, expected digest %s.\n",
@@ -262,7 +262,7 @@ check_result (const char *test_name,
else if (verbose)
{
char calc_str[MD5_DIGEST_STRING_LENGTH];
- bin2hex (calcualted, MD5_DIGEST_SIZE, calc_str);
+ bin2hex (calculated, MD5_DIGEST_SIZE, calc_str);
printf (
"PASSED: %s check %u: calculated digest %s match expected digest.\n",
test_name, check_num, calc_str);
diff --git a/src/microhttpd/test_sha256.c b/src/microhttpd/test_sha256.c
index 54cdf027..7ad5f399 100644
--- a/src/microhttpd/test_sha256.c
+++ b/src/microhttpd/test_sha256.c
@@ -289,16 +289,16 @@ bin2hex (const uint8_t *bin,
static int
check_result (const char *test_name,
unsigned int check_num,
- const uint8_t calcualted[SHA256_DIGEST_SIZE],
+ const uint8_t calculated[SHA256_DIGEST_SIZE],
const uint8_t expected[SHA256_DIGEST_SIZE])
{
- int failed = memcmp (calcualted, expected, SHA256_DIGEST_SIZE);
+ int failed = memcmp (calculated, expected, SHA256_DIGEST_SIZE);
check_num++; /* Print 1-based numbers */
if (failed)
{
char calc_str[SHA256_DIGEST_STRING_SIZE];
char expc_str[SHA256_DIGEST_STRING_SIZE];
- bin2hex (calcualted, SHA256_DIGEST_SIZE, calc_str);
+ bin2hex (calculated, SHA256_DIGEST_SIZE, calc_str);
bin2hex (expected, SHA256_DIGEST_SIZE, expc_str);
fprintf (stderr,
"FAILED: %s check %u: calculated digest %s, expected digest %s.\n",
@@ -308,7 +308,7 @@ check_result (const char *test_name,
else if (verbose)
{
char calc_str[SHA256_DIGEST_STRING_SIZE];
- bin2hex (calcualted, SHA256_DIGEST_SIZE, calc_str);
+ bin2hex (calculated, SHA256_DIGEST_SIZE, calc_str);
printf (
"PASSED: %s check %u: calculated digest %s match expected digest.\n",
test_name, check_num, calc_str);
diff --git a/src/microhttpd/test_upgrade.c b/src/microhttpd/test_upgrade.c
index b3aecafa..fd9c2537 100644
--- a/src/microhttpd/test_upgrade.c
+++ b/src/microhttpd/test_upgrade.c
@@ -279,7 +279,7 @@ wr_create_from_plain_sckt (MHD_socket plain_sk)
* Connect socket to specified address.
* @param s socket to use
* @param addr address to connect
- * @param length of sturcture pointed by @a addr
+ * @param length of structure pointed by @a addr
* @return zero on success, -1 otherwise.
*/
static int
@@ -840,7 +840,7 @@ upgrade_cb (void *cls,
* can be set with the #MHD_OPTION_NOTIFY_COMPLETED).
* Initially, `*con_cls` will be NULL.
* @return #MHD_YES if the connection was handled successfully,
- * #MHD_NO if the socket must be closed due to a serios
+ * #MHD_NO if the socket must be closed due to a serious
* error while handling the request
*/
static enum MHD_Result
diff --git a/src/microhttpd/test_upgrade_large.c b/src/microhttpd/test_upgrade_large.c
index d8d35838..43c04b7f 100644
--- a/src/microhttpd/test_upgrade_large.c
+++ b/src/microhttpd/test_upgrade_large.c
@@ -289,7 +289,7 @@ wr_create_from_plain_sckt (MHD_socket plain_sk)
* Connect socket to specified address.
* @param s socket to use
* @param addr address to connect
- * @param length of sturcture pointed by @a addr
+ * @param length of structure pointed by @a addr
* @return zero on success, -1 otherwise.
*/
static int
@@ -864,7 +864,7 @@ upgrade_cb (void *cls,
* can be set with the #MHD_OPTION_NOTIFY_COMPLETED).
* Initially, `*con_cls` will be NULL.
* @return #MHD_YES if the connection was handled successfully,
- * #MHD_NO if the socket must be closed due to a serios
+ * #MHD_NO if the socket must be closed due to a serious
* error while handling the request
*/
static enum MHD_Result
diff --git a/src/testcurl/https/test_empty_response.c b/src/testcurl/https/test_empty_response.c
index 28430388..8e1ef1a8 100644
--- a/src/testcurl/https/test_empty_response.c
+++ b/src/testcurl/https/test_empty_response.c
@@ -20,7 +20,7 @@
/**
* @file test_empty_response.c
- * @brief Testcase for libmicrohttpd HTTPS GET operations with emtpy reply
+ * @brief Testcase for libmicrohttpd HTTPS GET operations with empty reply
* @author Christian Grothoff
*/
#include "platform.h"
diff --git a/src/testcurl/https/test_https_get_parallel.c b/src/testcurl/https/test_https_get_parallel.c
index e4040874..aa7f8d58 100644
--- a/src/testcurl/https/test_https_get_parallel.c
+++ b/src/testcurl/https/test_https_get_parallel.c
@@ -60,7 +60,7 @@ https_transfer_thread_adapter (void *args)
struct https_test_data *cargs = args;
int ret;
- /* time spread incomming requests */
+ /* time spread incoming requests */
usleep ((useconds_t) 10.0 * ((double) rand ()) / ((double) RAND_MAX));
ret = test_https_transfer (NULL, cargs->port,
cargs->cipher_suite, cargs->proto_version);
@@ -98,7 +98,7 @@ test_single_client (void *cls, int port, const char *cipher_suite,
*
* @return: 0 upon all client requests returning '0', -1 otherwise.
*
- * TODO : make client_count a parameter - numver of curl client threads to spawn
+ * TODO : make client_count a parameter - number of curl client threads to spawn
*/
static int
test_parallel_clients (void *cls, int port, const char *cipher_suite,
diff --git a/src/testcurl/https/test_https_get_parallel_threads.c b/src/testcurl/https/test_https_get_parallel_threads.c
index 3fc0e189..470072cb 100644
--- a/src/testcurl/https/test_https_get_parallel_threads.c
+++ b/src/testcurl/https/test_https_get_parallel_threads.c
@@ -61,7 +61,7 @@ https_transfer_thread_adapter (void *args)
struct https_test_data *cargs = args;
int ret;
- /* time spread incomming requests */
+ /* time spread incoming requests */
usleep ((useconds_t) 10.0 * ((double) rand ()) / ((double) RAND_MAX));
ret = test_https_transfer (cargs->cls, cargs->port,
cargs->cipher_suite, cargs->proto_version);
@@ -76,7 +76,7 @@ https_transfer_thread_adapter (void *args)
*
* @return: 0 upon all client requests returning '0', -1 otherwise.
*
- * TODO : make client_count a parameter - numver of curl client threads to spawn
+ * TODO : make client_count a parameter - number of curl client threads to spawn
*/
static int
test_single_client (void *cls, int port, const char *cipher_suite,
@@ -99,7 +99,7 @@ test_single_client (void *cls, int port, const char *cipher_suite,
*
* @return: 0 upon all client requests returning '0', -1 otherwise.
*
- * TODO : make client_count a parameter - numver of curl client threads to spawn
+ * TODO : make client_count a parameter - number of curl client threads to spawn
*/
static int
test_parallel_clients (void *cls, int port, const char *cipher_suite,
diff --git a/src/testcurl/https/tls_test_common.c b/src/testcurl/https/tls_test_common.c
index a704be5f..1d24c701 100644
--- a/src/testcurl/https/tls_test_common.c
+++ b/src/testcurl/https/tls_test_common.c
@@ -401,7 +401,7 @@ test_https_transfer (void *cls,
goto cleanup;
}
- /* compare test file & daemon responce */
+ /* compare test file & daemon response */
if ( (len != strlen (test_data)) ||
(memcmp (cbc.buf,
test_data,