gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[libmicrohttpd] branch master updated (a3ce7049 -> 0179be6c)


From: gnunet
Subject: [libmicrohttpd] branch master updated (a3ce7049 -> 0179be6c)
Date: Mon, 25 Apr 2022 15:08:24 +0200

This is an automated email from the git hooks/post-receive script.

karlson2k pushed a change to branch master
in repository libmicrohttpd.

    from a3ce7049 test_https_sni: limit to libcrul with certain TLS backends.
     new 48d7bc54 MHD_start_daemon: simplified logic for AUTO flags
     new a263d605 daemon.c: added prototypes for non-static functions
     new f80da0ba autoinit_funcs.h: added functions prototypes
     new 33b4a2d9 autoinit_funcs.h: improved formatting
     new 351d8a65 Fixed old-style functions definitions
     new 0fa1c675 websocket_threaded_example: mark function as static
     new ca236320 basicauth: very minor optimisaion
     new 6f4d2a44 configure: changed warning compiler flags
     new 8c87442f Fixed many macros
     new 763db792 microhttpd2.h: fixed code style
     new e152c9c4 test_shutdown_select: fixed code style
     new d1c74589 src/examples: fixed printf format specifiers
     new 28f02d2e doc/examples: do not use non-literals for printf()
     new ec2d818c doc/examples: improved formatting
     new 5c1e130e doc/examples: avoid usage of unportable functions
     new a4036e66 daemon.c: fixed possible unaligned access to 'struct 
sockaddr_in'
     new 31491782 MHD_get_connection_info(): Fixed possible unaligned access
     new a08e765f mhd_bithelpers: minor improvement of internal macros
     new c4c111d4 md5.c: muted compiler alignment warnings
     new 2a01697d sha256.c: fixed coding style
     new 5da78f9d sha256.c: muted alignment warnings
     new 851b4061 sha1.c: fixed coding style
     new 9c7c06d8 sha1.c: muted alignment warnings
     new 2d367411 MHD_get_daemon_info(): fixed unaligned memory access
     new 3318729c Removed unneeded anymore alignment workarounds.
     new 0179be6c test_postprocessor: fixed typo

The 26 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 configure.ac                              |  6 +-
 doc/examples/largepost.c                  | 20 +++----
 doc/examples/logging.c                    |  2 +-
 doc/examples/responseheaders.c            |  2 +-
 doc/examples/sessions.c                   | 86 +++++++++++++++--------------
 doc/examples/simplepost.c                 | 20 +++----
 doc/examples/tlsauthentication.c          |  2 +-
 src/examples/benchmark.c                  |  2 +-
 src/examples/benchmark_https.c            |  2 +-
 src/examples/demo.c                       |  4 +-
 src/examples/demo_https.c                 |  2 +-
 src/examples/post_example.c               |  2 +-
 src/examples/websocket_threaded_example.c |  2 +-
 src/include/autoinit_funcs.h              | 32 ++++++-----
 src/include/microhttpd.h                  | 17 +++---
 src/include/microhttpd2.h                 | 12 ++--
 src/include/platform.h                    |  2 +-
 src/microhttpd/basicauth.c                |  2 +-
 src/microhttpd/connection.c               | 56 +++++++++++++------
 src/microhttpd/daemon.c                   | 91 +++++++++++++++----------------
 src/microhttpd/internal.h                 | 51 ++++++++++-------
 src/microhttpd/md5.c                      | 14 +++--
 src/microhttpd/memorypool.c               |  2 +-
 src/microhttpd/mhd_align.h                |  6 +-
 src/microhttpd/mhd_bithelpers.h           |  6 ++
 src/microhttpd/mhd_byteorder.h            |  6 +-
 src/microhttpd/mhd_mono_clock.c           |  4 +-
 src/microhttpd/mhd_send.c                 |  8 +--
 src/microhttpd/mhd_sockets.c              |  2 +-
 src/microhttpd/mhd_sockets.h              |  6 +-
 src/microhttpd/mhd_str.h                  |  2 +-
 src/microhttpd/sha1.c                     | 19 ++++---
 src/microhttpd/sha256.c                   | 25 +++++----
 src/microhttpd/test_options.c             |  6 +-
 src/microhttpd/test_postprocessor.c       |  2 +-
 src/microhttpd/test_shutdown_select.c     | 14 ++---
 src/microhttpd/test_start_stop.c          |  2 +-
 src/microhttpd/test_upgrade.c             | 22 ++------
 src/microhttpd/test_upgrade_large.c       | 22 ++------
 39 files changed, 315 insertions(+), 268 deletions(-)

diff --git a/configure.ac b/configure.ac
index 50f3055e..2bd9dda0 100644
--- a/configure.ac
+++ b/configure.ac
@@ -157,12 +157,14 @@ AS_VAR_IF([enable_build_type],["debug"],
     CFLAGS="${user_CFLAGS}"
     MHD_FIND_ADD_CC_CFLAG([CFLAGS_ac], [-Og], [-O0])
     MHD_FIND_ADD_CC_CFLAG([CFLAGS_ac], [-ggdb3], [-g3], [-ggdb], [-g])
-    MHD_CHECK_ADD_CC_CFLAGS([-Wextra -Wdouble-promotion -Wformat=2 
-Wformat-overflow=2 -Wformat-truncation=2], [CFLAGS_ac])
+    MHD_CHECK_ADD_CC_CFLAGS([-Wextra -Wdouble-promotion], [CFLAGS_ac])
+    MHD_FIND_ADD_CC_CFLAG([CFLAGS_ac], [-Wformat=2], [-Wformat])
+    MHD_CHECK_ADD_CC_CFLAGS([-Wformat-overflow -Wformat-truncation 
-Wformat-security -Wformat-signedness], [CFLAGS_ac])
     MHD_CHECK_ADD_CC_CFLAGS([-Wmissing-include-dirs -Wshift-overflow=2 
-Wstringop-overflow=4 -Walloc-zero], [CFLAGS_ac])
     MHD_CHECK_ADD_CC_CFLAGS([-Wduplicated-branches -Wduplicated-cond 
-Wfloat-equal -Wshadow -Wpointer-arith], [CFLAGS_ac])
     MHD_CHECK_ADD_CC_CFLAGS([-Wbad-function-cast -Wcast-qual 
-Wcast-align=strict -Wwrite-strings -Wconversion], [CFLAGS_ac])
     MHD_CHECK_ADD_CC_CFLAGS([-Wjump-misses-init -Wlogical-op 
-Waggregate-return -Wstrict-prototypes], [CFLAGS_ac])
-    MHD_CHECK_ADD_CC_CFLAGS([-Wold-style-definition -Wmissing-prototypes 
-Wformat-security -Wshift-negative-value], [CFLAGS_ac])
+    MHD_CHECK_ADD_CC_CFLAGS([-Wold-style-definition -Wmissing-declarations 
-Wmissing-prototypes -Wshift-negative-value], [CFLAGS_ac])
     CFLAGS="${CFLAGS_ac} ${user_CFLAGS}"
     LDFLAGS="${user_LDFLAGS}"
     MHD_CHECK_ADD_CC_LDFLAG([-Wl,--enable-long-section-names], [LDFLAGS_ac])
diff --git a/doc/examples/largepost.c b/doc/examples/largepost.c
index b7cccc04..da9c1c56 100644
--- a/doc/examples/largepost.c
+++ b/doc/examples/largepost.c
@@ -66,14 +66,14 @@ struct connection_info_struct
 };
 
 
-const char *askpage =
-  "<html><body>\n\
-                       Upload a file, please!<br>\n\
-                       There are %u clients uploading at the moment.<br>\n\
-                       <form action=\"/filepost\" method=\"post\" 
enctype=\"multipart/form-data\">\n\
-                       <input name=\"file\" type=\"file\">\n\
-                       <input type=\"submit\" value=\" Send \"></form>\n\
-                       </body></html>";
+#define ASKPAGE \
+  "<html><body>\n" \
+  "Upload a file, please!<br>\n" \
+  "There are %u clients uploading at the moment.<br>\n" \
+  "<form action=\"/filepost\" method=\"post\" 
enctype=\"multipart/form-data\">\n" \
+  "<input name=\"file\" type=\"file\">\n" \
+  "<input type=\"submit\" value=\" Send \"></form>\n" \
+  "</body></html>"
 const char *busypage =
   "<html><body>This server is busy, please try again later.</body></html>";
 const char *completepage =
@@ -271,7 +271,7 @@ answer_to_connection (void *cls,
 
     snprintf (buffer,
               sizeof (buffer),
-              askpage,
+              ASKPAGE,
               nr_of_uploading_clients);
     return send_page (connection,
                       buffer,
@@ -328,7 +328,7 @@ answer_to_connection (void *cls,
 
 
 int
-main ()
+main (void)
 {
   struct MHD_Daemon *daemon;
 
diff --git a/doc/examples/logging.c b/doc/examples/logging.c
index 0db2e2ef..2c2a3c3a 100644
--- a/doc/examples/logging.c
+++ b/doc/examples/logging.c
@@ -46,7 +46,7 @@ answer_to_connection (void *cls, struct MHD_Connection 
*connection,
 
 
 int
-main ()
+main (void)
 {
   struct MHD_Daemon *daemon;
 
diff --git a/doc/examples/responseheaders.c b/doc/examples/responseheaders.c
index 162e5e2d..ce8167f3 100644
--- a/doc/examples/responseheaders.c
+++ b/doc/examples/responseheaders.c
@@ -73,7 +73,7 @@ answer_to_connection (void *cls, struct MHD_Connection 
*connection,
 
 
 int
-main ()
+main (void)
 {
   struct MHD_Daemon *daemon;
 
diff --git a/doc/examples/sessions.c b/doc/examples/sessions.c
index 0fe143eb..0c8e5114 100644
--- a/doc/examples/sessions.c
+++ b/doc/examples/sessions.c
@@ -1,60 +1,66 @@
 /* Feel free to use this example code in any way
    you see fit (Public Domain) */
 
-/* needed for asprintf */
-#ifndef _GNU_SOURCE
-#define _GNU_SOURCE 1
-#endif
-
 #include <stdlib.h>
 #include <string.h>
 #include <stdio.h>
 #include <errno.h>
 #include <time.h>
+#include <stdarg.h>
 #include <microhttpd.h>
 
-#if defined _WIN32 && ! defined(__MINGW64_VERSION_MAJOR)
+/* Emulate 'asprintf()', as it is not portable */
 static int
-asprintf (char **resultp, const char *format, ...)
+MHD_asprintf (char **resultp, const char *format, ...)
 {
   va_list argptr;
-  char *result = NULL;
-  int len = 0;
-
-  if (format == NULL)
-    return -1;
+  va_list argcopy;
+  int len;
+  int ret;
 
+  ret = -1;
   va_start (argptr, format);
 
-  len = _vscprintf ((char *) format, argptr);
-  if (len >= 0)
+  va_copy (argcopy, argptr);
+#ifndef _WIN32
+  len = vsnprintf (NULL, 0, format, argcopy);
+#else
+  len = _vscprintf (format, argcopy);
+#endif
+  va_end (argcopy);
+  if (0 < len)
   {
-    len += 1;
-    result = (char *) malloc (sizeof (char *) * len);
-    if (result != NULL)
+    size_t buf_size;
+    char *buf;
+
+    buf_size = len + 1;
+    buf = (char *) malloc (buf_size * sizeof(char));
+    if (NULL != buf)
     {
-      int len2 = _vscprintf ((char *) format, argptr);
-      if ((len2 != len - 1) || (len2 <= 0))
+      int res;
+
+#ifndef _WIN32
+      res = vsnprintf (buf, buf_size, format, argptr);
+#else
+      res = _vsnprintf (buf, buf_size, format, argptr);
+#endif
+      if (len == res)
       {
-        free (result);
-        result = NULL;
-        len = -1;
+        *resultp = buf;
+        ret = res;
       }
       else
       {
-        len = len2;
-        if (resultp)
-          *resultp = result;
+        free (buf);
+        *resultp = NULL;
       }
     }
   }
   va_end (argptr);
-  return len;
+  return ret;
 }
 
 
-#endif
-
 /**
  * Invalid method page.
  */
@@ -339,13 +345,13 @@ fill_v1_form (const void *cls,
               struct MHD_Connection *connection)
 {
   enum MHD_Result ret;
-  const char *form = cls;
   char *reply;
   struct MHD_Response *response;
+  (void) cls; /* Unused */
 
-  if (-1 == asprintf (&reply,
-                      form,
-                      session->value_1))
+  if (-1 == MHD_asprintf (&reply,
+                          MAIN_PAGE,
+                          session->value_1))
   {
     /* oops */
     return MHD_NO;
@@ -381,14 +387,14 @@ fill_v1_v2_form (const void *cls,
                  struct MHD_Connection *connection)
 {
   enum MHD_Result ret;
-  const char *form = cls;
   char *reply;
   struct MHD_Response *response;
+  (void) cls; /* Unused */
 
-  if (-1 == asprintf (&reply,
-                      form,
-                      session->value_1,
-                      session->value_2))
+  if (-1 == MHD_asprintf (&reply,
+                          SECOND_PAGE,
+                          session->value_1,
+                          session->value_2))
   {
     /* oops */
     return MHD_NO;
@@ -446,8 +452,8 @@ not_found_page (const void *cls,
  * List of all pages served by this HTTP server.
  */
 static struct Page pages[] = {
-  { "/", "text/html",  &fill_v1_form, MAIN_PAGE },
-  { "/2", "text/html", &fill_v1_v2_form, SECOND_PAGE },
+  { "/", "text/html",  &fill_v1_form, NULL },
+  { "/2", "text/html", &fill_v1_v2_form, NULL },
   { "/S", "text/html", &serve_simple_form, SUBMIT_PAGE },
   { "/F", "text/html", &serve_simple_form, LAST_PAGE },
   { NULL, NULL, &not_found_page, NULL }   /* 404 */
@@ -693,7 +699,7 @@ request_completed_callback (void *cls,
  * too long.
  */
 static void
-expire_sessions ()
+expire_sessions (void)
 {
   struct Session *pos;
   struct Session *prev;
diff --git a/doc/examples/simplepost.c b/doc/examples/simplepost.c
index 51cf23c0..80a948fe 100644
--- a/doc/examples/simplepost.c
+++ b/doc/examples/simplepost.c
@@ -34,15 +34,15 @@ struct connection_info_struct
 };
 
 const char *askpage =
-  "<html><body>\
-                       What's your name, Sir?<br>\
-                       <form action=\"/namepost\" method=\"post\">\
-                       <input name=\"name\" type=\"text\">\
-                       <input type=\"submit\" value=\" Send \"></form>\
-                       </body></html>";
+  "<html><body>\n"
+  "What's your name, Sir?<br>\n"
+  "<form action=\"/namepost\" method=\"post\">\n"
+  "<input name=\"name\" type=\"text\">\n"
+  "<input type=\"submit\" value=\" Send \"></form>\n"
+  "</body></html>";
 
-const char *greetingpage =
-  "<html><body><h1>Welcome, %s!</center></h1></body></html>";
+#define GREETINGPAGE \
+  "<html><body><h1>Welcome, %s!</center></h1></body></html>"
 
 const char *errorpage =
   "<html><body>This doesn't seem to be right.</body></html>";
@@ -88,7 +88,7 @@ iterate_post (void *coninfo_cls, enum MHD_ValueKind kind, 
const char *key,
       if (! answerstring)
         return MHD_NO;
 
-      snprintf (answerstring, MAXANSWERSIZE, greetingpage, data);
+      snprintf (answerstring, MAXANSWERSIZE, GREETINGPAGE, data);
       con_info->answerstring = answerstring;
     }
     else
@@ -192,7 +192,7 @@ answer_to_connection (void *cls, struct MHD_Connection 
*connection,
 
 
 int
-main ()
+main (void)
 {
   struct MHD_Daemon *daemon;
 
diff --git a/doc/examples/tlsauthentication.c b/doc/examples/tlsauthentication.c
index 1898e730..3c39a0f5 100644
--- a/doc/examples/tlsauthentication.c
+++ b/doc/examples/tlsauthentication.c
@@ -247,7 +247,7 @@ answer_to_connection (void *cls, struct MHD_Connection 
*connection,
 
 
 int
-main ()
+main (void)
 {
   struct MHD_Daemon *daemon;
   char *key_pem;
diff --git a/src/examples/benchmark.c b/src/examples/benchmark.c
index 1abdad24..37e1b4f8 100644
--- a/src/examples/benchmark.c
+++ b/src/examples/benchmark.c
@@ -176,6 +176,6 @@ main (int argc, char *const *argv)
   MHD_destroy_response (response);
   for (i = 0; i < SMALL; i++)
     if (0 != small_deltas[i])
-      fprintf (stdout, "D: %d %u\n", i, small_deltas[i]);
+      fprintf (stdout, "D: %u %u\n", i, small_deltas[i]);
   return 0;
 }
diff --git a/src/examples/benchmark_https.c b/src/examples/benchmark_https.c
index ae7e074f..9553d434 100644
--- a/src/examples/benchmark_https.c
+++ b/src/examples/benchmark_https.c
@@ -240,6 +240,6 @@ main (int argc, char *const *argv)
   MHD_destroy_response (response);
   for (i = 0; i < SMALL; i++)
     if (0 != small_deltas[i])
-      fprintf (stdout, "D: %d %u\n", i, small_deltas[i]);
+      fprintf (stdout, "D: %u %u\n", i, small_deltas[i]);
   return 0;
 }
diff --git a/src/examples/demo.c b/src/examples/demo.c
index 5b3e75d1..1c24a57e 100644
--- a/src/examples/demo.c
+++ b/src/examples/demo.c
@@ -317,7 +317,7 @@ list_directory (struct ResponseDataContext *rdc,
  * Re-scan our local directory and re-build the index.
  */
 static void
-update_directory ()
+update_directory (void)
 {
   static size_t initial_allocation = 32 * 1024; /* initial size for response 
buffer */
   struct MHD_Response *response;
@@ -858,7 +858,7 @@ catcher (int sig)
  * setup handlers to ignore SIGPIPE.
  */
 static void
-ignore_sigpipe ()
+ignore_sigpipe (void)
 {
   struct sigaction oldsig;
   struct sigaction sig;
diff --git a/src/examples/demo_https.c b/src/examples/demo_https.c
index cfd586ca..1a09d2c2 100644
--- a/src/examples/demo_https.c
+++ b/src/examples/demo_https.c
@@ -319,7 +319,7 @@ list_directory (struct ResponseDataContext *rdc,
  * Re-scan our local directory and re-build the index.
  */
 static void
-update_directory ()
+update_directory (void)
 {
   static size_t initial_allocation = 32 * 1024; /* initial size for response 
buffer */
   struct MHD_Response *response;
diff --git a/src/examples/post_example.c b/src/examples/post_example.c
index 5df56afb..1134a331 100644
--- a/src/examples/post_example.c
+++ b/src/examples/post_example.c
@@ -690,7 +690,7 @@ request_completed_callback (void *cls,
  * too long.
  */
 static void
-expire_sessions ()
+expire_sessions (void)
 {
   struct Session *pos;
   struct Session *prev;
diff --git a/src/examples/websocket_threaded_example.c 
b/src/examples/websocket_threaded_example.c
index 542d7c3a..11615724 100644
--- a/src/examples/websocket_threaded_example.c
+++ b/src/examples/websocket_threaded_example.c
@@ -354,7 +354,7 @@ SHA1Input (struct SHA1Context *context, const unsigned char 
*message_array,
 /********** begin Base64 **********/
 
 
-ssize_t
+static ssize_t
 BASE64Encode (const void *in, size_t len, char **output)
 {
 #define FILLCHAR '='
diff --git a/src/include/autoinit_funcs.h b/src/include/autoinit_funcs.h
index a289b0bc..adf66460 100644
--- a/src/include/autoinit_funcs.h
+++ b/src/include/autoinit_funcs.h
@@ -1,6 +1,6 @@
 /*
  *  AutoinitFuncs: Automatic Initialization and Deinitialization Functions
- *  Copyright(C) 2014-2017  Karlson2k (Evgeny Grin)
+ *  Copyright(C) 2014-2022 Karlson2k (Evgeny Grin)
  *
  *  This header is free software; you can redistribute it and / or
  *  modify it under the terms of the GNU Lesser General Public
@@ -67,7 +67,7 @@
 * Current version of the header in packed BCD form.
 * 0x01093001 = 1.9.30-1.
 */
-#define AUTOINIT_FUNCS_VERSION 0x01000200
+#define AUTOINIT_FUNCS_VERSION 0x01000400
 
 #if defined(__GNUC__) || defined(__clang__)
 /* if possible - check for supported attribute */
@@ -85,16 +85,18 @@
   (defined(__SUNPRO_C) && __SUNPRO_C + 0 >= 0x5100)
 
 #define GNUC_SET_INIT_AND_DEINIT(FI,FD) \
-  void __attribute__ ((constructor)) _GNUC_init_helper_ ## FI (void) \
+  void __attribute__ ((constructor)) _GNUC_init_helper_ ## FI (void);  \
+  void __attribute__ ((destructor)) _GNUC_deinit_helper_ ## FD (void); \
+  void __attribute__ ((constructor)) _GNUC_init_helper_ ## FI (void)   \
   { (void) (FI) (); } \
-  void __attribute__ ((destructor)) _GNUC_deinit_helper_ ## FD (void) \
+  void __attribute__ ((destructor)) _GNUC_deinit_helper_ ## FD (void)  \
   { (void) (FD) (); } \
   struct _GNUC_dummy_str_ ## FI {int i;}
 
 #define _SET_INIT_AND_DEINIT_FUNCS(FI,FD) GNUC_SET_INIT_AND_DEINIT (FI,FD)
 #define _AUTOINIT_FUNCS_ARE_SUPPORTED 1
 
-#elif defined (_MSC_FULL_VER) && _MSC_VER + 0 >= 1600
+#elif defined(_MSC_FULL_VER) && _MSC_VER + 0 >= 1600
 
 /* Make sure that your project/sources define:
    _LIB if building a static library (_LIB is ignored if _CONSOLE is defined);
@@ -137,8 +139,8 @@
 
 /* Internal variable prefix (can be any) */
 #define W32_INITHELPERVARNAME(f) _initHelperDummy_ ## f
-#define W32_INITHELPERVARNAMEDECORSTR(f) W32_VARDECORPEFIXSTR _STRMACRO ( \
-    W32_INITHELPERVARNAME (f))
+#define W32_INITHELPERVARNAMEDECORSTR(f) \
+  W32_VARDECORPEFIXSTR _STRMACRO (W32_INITHELPERVARNAME (f))
 
 /* Declare section (segment), put variable pointing to init function to chosen 
segment,
    force linker to include variable to avoid omitting by optimizer */
@@ -149,8 +151,8 @@
 #define W32_FPTR_IN_SEG(S,F) \
   __pragma (section (S,long,read)) \
   __pragma (comment (linker, "/INCLUDE:" W32_INITHELPERVARNAMEDECORSTR (F))) \
-  W32_INITVARDECL __declspec(allocate (S))int (__cdecl * W32_INITHELPERVARNAME 
( \
-                                                 F))(void) = &F
+  W32_INITVARDECL __declspec(allocate (S))int \
+    (__cdecl * W32_INITHELPERVARNAME (F))(void) = &F
 
 /* Section (segment) names for pointers to initializers */
 #define W32_SEG_INIT_C_USER   ".CRT$XCU"
@@ -204,9 +206,11 @@
 
 #if ! defined(_USRDLL) || defined(AUTOINIT_FUNCS_FORCE_STATIC_REG)
 #define W32_SET_INIT_AND_DEINIT(FI,FD) \
-  void __cdecl _W32_deinit_helper_ ## FD (void) \
+  int __cdecl _W32_init_helper_ ## FI (void);    \
+  void __cdecl _W32_deinit_helper_ ## FD (void); \
+  void __cdecl _W32_deinit_helper_ ## FD (void)  \
   { (void) (FD) (); } \
-  int __cdecl _W32_init_helper_ ## FI (void) \
+  int __cdecl _W32_init_helper_ ## FI (void)     \
   { (void) (FI) (); atexit (_W32_deinit_helper_ ## FD); return 0; } \
   W32_REGISTER_INIT (_W32_init_helper_ ## FI)
 #else  /* _USRDLL */
@@ -215,7 +219,8 @@
    and rename DllMain to usr_DllMain */
 #ifndef AUTOINIT_FUNCS_CALL_USR_DLLMAIN
 #define W32_SET_INIT_AND_DEINIT(FI,FD) \
-  BOOL WINAPI DllMain (HINSTANCE hinst,DWORD reason,LPVOID unused) \
+  BOOL WINAPI DllMain (HINSTANCE hinst,DWORD reason,LPVOID unused); \
+  BOOL WINAPI DllMain (HINSTANCE hinst,DWORD reason,LPVOID unused)  \
   { if (DLL_PROCESS_ATTACH==reason) {(void) (FI) ();} \
     else if (DLL_PROCESS_DETACH==reason) {(void) (FD) ();} \
     return TRUE; \
@@ -223,7 +228,8 @@
 #else  /* AUTOINIT_FUNCS_CALL_USR_DLLMAIN */
 #define W32_SET_INIT_AND_DEINIT(FI,FD) \
   BOOL WINAPI usr_DllMain (HINSTANCE hinst,DWORD reason,LPVOID unused); \
-  BOOL WINAPI DllMain (HINSTANCE hinst,DWORD reason,LPVOID unused) \
+  BOOL WINAPI DllMain (HINSTANCE hinst,DWORD reason,LPVOID unused); \
+  BOOL WINAPI DllMain (HINSTANCE hinst,DWORD reason,LPVOID unused)  \
   { if (DLL_PROCESS_ATTACH==reason) {(void) (FI) ();} \
     else if (DLL_PROCESS_DETACH==reason) {(void) (FD) ();} \
     return usr_DllMain (hinst,reason,unused); \
diff --git a/src/include/microhttpd.h b/src/include/microhttpd.h
index 309929ca..b4bc85e3 100644
--- a/src/include/microhttpd.h
+++ b/src/include/microhttpd.h
@@ -121,7 +121,7 @@ extern "C"
 #include <sys/socket.h>
 #else  /* _WIN32 && ! __CYGWIN__ */
 #include <ws2tcpip.h>
-#if defined(_MSC_FULL_VER) && ! defined (_SSIZE_T_DEFINED)
+#if defined(_MSC_FULL_VER) && ! defined(_SSIZE_T_DEFINED)
 #define _SSIZE_T_DEFINED
 typedef intptr_t ssize_t;
 #endif /* !_SSIZE_T_DEFINED */
@@ -190,7 +190,7 @@ enum MHD_Result
 #ifndef _MHD_EXTERN
 #if defined(_WIN32) && defined(MHD_W32LIB)
 #define _MHD_EXTERN extern
-#elif defined (_WIN32) && defined(MHD_W32DLL)
+#elif defined(_WIN32) && defined(MHD_W32DLL)
 /* Define MHD_W32DLL when using MHD as W32 .DLL to speed up linker a little */
 #define _MHD_EXTERN __declspec(dllimport)
 #else
@@ -236,7 +236,7 @@ typedef SOCKET MHD_socket;
 #define _MHD_DEPR_MACRO(msg) \
   __pragma(message (__FILE__ "(" _MHD_STRMACRO ( __LINE__) "): warning: " msg))
 #define _MHD_DEPR_IN_MACRO(msg) _MHD_DEPR_MACRO (msg)
-#elif defined(__clang__) || defined (__GNUC_PATCHLEVEL__)
+#elif defined(__clang__) || defined(__GNUC_PATCHLEVEL__)
 /* clang or GCC since 3.0 */
 #define _MHD_GCC_PRAG(x) _Pragma(#x)
 #if (defined(__clang__) && \
@@ -279,12 +279,12 @@ typedef SOCKET MHD_socket;
 #elif defined(_MSC_FULL_VER) && _MSC_VER + 0 >= 1310
 /* VS .NET 2003 deprecation does not support custom messages */
 #define _MHD_DEPR_FUNC(msg) __declspec(deprecated)
-#elif (__GNUC__ + 0 >= 5) || (defined (__clang__) && \
+#elif (__GNUC__ + 0 >= 5) || (defined(__clang__) && \
   (__clang_major__ + 0 > 2 || \
    (__clang_major__ + 0 == 2 && __clang_minor__ >=  9)))
 /* GCC >= 5.0 or clang >= 2.9 */
 #define _MHD_DEPR_FUNC(msg) __attribute__((deprecated (msg)))
-#elif defined (__clang__) || __GNUC__ + 0 > 3 || \
+#elif defined(__clang__) || __GNUC__ + 0 > 3 || \
   (__GNUC__ + 0 == 3 && __GNUC_MINOR__ + 0 >= 1)
 /* 3.1 <= GCC < 5.0 or clang < 2.9 */
 /* old GCC-style deprecation does not support custom messages */
@@ -4429,6 +4429,8 @@ MHD_queue_basic_auth_fail_response (struct MHD_Connection 
*connection,
 
 /**
  * Obtain information about the given connection.
+ * The returned pointer is invalidated with the next call of this function or
+ * when the connection is closed.
  *
  * @param connection what connection to get information about
  * @param info_type what information is desired?
@@ -4527,8 +4529,9 @@ union MHD_DaemonInfo
 
 
 /**
- * Obtain information about the given daemon
- * (not fully implemented!).
+ * Obtain information about the given daemon.
+ * The returned pointer is invalidated with the next call of this function or
+ * when the daemon is stopped.
  *
  * @param daemon what daemon to get information about
  * @param info_type what information is desired?
diff --git a/src/include/microhttpd2.h b/src/include/microhttpd2.h
index 5bf125ef..4a4541fa 100644
--- a/src/include/microhttpd2.h
+++ b/src/include/microhttpd2.h
@@ -101,7 +101,7 @@ extern "C"
 #include <sys/types.h>
 #if defined(_WIN32) && ! defined(__CYGWIN__)
 #include <ws2tcpip.h>
-#if defined(_MSC_FULL_VER) && ! defined (_SSIZE_T_DEFINED)
+#if defined(_MSC_FULL_VER) && ! defined(_SSIZE_T_DEFINED)
 #define _SSIZE_T_DEFINED
 typedef intptr_t ssize_t;
 #endif /* !_SSIZE_T_DEFINED */
@@ -166,7 +166,7 @@ enum MHD_Bool
 #ifndef _MHD_EXTERN
 #if defined(_WIN32) && defined(MHD_W32LIB)
 #define _MHD_EXTERN extern
-#elif defined (_WIN32) && defined(MHD_W32DLL)
+#elif defined(_WIN32) && defined(MHD_W32DLL)
 /* Define MHD_W32DLL when using MHD as W32 .DLL to speed up linker a little */
 #define _MHD_EXTERN __declspec(dllimport)
 #else
@@ -212,7 +212,7 @@ typedef SOCKET MHD_socket;
 #define _MHD_DEPR_MACRO(msg) __pragma(message (__FILE__ "(" _MHD_STRMACRO ( \
   __LINE__) "): warning: " msg))
 #define _MHD_DEPR_IN_MACRO(msg) _MHD_DEPR_MACRO (msg)
-#elif defined(__clang__) || defined (__GNUC_PATCHLEVEL__)
+#elif defined(__clang__) || defined(__GNUC_PATCHLEVEL__)
 /* clang or GCC since 3.0 */
 #define _MHD_GCC_PRAG(x) _Pragma(#x)
 #if (defined(__clang__) && (__clang_major__ + 0 >= 5 ||     \
@@ -254,13 +254,13 @@ typedef SOCKET MHD_socket;
 #elif defined(_MSC_FULL_VER) && _MSC_VER + 0 >= 1310
 /* VS .NET 2003 deprecation do not support custom messages */
 #define _MHD_DEPR_FUNC(msg) __declspec(deprecated)
-#elif (__GNUC__ + 0 >= 5) || (defined (__clang__) && \
+#elif (__GNUC__ + 0 >= 5) || (defined(__clang__) && \
   (__clang_major__ + 0 > 2 || (__clang_major__ + 0 == 2 && __clang_minor__ >= \
                                9)))                                            
 /* FIXME: earlier versions not tested */
 /* GCC >= 5.0 or clang >= 2.9 */
 #define _MHD_DEPR_FUNC(msg) __attribute__((deprecated (msg)))
-#elif defined (__clang__) || __GNUC__ + 0 > 3 || (__GNUC__ + 0 == 3 && \
-                                                  __GNUC_MINOR__ + 0 >= 1)
+#elif defined(__clang__) || __GNUC__ + 0 > 3 || (__GNUC__ + 0 == 3 && \
+                                                 __GNUC_MINOR__ + 0 >= 1)
 /* 3.1 <= GCC < 5.0 or clang < 2.9 */
 /* old GCC-style deprecation do not support custom messages */
 #define _MHD_DEPR_FUNC(msg) __attribute__((__deprecated__))
diff --git a/src/include/platform.h b/src/include/platform.h
index 4376636e..1db1e4eb 100644
--- a/src/include/platform.h
+++ b/src/include/platform.h
@@ -117,7 +117,7 @@
 #define usleep(useconds) ((SleepEx ((useconds) / 1000, 1)==0) ? 0 : -1)
 #endif
 
-#if defined(_MSC_FULL_VER) && ! defined (_SSIZE_T_DEFINED)
+#if defined(_MSC_FULL_VER) && ! defined(_SSIZE_T_DEFINED)
 #define _SSIZE_T_DEFINED
 typedef intptr_t ssize_t;
 #endif /* !_SSIZE_T_DEFINED */
diff --git a/src/microhttpd/basicauth.c b/src/microhttpd/basicauth.c
index f3c5f5b9..b739652e 100644
--- a/src/microhttpd/basicauth.c
+++ b/src/microhttpd/basicauth.c
@@ -127,7 +127,7 @@ MHD_queue_basic_auth_fail_response (struct MHD_Connection 
*connection,
 {
   enum MHD_Result ret;
   int res;
-  size_t hlen = strlen (realm) + strlen ("Basic realm=\"\"") + 1;
+  size_t hlen = strlen (realm) + MHD_STATICSTR_LEN_ ("Basic realm=\"\"") + 1;
   char *header;
 
   if (NULL == response)
diff --git a/src/microhttpd/connection.c b/src/microhttpd/connection.c
index eac75824..f940145e 100644
--- a/src/microhttpd/connection.c
+++ b/src/microhttpd/connection.c
@@ -4995,6 +4995,8 @@ MHD_set_http_callbacks_ (struct MHD_Connection 
*connection)
 
 /**
  * Obtain information about the given connection.
+ * The returned pointer is invalidated with the next call of this function or
+ * when the connection is closed.
  *
  * @param connection what connection to get information about
  * @param info_type what information is desired?
@@ -5014,44 +5016,62 @@ MHD_get_connection_info (struct MHD_Connection 
*connection,
   case MHD_CONNECTION_INFO_CIPHER_ALGO:
     if (NULL == connection->tls_session)
       return NULL;
-    connection->cipher = gnutls_cipher_get (connection->tls_session);
-    return (const union MHD_ConnectionInfo *) &connection->cipher;
+    connection->connection_info_dummy.cipher_algorithm =
+      gnutls_cipher_get (connection->tls_session);
+    return &connection->connection_info_dummy;
   case MHD_CONNECTION_INFO_PROTOCOL:
     if (NULL == connection->tls_session)
       return NULL;
-    connection->protocol = gnutls_protocol_get_version (
-      connection->tls_session);
-    return (const union MHD_ConnectionInfo *) &connection->protocol;
+    connection->connection_info_dummy.protocol =
+      gnutls_protocol_get_version (connection->tls_session);
+    return &connection->connection_info_dummy;
   case MHD_CONNECTION_INFO_GNUTLS_SESSION:
     if (NULL == connection->tls_session)
       return NULL;
-    return (const union MHD_ConnectionInfo *) &connection->tls_session;
+    connection->connection_info_dummy.tls_session = connection->tls_session;
+    return &connection->connection_info_dummy;
 #endif /* HTTPS_SUPPORT */
   case MHD_CONNECTION_INFO_CLIENT_ADDRESS:
-    return (const union MHD_ConnectionInfo *) &connection->addr;
+    memset (&connection->connection_info_dummy.client_addr, 0,
+            sizeof (connection->connection_info_dummy.client_addr));
+    memcpy (&connection->connection_info_dummy.client_addr,
+            &connection->addr,
+            connection->addr_len);
+    return &connection->connection_info_dummy;
   case MHD_CONNECTION_INFO_DAEMON:
-    return (const union MHD_ConnectionInfo *) &connection->daemon;
+    connection->connection_info_dummy.daemon = connection->daemon;
+    return &connection->connection_info_dummy;
   case MHD_CONNECTION_INFO_CONNECTION_FD:
-    return (const union MHD_ConnectionInfo *) &connection->socket_fd;
+    connection->connection_info_dummy.connect_fd = connection->socket_fd;
+    return &connection->connection_info_dummy;
   case MHD_CONNECTION_INFO_SOCKET_CONTEXT:
-    return (const union MHD_ConnectionInfo *) &connection->socket_context;
+    connection->connection_info_dummy.socket_context =
+      connection->socket_context;
+    return &connection->connection_info_dummy;
   case MHD_CONNECTION_INFO_CONNECTION_SUSPENDED:
-    connection->suspended_dummy = connection->suspended ? MHD_YES : MHD_NO;
-    return (const union MHD_ConnectionInfo *) &connection->suspended_dummy;
+    connection->connection_info_dummy.suspended =
+      connection->suspended ? MHD_YES : MHD_NO;
+    return &connection->connection_info_dummy;
   case MHD_CONNECTION_INFO_CONNECTION_TIMEOUT:
-    connection->connection_timeout_dummy =
-      (unsigned int) connection->connection_timeout_ms / 1000;
-    return (const union MHD_ConnectionInfo *) &connection->
-           connection_timeout_dummy;
+#if SIZEOF_UNSIGNED_INT <= (SIZEOF_UINT64_T - 2)
+    if (UINT_MAX < connection->connection_timeout_ms / 1000)
+      connection->connection_info_dummy.connection_timeout = UINT_MAX;
+    else
+#endif /* SIZEOF_UNSIGNED_INT <=(SIZEOF_UINT64_T - 2) */
+    connection->connection_info_dummy.connection_timeout =
+      (unsigned int) (connection->connection_timeout_ms / 1000);
+    return &connection->connection_info_dummy;
   case MHD_CONNECTION_INFO_REQUEST_HEADER_SIZE:
     if ( (MHD_CONNECTION_HEADERS_RECEIVED > connection->state) ||
          (MHD_CONNECTION_CLOSED == connection->state) )
       return NULL;   /* invalid, too early! */
-    return (const union MHD_ConnectionInfo *) &connection->header_size;
+    connection->connection_info_dummy.header_size = connection->header_size;
+    return &connection->connection_info_dummy;
   case MHD_CONNECTION_INFO_HTTP_STATUS:
     if (NULL == connection->response)
       return NULL;
-    return (const union MHD_ConnectionInfo *) &connection->responseCode;
+    connection->connection_info_dummy.http_status = connection->responseCode;
+    return &connection->connection_info_dummy;
   default:
     return NULL;
   }
diff --git a/src/microhttpd/daemon.c b/src/microhttpd/daemon.c
index 21b82131..35708b27 100644
--- a/src/microhttpd/daemon.c
+++ b/src/microhttpd/daemon.c
@@ -44,6 +44,7 @@
 #include "mhd_itc.h"
 #include "mhd_compat.h"
 #include "mhd_send.h"
+#include "mhd_align.h"
 
 #if HAVE_SEARCH_H
 #include <search.h>
@@ -88,6 +89,19 @@
 
 /* Forward declarations. */
 
+
+/**
+ * Global initialisation function.
+ */
+void
+MHD_init (void);
+
+/**
+ * Global deinitialisation function.
+ */
+void
+MHD_fini (void);
+
 /**
  * Close all connections for the daemon.
  * Must only be called when MHD_Daemon::shutdown was set to true.
@@ -116,12 +130,6 @@ MHD_epoll (struct MHD_Daemon *daemon,
 
 #endif /* EPOLL_SUPPORT */
 
-/**
- * Globally initialise library.
- */
-void
-MHD_init (void);
-
 
 #if defined(MHD_WINSOCK_SOCKETS)
 /**
@@ -335,13 +343,13 @@ MHD_ip_addr_to_key (const struct sockaddr *addr,
   /* IPv4 addresses */
   if (AF_INET == addr->sa_family)
   {
-    const struct sockaddr_in *addr4 = (const struct sockaddr_in *) addr;
     mhd_assert (sizeof (struct sockaddr_in) <= (size_t) addrlen);
 
     key->family = AF_INET;
     memcpy (&key->addr.ipv4,
-            &addr4->sin_addr,
-            sizeof(addr4->sin_addr));
+            ((const uint8_t *) addr)
+            + _MHD_OFFSETOF (struct sockaddr_in, sin_addr),
+            sizeof(((struct sockaddr_in *) NULL)->sin_addr));
     return MHD_YES;
   }
 
@@ -349,13 +357,13 @@ MHD_ip_addr_to_key (const struct sockaddr *addr,
   /* IPv6 addresses */
   if (AF_INET6 == addr->sa_family)
   {
-    const struct sockaddr_in6 *addr6 = (const struct sockaddr_in6 *) addr;
     mhd_assert (sizeof (struct sockaddr_in6) <= (size_t) addrlen);
 
     key->family = AF_INET6;
     memcpy (&key->addr.ipv6,
-            &addr6->sin6_addr,
-            sizeof(addr6->sin6_addr));
+            ((const uint8_t *) addr)
+            + _MHD_OFFSETOF (struct sockaddr_in6, sin6_addr),
+            sizeof(((struct sockaddr_in6 *) NULL)->sin6_addr));
     return MHD_YES;
   }
 #endif
@@ -6453,35 +6461,19 @@ MHD_start_daemon_va (unsigned int flags,
 
   if (0 != (*pflags & MHD_USE_AUTO))
   {
+#if defined(EPOLL_SUPPORT) && defined(HAVE_POLL)
     if (0 != (*pflags & MHD_USE_THREAD_PER_CONNECTION))
-    {
-      /* Thread per connection with internal polling thread. */
-#ifdef HAVE_POLL
-      *pflags |= MHD_USE_POLL;
-#else  /* ! HAVE_POLL */
-      /* use select() - do not modify flags */
-#endif /* ! HAVE_POLL */
-    }
-    else if (0 != (*pflags & MHD_USE_INTERNAL_POLLING_THREAD))
-    {
-      /* Internal polling thread. */
-#if defined(EPOLL_SUPPORT)
-      *pflags |= MHD_USE_EPOLL;
-#elif defined(HAVE_POLL)
       *pflags |= MHD_USE_POLL;
-#else  /* !HAVE_POLL && !EPOLL_SUPPORT */
-      /* use select() - do not modify flags */
-#endif /* !HAVE_POLL && !EPOLL_SUPPORT */
-    }
     else
-    {
-      /* Internal threads are not used - "external" polling mode. */
-#if defined(EPOLL_SUPPORT)
-      *pflags |= MHD_USE_EPOLL;
-#else  /* ! EPOLL_SUPPORT */
-      /* use select() - do not modify flags */
-#endif /* ! EPOLL_SUPPORT */
-    }
+      *pflags |= MHD_USE_EPOLL; /* Including "external select" mode */
+#elif defined(HAVE_POLL)
+    if (0 != (*pflags & MHD_USE_INTERNAL_POLLING_THREAD))
+      *pflags |= MHD_USE_POLL; /* Including thread-per-connection */
+#elif defined(EPOLL_SUPPORT)
+#warning 'epoll' enabled, while 'poll' not detected. Check configure.
+#else
+    /* No choice: use select() for any mode - do not modify flags */
+#endif
   }
 
   if (NULL == (daemon = MHD_calloc_ (1, sizeof (struct MHD_Daemon))))
@@ -7759,7 +7751,7 @@ MHD_stop_daemon (struct MHD_Daemon *daemon)
     mhd_assert (NULL == daemon->cleanup_head);
     mhd_assert (NULL == daemon->suspended_connections_head);
     mhd_assert (NULL == daemon->new_connections_head);
-#if defined(UPGRADE_SUPPORT) && defined (HTTPS_SUPPORT)
+#if defined(UPGRADE_SUPPORT) && defined(HTTPS_SUPPORT)
     mhd_assert (NULL == daemon->urh_head);
 #endif /* UPGRADE_SUPPORT && HTTPS_SUPPORT */
 
@@ -7821,8 +7813,9 @@ MHD_stop_daemon (struct MHD_Daemon *daemon)
 
 
 /**
- * Obtain information about the given daemon
- * (not fully implemented!).
+ * Obtain information about the given daemon.
+ * The returned pointer is invalidated with the next call of this function or
+ * when the daemon is stopped.
  *
  * @param daemon what daemon to get information about
  * @param info_type what information is desired?
@@ -7845,10 +7838,12 @@ MHD_get_daemon_info (struct MHD_Daemon *daemon,
   case MHD_DAEMON_INFO_MAC_KEY_SIZE:
     return NULL;   /* no longer supported */
   case MHD_DAEMON_INFO_LISTEN_FD:
-    return (const union MHD_DaemonInfo *) &daemon->listen_fd;
+    daemon->daemon_info_dummy_listen_fd.listen_fd = daemon->listen_fd;
+    return &daemon->daemon_info_dummy_listen_fd;
 #ifdef EPOLL_SUPPORT
   case MHD_DAEMON_INFO_EPOLL_FD:
-    return (const union MHD_DaemonInfo *) &daemon->epoll_fd;
+    daemon->daemon_info_dummy_epoll_fd.epoll_fd = daemon->epoll_fd;
+    return &daemon->daemon_info_dummy_epoll_fd;
 #endif
   case MHD_DAEMON_INFO_CURRENT_CONNECTIONS:
     if (0 == (daemon->options & MHD_USE_INTERNAL_POLLING_THREAD))
@@ -7870,11 +7865,15 @@ MHD_get_daemon_info (struct MHD_Daemon *daemon,
       }
     }
 #endif
-    return (const union MHD_DaemonInfo *) &daemon->connections;
+    daemon->daemon_info_dummy_num_connections.num_connections
+      = daemon->connections;
+    return &daemon->daemon_info_dummy_num_connections;
   case MHD_DAEMON_INFO_FLAGS:
-    return (const union MHD_DaemonInfo *) &daemon->options;
+    daemon->daemon_info_dummy_flags.flags = daemon->options;
+    return &daemon->daemon_info_dummy_flags;
   case MHD_DAEMON_INFO_BIND_PORT:
-    return (const union MHD_DaemonInfo *) &daemon->port;
+    daemon->daemon_info_dummy_port.port = daemon->port;
+    return &daemon->daemon_info_dummy_port;
   default:
     return NULL;
   }
diff --git a/src/microhttpd/internal.h b/src/microhttpd/internal.h
index 3bedf8ed..fc8ec0c6 100644
--- a/src/microhttpd/internal.h
+++ b/src/microhttpd/internal.h
@@ -1170,11 +1170,6 @@ struct MHD_Connection
    */
   uint64_t connection_timeout_ms;
 
-  /**
-   * Special member to be returned by #MHD_get_connection_info()
-   */
-  unsigned int connection_timeout_dummy;
-
   /**
    * Did we ever call the "default_handler" on this connection?  (this
    * flag will determine if we call the #MHD_OPTION_NOTIFY_COMPLETED
@@ -1342,16 +1337,6 @@ struct MHD_Connection
    */
   gnutls_session_t tls_session;
 
-  /**
-   * Memory location to return for protocol session info.
-   */
-  int protocol;
-
-  /**
-   * Memory location to return for protocol session info.
-   */
-  int cipher;
-
   /**
    * State of connection's TLS layer
    */
@@ -1370,14 +1355,14 @@ struct MHD_Connection
   bool suspended;
 
   /**
-   * Special member to be returned by #MHD_get_connection_info()
+   * Is the connection wanting to resume?
    */
-  int suspended_dummy;
+  volatile bool resuming;
 
   /**
-   * Is the connection wanting to resume?
+   * Special member to be returned by #MHD_get_connection_info()
    */
-  volatile bool resuming;
+  union MHD_ConnectionInfo connection_info_dummy;
 };
 
 
@@ -2179,6 +2164,34 @@ struct MHD_Daemon
    * #MHD_OPTION_ARRAY are counted.
    */
   size_t num_opts;
+
+  /* TODO: replace with a single member */
+  /**
+   * The value to be returned by #MHD_get_daemon_info()
+   */
+  union MHD_DaemonInfo daemon_info_dummy_listen_fd;
+
+#ifdef EPOLL_SUPPORT
+  /**
+   * The value to be returned by #MHD_get_daemon_info()
+   */
+  union MHD_DaemonInfo daemon_info_dummy_epoll_fd;
+#endif /* EPOLL_SUPPORT */
+
+  /**
+   * The value to be returned by #MHD_get_daemon_info()
+   */
+  union MHD_DaemonInfo daemon_info_dummy_num_connections;
+
+  /**
+   * The value to be returned by #MHD_get_daemon_info()
+   */
+  union MHD_DaemonInfo daemon_info_dummy_flags;
+
+  /**
+   * The value to be returned by #MHD_get_daemon_info()
+   */
+  union MHD_DaemonInfo daemon_info_dummy_port;
 };
 
 
diff --git a/src/microhttpd/md5.c b/src/microhttpd/md5.c
index d267e803..a467ccac 100644
--- a/src/microhttpd/md5.c
+++ b/src/microhttpd/md5.c
@@ -113,10 +113,12 @@ MHD_MD5Final (void *ctx_,
   if (1)
 #endif /* _MHD_PUT_32BIT_LE_UNALIGNED */
   {
-    _MHD_PUT_32BIT_LE (digest, ctx->state[0]);
-    _MHD_PUT_32BIT_LE (digest + 4, ctx->state[1]);
-    _MHD_PUT_32BIT_LE (digest + 8, ctx->state[2]);
-    _MHD_PUT_32BIT_LE (digest + 12, ctx->state[3]);
+    /* Use cast to (void*) here to mute compiler alignment warnings.
+     * Compilers are not smart enough to see that alignment has been checked. 
*/
+    _MHD_PUT_32BIT_LE ((void *) (digest + 0), ctx->state[0]);
+    _MHD_PUT_32BIT_LE ((void *) (digest + 4), ctx->state[1]);
+    _MHD_PUT_32BIT_LE ((void *) (digest + 8), ctx->state[2]);
+    _MHD_PUT_32BIT_LE ((void *) (digest + 12), ctx->state[3]);
   }
 
   /* Erase buffer */
@@ -150,7 +152,7 @@ MD5Transform (uint32_t state[4],
   const uint32_t *in;
 
 #if (_MHD_BYTE_ORDER == _MHD_LITTLE_ENDIAN) || \
-  ! defined (_MHD_GET_32BIT_LE_UNALIGNED)
+  ! defined(_MHD_GET_32BIT_LE_UNALIGNED)
   if (0 != (((uintptr_t) block) % _MHD_UINT32_ALIGN))
   {
     /* Copy data to the aligned buffer */
@@ -158,7 +160,7 @@ MD5Transform (uint32_t state[4],
     in = data_buf;
   }
   else
-    in = (const uint32_t *) block;
+    in = (const uint32_t *) ((const void *) block);
 #endif /* _MHD_BYTE_ORDER == _MHD_LITTLE_ENDIAN) || \
           ! _MHD_GET_32BIT_LE_UNALIGNED */
 #if _MHD_BYTE_ORDER != _MHD_LITTLE_ENDIAN
diff --git a/src/microhttpd/memorypool.c b/src/microhttpd/memorypool.c
index 4408378c..b6f9d63a 100644
--- a/src/microhttpd/memorypool.c
+++ b/src/microhttpd/memorypool.c
@@ -47,7 +47,7 @@
 #endif /* HAVE_SYSCONF */
 #include "mhd_limits.h" /* for SIZE_MAX, PAGESIZE / PAGE_SIZE */
 
-#if defined(MHD_USE_PAGESIZE_MACRO) || defined (MHD_USE_PAGE_SIZE_MACRO)
+#if defined(MHD_USE_PAGESIZE_MACRO) || defined(MHD_USE_PAGE_SIZE_MACRO)
 #ifndef HAVE_SYSCONF /* Avoid duplicate include */
 #include <unistd.h>
 #endif /* HAVE_SYSCONF */
diff --git a/src/microhttpd/mhd_align.h b/src/microhttpd/mhd_align.h
index a4cba166..46fcb0b0 100644
--- a/src/microhttpd/mhd_align.h
+++ b/src/microhttpd/mhd_align.h
@@ -46,10 +46,10 @@
 #endif /* !_MHD_ALIGNOF */
 
 #ifdef _MHD_ALIGNOF
-#if (defined (__GNUC__) && __GNUC__ < 4 && __GNUC_MINOR__ < 9 && \
+#if (defined(__GNUC__) && __GNUC__ < 4 && __GNUC_MINOR__ < 9 && \
   ! defined(__clang__)) || \
-  (defined (__clang__) && __clang_major__ < 8) || \
-  (defined (__clang__) && __clang_major__ < 11 && \
+  (defined(__clang__) && __clang_major__ < 8) || \
+  (defined(__clang__) && __clang_major__ < 11 && \
   defined(__apple_build_version__))
 /* GCC before 4.9 and clang before 8.0 have incorrect implementation of 
'alignof()'
    which returns preferred alignment instead of minimal required alignment */
diff --git a/src/microhttpd/mhd_bithelpers.h b/src/microhttpd/mhd_bithelpers.h
index ed0c2e0c..eddd67f0 100644
--- a/src/microhttpd/mhd_bithelpers.h
+++ b/src/microhttpd/mhd_bithelpers.h
@@ -42,6 +42,7 @@
 #ifndef __has_builtin
 /* Avoid precompiler errors with non-clang */
 #  define __has_builtin(x) 0
+#  define _MHD_has_builtin_dummy 1
 #endif
 
 
@@ -328,5 +329,10 @@ _MHD_ROTL32 (uint32_t value32, int bits)
 
 #endif /* ! __builtin_rotateleft32 */
 
+#ifdef _MHD_has_builtin_dummy
+/* Remove macro function replacement to avoid misdetection in files which
+ * include this header */
+#  undef __has_builtin
+#endif
 
 #endif /* ! MHD_BITHELPERS_H */
diff --git a/src/microhttpd/mhd_byteorder.h b/src/microhttpd/mhd_byteorder.h
index 73c14240..3543803f 100644
--- a/src/microhttpd/mhd_byteorder.h
+++ b/src/microhttpd/mhd_byteorder.h
@@ -87,7 +87,7 @@
 #elif defined(__PDP_ENDIAN) && __BYTE_ORDER == __PDP_ENDIAN
 #define _MHD_BYTE_ORDER _MHD_PDP_ENDIAN
 #endif /* __BYTE_ORDER == __PDP_ENDIAN */
-#elif defined (BYTE_ORDER)
+#elif defined(BYTE_ORDER)
 #if defined(BIG_ENDIAN) && BYTE_ORDER == BIG_ENDIAN
 #define _MHD_BYTE_ORDER _MHD_BIG_ENDIAN
 #elif defined(LITTLE_ENDIAN) && BYTE_ORDER == LITTLE_ENDIAN
@@ -95,7 +95,7 @@
 #elif defined(PDP_ENDIAN) && BYTE_ORDER == PDP_ENDIAN
 #define _MHD_BYTE_ORDER _MHD_PDP_ENDIAN
 #endif /* __BYTE_ORDER == _PDP_ENDIAN */
-#elif defined (_BYTE_ORDER)
+#elif defined(_BYTE_ORDER)
 #if defined(_BIG_ENDIAN) && _BYTE_ORDER == _BIG_ENDIAN
 #define _MHD_BYTE_ORDER _MHD_BIG_ENDIAN
 #elif defined(_LITTLE_ENDIAN) && _BYTE_ORDER == _LITTLE_ENDIAN
@@ -122,7 +122,7 @@
   defined(_M_X64) || defined(_M_AMD64) || defined(i386) || defined(__i386) || \
   defined(__i386__) || defined(__i486__) || defined(__i586__) || \
   defined(__i686__) || \
-  defined(_M_IX86) || defined(_X86_) || defined (__THW_INTEL__)
+  defined(_M_IX86) || defined(_X86_) || defined(__THW_INTEL__)
 /* x86 family is little endian */
 #define _MHD_BYTE_ORDER _MHD_LITTLE_ENDIAN
 #elif defined(__ARMEB__) || defined(__THUMBEB__) || defined(__AARCH64EB__) || \
diff --git a/src/microhttpd/mhd_mono_clock.c b/src/microhttpd/mhd_mono_clock.c
index b04153f8..4efddd1b 100644
--- a/src/microhttpd/mhd_mono_clock.c
+++ b/src/microhttpd/mhd_mono_clock.c
@@ -345,7 +345,7 @@ MHD_monotonic_sec_counter_init (void)
     else
       gettime_start = 0;
   }
-#elif defined (HAVE_GETTIMEOFDAY)
+#elif defined(HAVE_GETTIMEOFDAY)
   if (1)
   {
     struct timeval tv;
@@ -488,7 +488,7 @@ MHD_monotonic_msec_counter (void)
   if (TIME_UTC == timespec_get (&ts, TIME_UTC))
     return (uint64_t) (((uint64_t) (ts.tv_sec - gettime_start)) * 1000
                        + (ts.tv_nsec / 1000000));
-#elif defined (HAVE_GETTIMEOFDAY)
+#elif defined(HAVE_GETTIMEOFDAY)
   if (1)
   {
     struct timeval tv;
diff --git a/src/microhttpd/mhd_send.c b/src/microhttpd/mhd_send.c
index 009283d6..18328e7e 100644
--- a/src/microhttpd/mhd_send.c
+++ b/src/microhttpd/mhd_send.c
@@ -55,9 +55,9 @@
 #include "mhd_limits.h"
 
 #ifdef MHD_VECT_SEND
-#if (! defined (HAVE_SENDMSG) || ! defined(MSG_NOSIGNAL)) && \
-  defined (MHD_SEND_SPIPE_SUPPRESS_POSSIBLE) && \
-  defined (MHD_SEND_SPIPE_SUPPRESS_NEEDED)
+#if (! defined(HAVE_SENDMSG) || ! defined(MSG_NOSIGNAL)) && \
+  defined(MHD_SEND_SPIPE_SUPPRESS_POSSIBLE) && \
+  defined(MHD_SEND_SPIPE_SUPPRESS_NEEDED)
 #define _MHD_VECT_SEND_NEEDS_SPIPE_SUPPRESSED 1
 #endif /* (!HAVE_SENDMSG || !MSG_NOSIGNAL) &&
           MHD_SEND_SPIPE_SUPPRESS_POSSIBLE && MHD_SEND_SPIPE_SUPPRESS_NEEDED */
@@ -1065,7 +1065,7 @@ MHD_send_hdr_and_body_ (struct MHD_Connection *connection,
   msg.msg_iovlen = 2;
 
   ret = sendmsg (s, &msg, MSG_NOSIGNAL_OR_ZERO);
-#elif defined (HAVE_WRITEV)
+#elif defined(HAVE_WRITEV)
   ret = writev (s, vector, 2);
 #endif /* HAVE_WRITEV */
 #endif /* HAVE_SENDMSG || HAVE_WRITEV */
diff --git a/src/microhttpd/mhd_sockets.c b/src/microhttpd/mhd_sockets.c
index 064f1aa8..ba459ce5 100644
--- a/src/microhttpd/mhd_sockets.c
+++ b/src/microhttpd/mhd_sockets.c
@@ -526,7 +526,7 @@ MHD_socket_create_listen_ (int pf)
     nosigpipe_set = (SOCK_NOSIGPIPE_OR_ZERO != 0);
 #endif /* SOCK_NOSIGPIPE ||  MHD_socket_nosignal_ */
   }
-#elif defined(MHD_WINSOCK_SOCKETS) && defined (WSA_FLAG_NO_HANDLE_INHERIT)
+#elif defined(MHD_WINSOCK_SOCKETS) && defined(WSA_FLAG_NO_HANDLE_INHERIT)
   fd = WSASocketW (pf,
                    SOCK_STREAM,
                    0,
diff --git a/src/microhttpd/mhd_sockets.h b/src/microhttpd/mhd_sockets.h
index fb404891..89f7d161 100644
--- a/src/microhttpd/mhd_sockets.h
+++ b/src/microhttpd/mhd_sockets.h
@@ -45,7 +45,7 @@
 #ifdef HAVE_STDDEF_H
 #include <stddef.h>
 #endif /* HAVE_STDDEF_H */
-#if defined(_MSC_FULL_VER) && ! defined (_SSIZE_T_DEFINED)
+#if defined(_MSC_FULL_VER) && ! defined(_SSIZE_T_DEFINED)
 #  include <stdint.h>
 #  define _SSIZE_T_DEFINED
 typedef intptr_t ssize_t;
@@ -715,10 +715,10 @@ const char *MHD_W32_strerror_winsock_ (int err);
 #    define MHD_socket_set_error_(err) ( (MHD_SCKT_MISSING_ERR_CODE_ == (err)) 
? \
                                          (errno = EOPNOTSUPP) : (errno = \
                                                                    (err)) )
-#  elif defined (EFAULT)
+#  elif defined(EFAULT)
 #    define MHD_socket_set_error_(err) ( (MHD_SCKT_MISSING_ERR_CODE_ == (err)) 
? \
                                          (errno = EFAULT) : (errno = (err)) )
-#  elif defined (EINVAL)
+#  elif defined(EINVAL)
 #    define MHD_socket_set_error_(err) ( (MHD_SCKT_MISSING_ERR_CODE_ == (err)) 
? \
                                          (errno = EINVAL) : (errno = (err)) )
 #  else  /* !EOPNOTSUPP && !EFAULT && !EINVAL */
diff --git a/src/microhttpd/mhd_str.h b/src/microhttpd/mhd_str.h
index 6455d84e..cdf92067 100644
--- a/src/microhttpd/mhd_str.h
+++ b/src/microhttpd/mhd_str.h
@@ -38,7 +38,7 @@
 #include <stdbool.h>
 #endif /* HAVE_STDBOOL_H */
 
-#if defined(_MSC_FULL_VER) && ! defined (_SSIZE_T_DEFINED)
+#if defined(_MSC_FULL_VER) && ! defined(_SSIZE_T_DEFINED)
 #define _SSIZE_T_DEFINED
 typedef intptr_t ssize_t;
 #endif /* !_SSIZE_T_DEFINED */
diff --git a/src/microhttpd/sha1.c b/src/microhttpd/sha1.c
index 9888cbfe..be9f73ab 100644
--- a/src/microhttpd/sha1.c
+++ b/src/microhttpd/sha1.c
@@ -105,8 +105,11 @@ sha1_transform (uint32_t H[_SHA1_DIGEST_LENGTH],
      See FIPS PUB 180-4 paragraph 6.1.3.
      Input data must be read in big-endian bytes order,
      see FIPS PUB 180-4 paragraph 3.1.2. */
+  /* Use cast to (void*) to mute compiler alignment warning,
+   * data was already aligned in previous step */
 #define GET_W_FROM_DATA(buf,t) \
-  _MHD_GET_32BIT_BE (((const uint8_t*) (buf)) + (t) * SHA1_BYTES_IN_WORD)
+  _MHD_GET_32BIT_BE ((const void *)(((const uint8_t*) (buf)) + \
+                                    (t) * SHA1_BYTES_IN_WORD))
 
 #ifndef _MHD_GET_32BIT_BE_UNALIGNED
   if (0 != (((uintptr_t) data) % _MHD_UINT32_ALIGN))
@@ -116,7 +119,7 @@ sha1_transform (uint32_t H[_SHA1_DIGEST_LENGTH],
     /* The W[] buffer itself will be used as the source of the data,
      * but data will be reloaded in correct bytes order during
      * the next steps */
-    data = (uint8_t*) W;
+    data = (uint8_t *) W;
   }
 #endif /* _MHD_GET_32BIT_BE_UNALIGNED */
 
@@ -366,11 +369,13 @@ MHD_SHA1_finish (void *ctx_,
   if (1)
 #endif /* _MHD_PUT_32BIT_BE_UNALIGNED */
   {
-    _MHD_PUT_32BIT_BE (digest + 0 * SHA1_BYTES_IN_WORD, ctx->H[0]);
-    _MHD_PUT_32BIT_BE (digest + 1 * SHA1_BYTES_IN_WORD, ctx->H[1]);
-    _MHD_PUT_32BIT_BE (digest + 2 * SHA1_BYTES_IN_WORD, ctx->H[2]);
-    _MHD_PUT_32BIT_BE (digest + 3 * SHA1_BYTES_IN_WORD, ctx->H[3]);
-    _MHD_PUT_32BIT_BE (digest + 4 * SHA1_BYTES_IN_WORD, ctx->H[4]);
+    /* Use cast to (void*) here to mute compiler alignment warnings.
+     * Compilers are not smart enough to see that alignment has been checked. 
*/
+    _MHD_PUT_32BIT_BE ((void *) (digest + 0 * SHA1_BYTES_IN_WORD), ctx->H[0]);
+    _MHD_PUT_32BIT_BE ((void *) (digest + 1 * SHA1_BYTES_IN_WORD), ctx->H[1]);
+    _MHD_PUT_32BIT_BE ((void *) (digest + 2 * SHA1_BYTES_IN_WORD), ctx->H[2]);
+    _MHD_PUT_32BIT_BE ((void *) (digest + 3 * SHA1_BYTES_IN_WORD), ctx->H[3]);
+    _MHD_PUT_32BIT_BE ((void *) (digest + 4 * SHA1_BYTES_IN_WORD), ctx->H[4]);
   }
 
   /* Erase potentially sensitive data. */
diff --git a/src/microhttpd/sha256.c b/src/microhttpd/sha256.c
index 6f6700dc..825b80b3 100644
--- a/src/microhttpd/sha256.c
+++ b/src/microhttpd/sha256.c
@@ -128,7 +128,7 @@ sha256_transform (uint32_t H[_SHA256_DIGEST_LENGTH],
     /* The W[] buffer itself will be used as the source of the data,
      * but data will be reloaded in correct bytes order during
      * the next steps */
-    data = (uint8_t*) W;
+    data = (uint8_t *) W;
   }
 #endif /* _MHD_GET_32BIT_BE_UNALIGNED */
 
@@ -136,8 +136,11 @@ sha256_transform (uint32_t H[_SHA256_DIGEST_LENGTH],
      See FIPS PUB 180-4 paragraph 6.2.
      Input data must be read in big-endian bytes order,
      see FIPS PUB 180-4 paragraph 3.1.2. */
+  /* Use cast to (const void*) to mute compiler alignment warning,
+   * data was already aligned in previous step */
 #define GET_W_FROM_DATA(buf,t) \
-  _MHD_GET_32BIT_BE (((const uint8_t*) (buf)) + (t) * SHA256_BYTES_IN_WORD)
+  _MHD_GET_32BIT_BE ((const void*)(((const uint8_t*) (buf)) + \
+                                   (t) * SHA256_BYTES_IN_WORD))
 
   /* During first 16 steps, before making any calculations on each step,
      the W element is read from input data buffer as big-endian value and
@@ -432,14 +435,16 @@ MHD_SHA256_finish (void *ctx_,
   if (1)
 #endif /* _MHD_PUT_32BIT_BE_UNALIGNED */
   {
-    _MHD_PUT_32BIT_BE (digest + 0 * SHA256_BYTES_IN_WORD, ctx->H[0]);
-    _MHD_PUT_32BIT_BE (digest + 1 * SHA256_BYTES_IN_WORD, ctx->H[1]);
-    _MHD_PUT_32BIT_BE (digest + 2 * SHA256_BYTES_IN_WORD, ctx->H[2]);
-    _MHD_PUT_32BIT_BE (digest + 3 * SHA256_BYTES_IN_WORD, ctx->H[3]);
-    _MHD_PUT_32BIT_BE (digest + 4 * SHA256_BYTES_IN_WORD, ctx->H[4]);
-    _MHD_PUT_32BIT_BE (digest + 5 * SHA256_BYTES_IN_WORD, ctx->H[5]);
-    _MHD_PUT_32BIT_BE (digest + 6 * SHA256_BYTES_IN_WORD, ctx->H[6]);
-    _MHD_PUT_32BIT_BE (digest + 7 * SHA256_BYTES_IN_WORD, ctx->H[7]);
+    /* Use cast to (void*) here to mute compiler alignment warnings.
+     * Compilers are not smart enough to see that alignment has been checked. 
*/
+    _MHD_PUT_32BIT_BE ((void *) (digest + 0 * SHA256_BYTES_IN_WORD), 
ctx->H[0]);
+    _MHD_PUT_32BIT_BE ((void *) (digest + 1 * SHA256_BYTES_IN_WORD), 
ctx->H[1]);
+    _MHD_PUT_32BIT_BE ((void *) (digest + 2 * SHA256_BYTES_IN_WORD), 
ctx->H[2]);
+    _MHD_PUT_32BIT_BE ((void *) (digest + 3 * SHA256_BYTES_IN_WORD), 
ctx->H[3]);
+    _MHD_PUT_32BIT_BE ((void *) (digest + 4 * SHA256_BYTES_IN_WORD), 
ctx->H[4]);
+    _MHD_PUT_32BIT_BE ((void *) (digest + 5 * SHA256_BYTES_IN_WORD), 
ctx->H[5]);
+    _MHD_PUT_32BIT_BE ((void *) (digest + 6 * SHA256_BYTES_IN_WORD), 
ctx->H[6]);
+    _MHD_PUT_32BIT_BE ((void *) (digest + 7 * SHA256_BYTES_IN_WORD), 
ctx->H[7]);
   }
 
   /* Erase potentially sensitive data. */
diff --git a/src/microhttpd/test_options.c b/src/microhttpd/test_options.c
index b79ddb01..9283c2e1 100644
--- a/src/microhttpd/test_options.c
+++ b/src/microhttpd/test_options.c
@@ -84,7 +84,7 @@ test_ip_addr_option ()
 {
   struct MHD_Daemon *d;
   struct sockaddr_in daemon_ip_addr;
-#if HAVE_INET6 && defined (USE_IPV6_TESTING)
+#if HAVE_INET6 && defined(USE_IPV6_TESTING)
   struct sockaddr_in6 daemon_ip_addr6;
 #endif
 
@@ -93,7 +93,7 @@ test_ip_addr_option ()
   daemon_ip_addr.sin_port = 0;
   daemon_ip_addr.sin_addr.s_addr = htonl (INADDR_LOOPBACK);
 
-#if HAVE_INET6 && defined (USE_IPV6_TESTING)
+#if HAVE_INET6 && defined(USE_IPV6_TESTING)
   memset (&daemon_ip_addr6, 0, sizeof (struct sockaddr_in6));
   daemon_ip_addr6.sin6_family = AF_INET6;
   daemon_ip_addr6.sin6_port = 0;
@@ -109,7 +109,7 @@ test_ip_addr_option ()
 
   MHD_stop_daemon (d);
 
-#if HAVE_INET6 && defined (USE_IPV6_TESTING)
+#if HAVE_INET6 && defined(USE_IPV6_TESTING)
   d = MHD_start_daemon (MHD_USE_ERROR_LOG | MHD_USE_IPv6, 0,
                         NULL, NULL, &ahc_echo, NULL, MHD_OPTION_SOCK_ADDR,
                         &daemon_ip_addr6, MHD_OPTION_END);
diff --git a/src/microhttpd/test_postprocessor.c 
b/src/microhttpd/test_postprocessor.c
index c4744ec3..9a5977bc 100644
--- a/src/microhttpd/test_postprocessor.c
+++ b/src/microhttpd/test_postprocessor.c
@@ -548,7 +548,7 @@ static int
 test_nested_multipart (void)
 {
   struct MHD_Connection connection;
-  struct MHD_HTTP_Res_Header header;
+  struct MHD_HTTP_Req_Header header;
   struct MHD_PostProcessor *pp;
   unsigned int want_off = FORM_NESTED_START;
   size_t i;
diff --git a/src/microhttpd/test_shutdown_select.c 
b/src/microhttpd/test_shutdown_select.c
index 0841589c..a5575537 100644
--- a/src/microhttpd/test_shutdown_select.c
+++ b/src/microhttpd/test_shutdown_select.c
@@ -135,7 +135,7 @@ start_socket_listen (int domain)
 #if defined(MHD_POSIX_SOCKETS) && defined(SOCK_CLOEXEC)
   fd = socket (domain, SOCK_STREAM | SOCK_CLOEXEC, 0);
   cloexec_set = 1;
-#elif defined(MHD_WINSOCK_SOCKETS) && defined (WSA_FLAG_NO_HANDLE_INHERIT)
+#elif defined(MHD_WINSOCK_SOCKETS) && defined(WSA_FLAG_NO_HANDLE_INHERIT)
   fd = WSASocketW (domain, SOCK_STREAM, 0, NULL, 0, 
WSA_FLAG_NO_HANDLE_INHERIT);
   cloexec_set = 1;
 #else  /* !SOCK_CLOEXEC */
@@ -178,7 +178,7 @@ start_socket_listen (int domain)
 #endif
   addrlen = sizeof (struct sockaddr_in);
 
-  if (bind (fd, (const struct sockaddr*) &sock_addr, addrlen) < 0)
+  if (bind (fd, (const struct sockaddr *) &sock_addr, addrlen) < 0)
   {
     fprintf (stderr, "Failed to bind socket: %u\n",
              (unsigned) sock_errno);
@@ -220,10 +220,10 @@ start_socket_listen (int domain)
 
 
 MHD_THRD_RTRN_TYPE_ MHD_THRD_CALL_SPEC_
-select_thread (void*data)
+select_thread (void *data)
 {
   /* use select() like in daemon.c */
-  MHD_socket listen_sock = *((MHD_socket*) data);
+  MHD_socket listen_sock = *((MHD_socket *) data);
   fd_set rs, ws;
   struct timeval timeout;
 
@@ -241,11 +241,11 @@ select_thread (void*data)
 
 #ifdef HAVE_POLL
 MHD_THRD_RTRN_TYPE_ MHD_THRD_CALL_SPEC_
-poll_thread (void*data)
+poll_thread (void *data)
 {
   /* use poll() like in daemon.c */
   struct pollfd p[1];
-  MHD_socket listen_sock = *((MHD_socket*) data);
+  MHD_socket listen_sock = *((MHD_socket *) data);
 
   p[0].fd = listen_sock;
   p[0].events = POLLIN;
@@ -281,7 +281,7 @@ main (int argc, char *const *argv)
   int i;
   time_t start_t, end_t;
   int result = 0;
-  MHD_THRD_RTRN_TYPE_ (MHD_THRD_CALL_SPEC_ * test_func)(void*data);
+  MHD_THRD_RTRN_TYPE_ (MHD_THRD_CALL_SPEC_ * test_func)(void *data);
 #ifdef MHD_WINSOCK_SOCKETS
   WORD ver_req;
   WSADATA wsa_data;
diff --git a/src/microhttpd/test_start_stop.c b/src/microhttpd/test_start_stop.c
index 34372090..fec35e2c 100644
--- a/src/microhttpd/test_start_stop.c
+++ b/src/microhttpd/test_start_stop.c
@@ -134,7 +134,7 @@ main (int argc,
   errorCount += testMultithreadedPoolGet (0);
 #endif
   errorCount += testExternalGet ();
-#if defined (MHD_USE_POSIX_THREADS) || defined(MHD_USE_W32_THREADS)
+#if defined(MHD_USE_POSIX_THREADS) || defined(MHD_USE_W32_THREADS)
   if (MHD_YES == MHD_is_feature_supported (MHD_FEATURE_POLL))
   {
     errorCount += testInternalGet (MHD_USE_POLL);
diff --git a/src/microhttpd/test_upgrade.c b/src/microhttpd/test_upgrade.c
index acaecf9f..2ade5edd 100644
--- a/src/microhttpd/test_upgrade.c
+++ b/src/microhttpd/test_upgrade.c
@@ -1257,7 +1257,7 @@ test_upgrade (int flags,
   struct MHD_Daemon *d = NULL;
   struct wr_socket *sock;
   struct sockaddr_in sa;
-  const union MHD_DaemonInfo *real_flags;
+  enum MHD_FLAG used_flags;
   const union MHD_DaemonInfo *dinfo;
 #if defined(HTTPS_SUPPORT) && defined(HAVE_FORK) && defined(HAVE_WAITPID)
   pid_t pid = -1;
@@ -1296,10 +1296,11 @@ test_upgrade (int flags,
 #endif /* HTTPS_SUPPORT */
   if (NULL == d)
     mhdErrorExitDesc ("MHD_start_daemon() failed");
-  real_flags = MHD_get_daemon_info (d,
-                                    MHD_DAEMON_INFO_FLAGS);
-  if (NULL == real_flags)
+  dinfo = MHD_get_daemon_info (d,
+                               MHD_DAEMON_INFO_FLAGS);
+  if (NULL == dinfo)
     mhdErrorExitDesc ("MHD_get_daemon_info() failed");
+  used_flags = dinfo->flags;
   dinfo = MHD_get_daemon_info (d,
                                MHD_DAEMON_INFO_BIND_PORT);
   if ( (NULL == dinfo) ||
@@ -1325,10 +1326,7 @@ test_upgrade (int flags,
     MHD_socket tls_fork_sock;
     uint16_t port;
 
-    /* make address sanitizer happy */
-    memcpy (&port,
-            dinfo /* ->port */,
-            sizeof (port));
+    port = dinfo->port;
     if (-1 == (pid = gnutlscli_connect (&tls_fork_sock,
                                         port)))
       externalErrorExitDesc ("gnutlscli_connect() failed");
@@ -1347,15 +1345,7 @@ test_upgrade (int flags,
                            sock))
     externalErrorExitDesc ("pthread_create() failed");
   if (0 == (flags & MHD_USE_INTERNAL_POLLING_THREAD) )
-  {
-    enum MHD_FLAG used_flags;
-
-    /* make address sanitizer happy */
-    memcpy (&used_flags,
-            real_flags /* ->flags */,
-            sizeof (used_flags));
     run_mhd_loop (d, used_flags);
-  }
   if (0 != pthread_join (pt_client,
                          NULL))
     externalErrorExitDesc ("pthread_join() failed");
diff --git a/src/microhttpd/test_upgrade_large.c 
b/src/microhttpd/test_upgrade_large.c
index e04e7ebf..83ab50ca 100644
--- a/src/microhttpd/test_upgrade_large.c
+++ b/src/microhttpd/test_upgrade_large.c
@@ -1445,7 +1445,7 @@ test_upgrade (int flags,
   struct MHD_Daemon *d = NULL;
   struct wr_socket *sock;
   struct sockaddr_in sa;
-  const union MHD_DaemonInfo *real_flags;
+  enum MHD_FLAG used_flags;
   const union MHD_DaemonInfo *dinfo;
 #if defined(HTTPS_SUPPORT) && defined(HAVE_FORK) && defined(HAVE_WAITPID)
   pid_t pid = -1;
@@ -1486,10 +1486,11 @@ test_upgrade (int flags,
 #endif /* HTTPS_SUPPORT */
   if (NULL == d)
     mhdErrorExitDesc ("MHD_start_daemon() failed");
-  real_flags = MHD_get_daemon_info (d,
-                                    MHD_DAEMON_INFO_FLAGS);
-  if (NULL == real_flags)
+  dinfo = MHD_get_daemon_info (d,
+                               MHD_DAEMON_INFO_FLAGS);
+  if (NULL == dinfo)
     mhdErrorExitDesc ("MHD_get_daemon_info() failed");
+  used_flags = dinfo->flags;
   dinfo = MHD_get_daemon_info (d,
                                MHD_DAEMON_INFO_BIND_PORT);
   if ( (NULL == dinfo) ||
@@ -1515,10 +1516,7 @@ test_upgrade (int flags,
     MHD_socket tls_fork_sock;
     uint16_t port;
 
-    /* make address sanitizer happy */
-    memcpy (&port,
-            dinfo /* ->port */,
-            sizeof (port));
+    port = dinfo->port;
     if (-1 == (pid = gnutlscli_connect (&tls_fork_sock,
                                         port)))
       externalErrorExitDesc ("gnutlscli_connect() failed");
@@ -1543,15 +1541,7 @@ test_upgrade (int flags,
                            sock))
     externalErrorExitDesc ("pthread_create() failed");
   if (0 == (flags & MHD_USE_INTERNAL_POLLING_THREAD) )
-  {
-    enum MHD_FLAG used_flags;
-
-    /* make address sanitizer happy */
-    memcpy (&used_flags,
-            real_flags /* ->flags */,
-            sizeof (used_flags));
     run_mhd_loop (d, used_flags);
-  }
   if (0 != pthread_join (pt_client,
                          NULL))
     externalErrorExitDesc ("pthread_join() failed");

-- 
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]