gnunet-svn
[Top][All Lists]
Advanced

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

[libmicrohttpd] branch master updated (da058590 -> aad7796a)


From: gnunet
Subject: [libmicrohttpd] branch master updated (da058590 -> aad7796a)
Date: Wed, 08 Apr 2020 23:47:26 +0200

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

grothoff pushed a change to branch master
in repository libmicrohttpd.

    from da058590 Improved base64-encoder function of the websocket example.
     new 6347f514 introduce 'enum MHD_Result'
     new de872dea define and use 'enum MHD_Result'
     new 89d2ef97 define and use 'enum MHD_Result' (merge)
     new aad7796a define and use 'enum MHD_Result' (merge)

The 4 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:
 ChangeLog                                         |   8 +
 doc/examples/basicauthentication.c                |  62 +--
 doc/examples/hellobrowser.c                       |  25 +-
 doc/examples/largepost.c                          | 302 ++++++------
 doc/examples/logging.c                            |  18 +-
 doc/examples/responseheaders.c                    |  56 +--
 doc/examples/sessions.c                           | 561 +++++++++++-----------
 doc/examples/simplepost.c                         | 156 +++---
 doc/examples/tlsauthentication.c                  | 150 +++---
 doc/libmicrohttpd.texi                            |  50 +-
 src/examples/authorization_example.c              |   4 +-
 src/examples/benchmark.c                          |   2 +-
 src/examples/benchmark_https.c                    |   2 +-
 src/examples/chunked_example.c                    |   4 +-
 src/examples/demo.c                               |  16 +-
 src/examples/demo_https.c                         |  18 +-
 src/examples/digest_auth_example.c                |   4 +-
 src/examples/dual_stack_example.c                 |   4 +-
 src/examples/fileserver_example.c                 |   4 +-
 src/examples/fileserver_example_dirs.c            |   4 +-
 src/examples/fileserver_example_external_select.c |   4 +-
 src/examples/http_chunked_compression.c           |   8 +-
 src/examples/http_compression.c                   |  10 +-
 src/examples/https_fileserver_example.c           |   4 +-
 src/examples/minimal_example.c                    |   4 +-
 src/examples/minimal_example_comet.c              |   4 +-
 src/examples/minimal_example_empty.c              |   4 +-
 src/examples/minimal_example_empty_tls.c          |   4 +-
 src/examples/post_example.c                       |  30 +-
 src/examples/querystring_example.c                |   4 +-
 src/examples/refuse_post_example.c                |   4 +-
 src/examples/suspend_resume_epoll.c               |   4 +-
 src/examples/timeout.c                            |   4 +-
 src/examples/upgrade_example.c                    |   4 +-
 src/examples/websocket_threaded_example.c         |  25 +-
 src/include/microhttpd.h                          | 134 +++---
 src/microhttpd/connection.c                       |  46 +-
 src/microhttpd/connection.h                       |  12 +-
 src/microhttpd/daemon.c                           |  68 +--
 src/microhttpd/digestauth.c                       |  12 +-
 src/microhttpd/internal.c                         |   2 +-
 src/microhttpd/internal.h                         |   4 +-
 src/microhttpd/postprocessor.c                    |  31 +-
 src/microhttpd/response.c                         |  16 +-
 src/microhttpd/response.h                         |   2 +-
 src/microhttpd/test_daemon.c                      |   6 +-
 src/microhttpd/test_postprocessor.c               |  12 +-
 src/microhttpd/test_postprocessor_amp.c           |   2 +-
 src/microhttpd/test_postprocessor_large.c         |   2 +-
 src/microhttpd/test_upgrade.c                     |   4 +-
 src/microhttpd/test_upgrade_large.c               |   4 +-
 src/testcurl/https/test_empty_response.c          |   4 +-
 src/testcurl/https/test_https_get.c               |   4 +-
 src/testcurl/https/test_https_get_select.c        |   4 +-
 src/testcurl/https/test_https_session_info.c      |  17 +-
 src/testcurl/https/tls_test_common.c              |   6 +-
 src/testcurl/https/tls_test_common.h              |   4 +-
 src/testcurl/perf_get.c                           |   4 +-
 src/testcurl/perf_get_concurrent.c                |   4 +-
 src/testcurl/test_callback.c                      |   4 +-
 src/testcurl/test_concurrent_stop.c               |   4 +-
 src/testcurl/test_delete.c                        |   4 +-
 src/testcurl/test_digestauth.c                    |   4 +-
 src/testcurl/test_digestauth_sha256.c             |   4 +-
 src/testcurl/test_digestauth_with_arguments.c     |   4 +-
 src/testcurl/test_get.c                           |   8 +-
 src/testcurl/test_get_chunked.c                   |   4 +-
 src/testcurl/test_get_response_cleanup.c          |   4 +-
 src/testcurl/test_get_sendfile.c                  |   6 +-
 src/testcurl/test_iplimit.c                       |   4 +-
 src/testcurl/test_large_put.c                     |   4 +-
 src/testcurl/test_long_header.c                   |   6 +-
 src/testcurl/test_parse_cookies.c                 |   4 +-
 src/testcurl/test_patch.c                         |   4 +-
 src/testcurl/test_post.c                          |  10 +-
 src/testcurl/test_post_loop.c                     |   4 +-
 src/testcurl/test_postform.c                      |   6 +-
 src/testcurl/test_process_arguments.c             |   4 +-
 src/testcurl/test_process_headers.c               |   6 +-
 src/testcurl/test_put.c                           |   4 +-
 src/testcurl/test_put_chunked.c                   |   4 +-
 src/testcurl/test_quiesce.c                       |   4 +-
 src/testcurl/test_quiesce_stream.c                |   4 +-
 src/testcurl/test_termination.c                   |   4 +-
 src/testcurl/test_timeout.c                       |   4 +-
 src/testcurl/test_urlparse.c                      |   6 +-
 src/testzzuf/test_get.c                           |   4 +-
 src/testzzuf/test_get_chunked.c                   |   4 +-
 src/testzzuf/test_long_header.c                   |  17 +-
 src/testzzuf/test_post.c                          |   6 +-
 src/testzzuf/test_post_form.c                     |   6 +-
 src/testzzuf/test_put.c                           |   4 +-
 src/testzzuf/test_put_chunked.c                   |   4 +-
 src/testzzuf/test_put_large.c                     |   6 +-
 94 files changed, 1099 insertions(+), 1051 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 36c5bdbf..9fede6ae 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+Wed 08 Apr 2020 10:53:01 PM CEST
+    Introduce `enum MHD_Result` for #MHD_YES/#MHD_NO to avoid using 'int' so 
much.
+    Note that this change WILL cause compiler warnings until (most) MHD 
callbacks
+    in application code change their return type from 'int' to 'enum 
MHD_Result'.
+    That said, avoiding possible confusions of different enums is going to make
+    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
 
diff --git a/doc/examples/basicauthentication.c 
b/doc/examples/basicauthentication.c
index 88cb79b7..5d156f04 100644
--- a/doc/examples/basicauthentication.c
+++ b/doc/examples/basicauthentication.c
@@ -17,7 +17,7 @@
 #define PORT 8888
 
 
-static int
+static enum MHD_Result
 answer_to_connection (void *cls, struct MHD_Connection *connection,
                       const char *url, const char *method,
                       const char *version, const char *upload_data,
@@ -28,45 +28,47 @@ answer_to_connection (void *cls, struct MHD_Connection 
*connection,
   int fail;
   int ret;
   struct MHD_Response *response;
-  (void)cls;               /* Unused. Silent compiler warning. */
-  (void)url;               /* Unused. Silent compiler warning. */
-  (void)version;           /* Unused. Silent compiler warning. */
-  (void)upload_data;       /* Unused. Silent compiler warning. */
-  (void)upload_data_size;  /* Unused. Silent compiler warning. */
+  (void) cls;               /* Unused. Silent compiler warning. */
+  (void) url;               /* Unused. Silent compiler warning. */
+  (void) version;           /* Unused. Silent compiler warning. */
+  (void) upload_data;       /* Unused. Silent compiler warning. */
+  (void) upload_data_size;  /* Unused. Silent compiler warning. */
 
   if (0 != strcmp (method, "GET"))
     return MHD_NO;
   if (NULL == *con_cls)
-    {
-      *con_cls = connection;
-      return MHD_YES;
-    }
+  {
+    *con_cls = connection;
+    return MHD_YES;
+  }
   pass = NULL;
   user = MHD_basic_auth_get_username_password (connection,
                                                &pass);
   fail = ( (NULL == user) ||
-          (0 != strcmp (user, "root")) ||
-          (0 != strcmp (pass, "pa$$w0rd") ) );
-  if (NULL != user) MHD_free (user);
-  if (NULL != pass) MHD_free (pass);
+           (0 != strcmp (user, "root")) ||
+           (0 != strcmp (pass, "pa$$w0rd") ) );
+  if (NULL != user)
+    MHD_free (user);
+  if (NULL != pass)
+    MHD_free (pass);
   if (fail)
-    {
-      const char *page = "<html><body>Go away.</body></html>";
-      response =
-       MHD_create_response_from_buffer (strlen (page), (void *) page,
-                                        MHD_RESPMEM_PERSISTENT);
-      ret = MHD_queue_basic_auth_fail_response (connection,
-                                               "my realm",
-                                               response);
-    }
+  {
+    const char *page = "<html><body>Go away.</body></html>";
+    response =
+      MHD_create_response_from_buffer (strlen (page), (void *) page,
+                                       MHD_RESPMEM_PERSISTENT);
+    ret = MHD_queue_basic_auth_fail_response (connection,
+                                              "my realm",
+                                              response);
+  }
   else
-    {
-      const char *page = "<html><body>A secret.</body></html>";
-      response =
-       MHD_create_response_from_buffer (strlen (page), (void *) page,
-                                        MHD_RESPMEM_PERSISTENT);
-      ret = MHD_queue_response (connection, MHD_HTTP_OK, response);
-    }
+  {
+    const char *page = "<html><body>A secret.</body></html>";
+    response =
+      MHD_create_response_from_buffer (strlen (page), (void *) page,
+                                       MHD_RESPMEM_PERSISTENT);
+    ret = MHD_queue_response (connection, MHD_HTTP_OK, response);
+  }
   MHD_destroy_response (response);
   return ret;
 }
diff --git a/doc/examples/hellobrowser.c b/doc/examples/hellobrowser.c
index dce4ee6d..0c13c24d 100644
--- a/doc/examples/hellobrowser.c
+++ b/doc/examples/hellobrowser.c
@@ -14,7 +14,7 @@
 
 #define PORT 8888
 
-static int
+static enum MHD_Result
 answer_to_connection (void *cls, struct MHD_Connection *connection,
                       const char *url, const char *method,
                       const char *version, const char *upload_data,
@@ -22,18 +22,18 @@ answer_to_connection (void *cls, struct MHD_Connection 
*connection,
 {
   const char *page = "<html><body>Hello, browser!</body></html>";
   struct MHD_Response *response;
-  int ret;
-  (void)cls;               /* Unused. Silent compiler warning. */
-  (void)url;               /* Unused. Silent compiler warning. */
-  (void)method;            /* Unused. Silent compiler warning. */
-  (void)version;           /* Unused. Silent compiler warning. */
-  (void)upload_data;       /* Unused. Silent compiler warning. */
-  (void)upload_data_size;  /* Unused. Silent compiler warning. */
-  (void)con_cls;           /* Unused. Silent compiler warning. */
+  enum MHD_Result ret;
+  (void) cls;               /* Unused. Silent compiler warning. */
+  (void) url;               /* Unused. Silent compiler warning. */
+  (void) method;            /* Unused. Silent compiler warning. */
+  (void) version;           /* Unused. Silent compiler warning. */
+  (void) upload_data;       /* Unused. Silent compiler warning. */
+  (void) upload_data_size;  /* Unused. Silent compiler warning. */
+  (void) con_cls;           /* Unused. Silent compiler warning. */
 
   response =
-    MHD_create_response_from_buffer (strlen (page), (void *) page, 
-                                    MHD_RESPMEM_PERSISTENT);
+    MHD_create_response_from_buffer (strlen (page), (void *) page,
+                                     MHD_RESPMEM_PERSISTENT);
   ret = MHD_queue_response (connection, MHD_HTTP_OK, response);
   MHD_destroy_response (response);
 
@@ -46,7 +46,8 @@ main (void)
 {
   struct MHD_Daemon *daemon;
 
-  daemon = MHD_start_daemon (MHD_USE_AUTO | MHD_USE_INTERNAL_POLLING_THREAD, 
PORT, NULL, NULL,
+  daemon = MHD_start_daemon (MHD_USE_AUTO | MHD_USE_INTERNAL_POLLING_THREAD,
+                             PORT, NULL, NULL,
                              &answer_to_connection, NULL, MHD_OPTION_END);
   if (NULL == daemon)
     return 1;
diff --git a/doc/examples/largepost.c b/doc/examples/largepost.c
index 8ef7c9fe..8618209f 100644
--- a/doc/examples/largepost.c
+++ b/doc/examples/largepost.c
@@ -15,11 +15,11 @@
 
 #ifdef _MSC_VER
 #ifndef strcasecmp
-#define strcasecmp(a,b) _stricmp((a),(b))
+#define strcasecmp(a,b) _stricmp ((a),(b))
 #endif /* !strcasecmp */
 #endif /* _MSC_VER */
 
-#if defined(_MSC_VER) && _MSC_VER+0 <= 1800
+#if defined(_MSC_VER) && _MSC_VER + 0 <= 1800
 /* Substitution is OK while return value is not used */
 #define snprintf _snprintf
 #endif
@@ -29,10 +29,10 @@
 #define MAXCLIENTS      2
 
 enum ConnectionType
-  {
-    GET = 0,
-    POST = 1
-  };
+{
+  GET = 0,
+  POST = 1
+};
 
 static unsigned int nr_of_uploading_clients = 0;
 
@@ -66,7 +66,8 @@ struct connection_info_struct
 };
 
 
-const char *askpage = "<html><body>\n\
+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\
@@ -85,23 +86,23 @@ const char *fileexistspage =
   "<html><body>This file already exists.</body></html>";
 const char *fileioerror =
   "<html><body>IO error writing to disk.</body></html>";
-const char* const postprocerror =
+const char*const postprocerror =
   "<html><head><title>Error</title></head><body>Error processing POST 
data</body></html>";
 
 
-static int
+static enum MHD_Result
 send_page (struct MHD_Connection *connection,
            const char *page,
            int status_code)
 {
-  int ret;
+  enum MHD_Result ret;
   struct MHD_Response *response;
 
   response =
     MHD_create_response_from_buffer (strlen (page),
                                      (void *) page,
-                                    MHD_RESPMEM_MUST_COPY);
-  if (!response)
+                                     MHD_RESPMEM_MUST_COPY);
+  if (! response)
     return MHD_NO;
   MHD_add_response_header (response,
                            MHD_HTTP_HEADER_CONTENT_TYPE,
@@ -115,7 +116,7 @@ send_page (struct MHD_Connection *connection,
 }
 
 
-static int
+static enum MHD_Result
 iterate_post (void *coninfo_cls,
               enum MHD_ValueKind kind,
               const char *key,
@@ -128,50 +129,50 @@ iterate_post (void *coninfo_cls,
 {
   struct connection_info_struct *con_info = coninfo_cls;
   FILE *fp;
-  (void)kind;               /* Unused. Silent compiler warning. */
-  (void)content_type;       /* Unused. Silent compiler warning. */
-  (void)transfer_encoding;  /* Unused. Silent compiler warning. */
-  (void)off;                /* Unused. Silent compiler warning. */
+  (void) kind;               /* Unused. Silent compiler warning. */
+  (void) content_type;       /* Unused. Silent compiler warning. */
+  (void) transfer_encoding;  /* Unused. Silent compiler warning. */
+  (void) off;                /* Unused. Silent compiler warning. */
 
   if (0 != strcmp (key, "file"))
+  {
+    con_info->answerstring = servererrorpage;
+    con_info->answercode = MHD_HTTP_BAD_REQUEST;
+    return MHD_YES;
+  }
+
+  if (! con_info->fp)
+  {
+    if (0 != con_info->answercode)   /* something went wrong */
+      return MHD_YES;
+    if (NULL != (fp = fopen (filename, "rb")))
     {
-      con_info->answerstring = servererrorpage;
-      con_info->answercode = MHD_HTTP_BAD_REQUEST;
+      fclose (fp);
+      con_info->answerstring = fileexistspage;
+      con_info->answercode = MHD_HTTP_FORBIDDEN;
       return MHD_YES;
     }
-
-  if (! con_info->fp)
+    /* NOTE: This is technically a race with the 'fopen()' above,
+       but there is no easy fix, short of moving to open(O_EXCL)
+       instead of using fopen(). For the example, we do not care. */
+    con_info->fp = fopen (filename, "ab");
+    if (! con_info->fp)
     {
-      if (0 != con_info->answercode) /* something went wrong */
-        return MHD_YES;
-      if (NULL != (fp = fopen (filename, "rb")))
-        {
-          fclose (fp);
-          con_info->answerstring = fileexistspage;
-          con_info->answercode = MHD_HTTP_FORBIDDEN;
-          return MHD_YES;
-        }
-      /* NOTE: This is technically a race with the 'fopen()' above,
-         but there is no easy fix, short of moving to open(O_EXCL)
-         instead of using fopen(). For the example, we do not care. */
-      con_info->fp = fopen (filename, "ab");
-      if (!con_info->fp)
-        {
-          con_info->answerstring = fileioerror;
-          con_info->answercode = MHD_HTTP_INTERNAL_SERVER_ERROR;
-          return MHD_YES;
-        }
+      con_info->answerstring = fileioerror;
+      con_info->answercode = MHD_HTTP_INTERNAL_SERVER_ERROR;
+      return MHD_YES;
     }
+  }
 
   if (size > 0)
+  {
+    if (! fwrite (data, sizeof (char), size, con_info->fp))
     {
-      if (! fwrite (data, sizeof (char), size, con_info->fp))
-        {
-          con_info->answerstring = fileioerror;
-          con_info->answercode = MHD_HTTP_INTERNAL_SERVER_ERROR;
-          return MHD_YES;
-        }
+      con_info->answerstring = fileioerror;
+      con_info->answercode = MHD_HTTP_INTERNAL_SERVER_ERROR;
+      return MHD_YES;
     }
+  }
 
   return MHD_YES;
 }
@@ -184,31 +185,31 @@ request_completed (void *cls,
                    enum MHD_RequestTerminationCode toe)
 {
   struct connection_info_struct *con_info = *con_cls;
-  (void)cls;         /* Unused. Silent compiler warning. */
-  (void)connection;  /* Unused. Silent compiler warning. */
-  (void)toe;         /* Unused. Silent compiler warning. */
+  (void) cls;         /* Unused. Silent compiler warning. */
+  (void) connection;  /* Unused. Silent compiler warning. */
+  (void) toe;         /* Unused. Silent compiler warning. */
 
   if (NULL == con_info)
     return;
 
   if (con_info->connectiontype == POST)
+  {
+    if (NULL != con_info->postprocessor)
     {
-      if (NULL != con_info->postprocessor)
-        {
-          MHD_destroy_post_processor (con_info->postprocessor);
-          nr_of_uploading_clients--;
-        }
-
-      if (con_info->fp)
-        fclose (con_info->fp);
+      MHD_destroy_post_processor (con_info->postprocessor);
+      nr_of_uploading_clients--;
     }
 
+    if (con_info->fp)
+      fclose (con_info->fp);
+  }
+
   free (con_info);
   *con_cls = NULL;
 }
 
 
-static int
+static enum MHD_Result
 answer_to_connection (void *cls,
                       struct MHD_Connection *connection,
                       const char *url,
@@ -218,109 +219,109 @@ answer_to_connection (void *cls,
                       size_t *upload_data_size,
                       void **con_cls)
 {
-  (void)cls;               /* Unused. Silent compiler warning. */
-  (void)url;               /* Unused. Silent compiler warning. */
-  (void)version;           /* Unused. Silent compiler warning. */
+  (void) cls;               /* Unused. Silent compiler warning. */
+  (void) url;               /* Unused. Silent compiler warning. */
+  (void) version;           /* Unused. Silent compiler warning. */
 
   if (NULL == *con_cls)
-    {
-      /* First call, setup data structures */
-      struct connection_info_struct *con_info;
+  {
+    /* First call, setup data structures */
+    struct connection_info_struct *con_info;
+
+    if (nr_of_uploading_clients >= MAXCLIENTS)
+      return send_page (connection,
+                        busypage,
+                        MHD_HTTP_SERVICE_UNAVAILABLE);
 
-      if (nr_of_uploading_clients >= MAXCLIENTS)
-        return send_page (connection,
-                          busypage,
-                          MHD_HTTP_SERVICE_UNAVAILABLE);
+    con_info = malloc (sizeof (struct connection_info_struct));
+    if (NULL == con_info)
+      return MHD_NO;
+    con_info->answercode = 0;   /* none yet */
+    con_info->fp = NULL;
 
-      con_info = malloc (sizeof (struct connection_info_struct));
-      if (NULL == con_info)
+    if (0 == strcasecmp (method, MHD_HTTP_METHOD_POST))
+    {
+      con_info->postprocessor =
+        MHD_create_post_processor (connection,
+                                   POSTBUFFERSIZE,
+                                   &iterate_post,
+                                   (void *) con_info);
+
+      if (NULL == con_info->postprocessor)
+      {
+        free (con_info);
         return MHD_NO;
-      con_info->answercode = 0; /* none yet */
-      con_info->fp = NULL;
+      }
 
-      if (0 == strcasecmp (method, MHD_HTTP_METHOD_POST))
-        {
-          con_info->postprocessor =
-            MHD_create_post_processor (connection,
-                                       POSTBUFFERSIZE,
-                                       &iterate_post,
-                                       (void *) con_info);
+      nr_of_uploading_clients++;
 
-          if (NULL == con_info->postprocessor)
-            {
-              free (con_info);
-              return MHD_NO;
-            }
+      con_info->connectiontype = POST;
+    }
+    else
+    {
+      con_info->connectiontype = GET;
+    }
 
-          nr_of_uploading_clients++;
+    *con_cls = (void *) con_info;
 
-          con_info->connectiontype = POST;
-        }
-      else
-        {
-          con_info->connectiontype = GET;
-        }
+    return MHD_YES;
+  }
 
-      *con_cls = (void *) con_info;
+  if (0 == strcasecmp (method, MHD_HTTP_METHOD_GET))
+  {
+    /* We just return the standard form for uploads on all GET requests */
+    char buffer[1024];
+
+    snprintf (buffer,
+              sizeof (buffer),
+              askpage,
+              nr_of_uploading_clients);
+    return send_page (connection,
+                      buffer,
+                      MHD_HTTP_OK);
+  }
 
-      return MHD_YES;
-    }
+  if (0 == strcasecmp (method, MHD_HTTP_METHOD_POST))
+  {
+    struct connection_info_struct *con_info = *con_cls;
 
-  if (0 == strcasecmp (method, MHD_HTTP_METHOD_GET))
+    if (0 != *upload_data_size)
     {
-      /* We just return the standard form for uploads on all GET requests */
-      char buffer[1024];
+      /* Upload not yet done */
+      if (0 != con_info->answercode)
+      {
+        /* we already know the answer, skip rest of upload */
+        *upload_data_size = 0;
+        return MHD_YES;
+      }
+      if (MHD_YES !=
+          MHD_post_process (con_info->postprocessor,
+                            upload_data,
+                            *upload_data_size))
+      {
+        con_info->answerstring = postprocerror;
+        con_info->answercode = MHD_HTTP_INTERNAL_SERVER_ERROR;
+      }
+      *upload_data_size = 0;
 
-      snprintf (buffer,
-                sizeof (buffer),
-                askpage,
-                nr_of_uploading_clients);
-      return send_page (connection,
-                        buffer,
-                        MHD_HTTP_OK);
+      return MHD_YES;
     }
-
-  if (0 == strcasecmp (method, MHD_HTTP_METHOD_POST))
+    /* Upload finished */
+    if (NULL != con_info->fp)
     {
-      struct connection_info_struct *con_info = *con_cls;
-
-      if (0 != *upload_data_size)
-        {
-          /* Upload not yet done */
-          if (0 != con_info->answercode)
-            {
-              /* we already know the answer, skip rest of upload */
-              *upload_data_size = 0;
-              return MHD_YES;
-            }
-          if (MHD_YES !=
-              MHD_post_process (con_info->postprocessor,
-                                upload_data,
-                                *upload_data_size))
-            {
-              con_info->answerstring = postprocerror;
-              con_info->answercode = MHD_HTTP_INTERNAL_SERVER_ERROR;
-            }
-          *upload_data_size = 0;
-
-          return MHD_YES;
-        }
-      /* Upload finished */
-      if (NULL != con_info->fp)
-        {
-          fclose (con_info->fp);
-          con_info->fp = NULL;
-        }
-      if (0 == con_info->answercode)
-        {
-          /* No errors encountered, declare success */
-          con_info->answerstring = completepage;
-          con_info->answercode = MHD_HTTP_OK;
-        }
-      return send_page (connection,
-                        con_info->answerstring,
-                        con_info->answercode);
+      fclose (con_info->fp);
+      con_info->fp = NULL;
     }
+    if (0 == con_info->answercode)
+    {
+      /* No errors encountered, declare success */
+      con_info->answerstring = completepage;
+      con_info->answercode = MHD_HTTP_OK;
+    }
+    return send_page (connection,
+                      con_info->answerstring,
+                      con_info->answercode);
+  }
 
   /* Note a GET or a POST, generate error */
   return send_page (connection,
@@ -337,14 +338,15 @@ main ()
   daemon = MHD_start_daemon (MHD_USE_INTERNAL_POLLING_THREAD,
                              PORT, NULL, NULL,
                              &answer_to_connection, NULL,
-                             MHD_OPTION_NOTIFY_COMPLETED, &request_completed, 
NULL,
+                             MHD_OPTION_NOTIFY_COMPLETED, &request_completed,
+                             NULL,
                              MHD_OPTION_END);
   if (NULL == daemon)
-    {
-      fprintf (stderr,
-               "Failed to start daemon\n");
-      return 1;
-    }
+  {
+    fprintf (stderr,
+             "Failed to start daemon\n");
+    return 1;
+  }
   (void) getchar ();
   MHD_stop_daemon (daemon);
   return 0;
diff --git a/doc/examples/logging.c b/doc/examples/logging.c
index 239fbe7d..22ff7e62 100644
--- a/doc/examples/logging.c
+++ b/doc/examples/logging.c
@@ -14,28 +14,28 @@
 #define PORT 8888
 
 
-static int
+static enum MHD_Result
 print_out_key (void *cls, enum MHD_ValueKind kind, const char *key,
                const char *value)
 {
-  (void)cls;    /* Unused. Silent compiler warning. */
-  (void)kind;   /* Unused. Silent compiler warning. */
+  (void) cls;    /* Unused. Silent compiler warning. */
+  (void) kind;   /* Unused. Silent compiler warning. */
   printf ("%s: %s\n", key, value);
   return MHD_YES;
 }
 
 
-static int
+static enum MHD_Result
 answer_to_connection (void *cls, struct MHD_Connection *connection,
                       const char *url, const char *method,
                       const char *version, const char *upload_data,
                       size_t *upload_data_size, void **con_cls)
 {
-  (void)cls;               /* Unused. Silent compiler warning. */
-  (void)version;           /* Unused. Silent compiler warning. */
-  (void)upload_data;       /* Unused. Silent compiler warning. */
-  (void)upload_data_size;  /* Unused. Silent compiler warning. */
-  (void)con_cls;           /* Unused. Silent compiler warning. */
+  (void) cls;               /* Unused. Silent compiler warning. */
+  (void) version;           /* Unused. Silent compiler warning. */
+  (void) upload_data;       /* Unused. Silent compiler warning. */
+  (void) upload_data_size;  /* Unused. Silent compiler warning. */
+  (void) con_cls;           /* Unused. Silent compiler warning. */
   printf ("New %s request for %s using version %s\n", method, url, version);
 
   MHD_get_connection_values (connection, MHD_HEADER_KIND, print_out_key,
diff --git a/doc/examples/responseheaders.c b/doc/examples/responseheaders.c
index 391f86f6..f1cf939c 100644
--- a/doc/examples/responseheaders.c
+++ b/doc/examples/responseheaders.c
@@ -19,7 +19,7 @@
 #define FILENAME "picture.png"
 #define MIMETYPE "image/png"
 
-static int
+static enum MHD_Result
 answer_to_connection (void *cls, struct MHD_Connection *connection,
                       const char *url, const char *method,
                       const char *version, const char *upload_data,
@@ -27,43 +27,43 @@ answer_to_connection (void *cls, struct MHD_Connection 
*connection,
 {
   struct MHD_Response *response;
   int fd;
-  int ret;
+  enum MHD_Result ret;
   struct stat sbuf;
-  (void)cls;               /* Unused. Silent compiler warning. */
-  (void)url;               /* Unused. Silent compiler warning. */
-  (void)version;           /* Unused. Silent compiler warning. */
-  (void)upload_data;       /* Unused. Silent compiler warning. */
-  (void)upload_data_size;  /* Unused. Silent compiler warning. */
-  (void)con_cls;           /* Unused. Silent compiler warning. */
+  (void) cls;               /* Unused. Silent compiler warning. */
+  (void) url;               /* Unused. Silent compiler warning. */
+  (void) version;           /* Unused. Silent compiler warning. */
+  (void) upload_data;       /* Unused. Silent compiler warning. */
+  (void) upload_data_size;  /* Unused. Silent compiler warning. */
+  (void) con_cls;           /* Unused. Silent compiler warning. */
 
   if (0 != strcmp (method, "GET"))
     return MHD_NO;
 
   if ( (-1 == (fd = open (FILENAME, O_RDONLY))) ||
        (0 != fstat (fd, &sbuf)) )
-    {
-      const char *errorstr =
-        "<html><body>An internal server error has occurred!\
+  {
+    const char *errorstr =
+      "<html><body>An internal server error has occurred!\
                               </body></html>";
-      /* error accessing file */
-      if (fd != -1)
-       (void) close (fd);
-      response =
-       MHD_create_response_from_buffer (strlen (errorstr),
-                                        (void *) errorstr,
-                                        MHD_RESPMEM_PERSISTENT);
-      if (NULL != response)
-        {
-          ret =
-            MHD_queue_response (connection, MHD_HTTP_INTERNAL_SERVER_ERROR,
-                                response);
-          MHD_destroy_response (response);
+    /* error accessing file */
+    if (fd != -1)
+      (void) close (fd);
+    response =
+      MHD_create_response_from_buffer (strlen (errorstr),
+                                       (void *) errorstr,
+                                       MHD_RESPMEM_PERSISTENT);
+    if (NULL != response)
+    {
+      ret =
+        MHD_queue_response (connection, MHD_HTTP_INTERNAL_SERVER_ERROR,
+                            response);
+      MHD_destroy_response (response);
 
-          return ret;
-        }
-      else
-        return MHD_NO;
+      return ret;
     }
+    else
+      return MHD_NO;
+  }
   response =
     MHD_create_response_from_fd_at_offset64 (sbuf.st_size, fd, 0);
   MHD_add_response_header (response, "Content-Type", MIMETYPE);
diff --git a/doc/examples/sessions.c b/doc/examples/sessions.c
index 139dcbc8..6d6cf5ba 100644
--- a/doc/examples/sessions.c
+++ b/doc/examples/sessions.c
@@ -11,7 +11,7 @@
 #include <time.h>
 #include <microhttpd.h>
 
-#if defined _WIN32 && !defined(__MINGW64_VERSION_MAJOR)
+#if defined _WIN32 && ! defined(__MINGW64_VERSION_MAJOR)
 static int
 asprintf (char **resultp, const char *format, ...)
 {
@@ -32,7 +32,7 @@ asprintf (char **resultp, const char *format, ...)
     if (result != NULL)
     {
       int len2 = _vscprintf ((char *) format, argptr);
-      if (len2 != len - 1 || len2 <= 0)
+      if ((len2 != len - 1) || (len2 <= 0))
       {
         free (result);
         result = NULL;
@@ -49,37 +49,45 @@ asprintf (char **resultp, const char *format, ...)
   va_end (argptr);
   return len;
 }
+
+
 #endif
 
 /**
  * Invalid method page.
  */
-#define METHOD_ERROR "<html><head><title>Illegal 
request</title></head><body>Go away.</body></html>"
+#define METHOD_ERROR \
+  "<html><head><title>Illegal request</title></head><body>Go 
away.</body></html>"
 
 /**
  * Invalid URL page.
  */
-#define NOT_FOUND_ERROR "<html><head><title>Not found</title></head><body>Go 
away.</body></html>"
+#define NOT_FOUND_ERROR \
+  "<html><head><title>Not found</title></head><body>Go away.</body></html>"
 
 /**
  * Front page. (/)
  */
-#define MAIN_PAGE "<html><head><title>Welcome</title></head><body><form 
action=\"/2\" method=\"post\">What is your name? <input type=\"text\" 
name=\"v1\" value=\"%s\" /><input type=\"submit\" value=\"Next\" 
/></body></html>"
+#define MAIN_PAGE \
+  "<html><head><title>Welcome</title></head><body><form action=\"/2\" 
method=\"post\">What is your name? <input type=\"text\" name=\"v1\" 
value=\"%s\" /><input type=\"submit\" value=\"Next\" /></body></html>"
 
 /**
  * Second page. (/2)
  */
-#define SECOND_PAGE "<html><head><title>Tell me more</title></head><body><a 
href=\"/\">previous</a> <form action=\"/S\" method=\"post\">%s, what is your 
job? <input type=\"text\" name=\"v2\" value=\"%s\" /><input type=\"submit\" 
value=\"Next\" /></body></html>"
+#define SECOND_PAGE \
+  "<html><head><title>Tell me more</title></head><body><a 
href=\"/\">previous</a> <form action=\"/S\" method=\"post\">%s, what is your 
job? <input type=\"text\" name=\"v2\" value=\"%s\" /><input type=\"submit\" 
value=\"Next\" /></body></html>"
 
 /**
  * Second page (/S)
  */
-#define SUBMIT_PAGE "<html><head><title>Ready to 
submit?</title></head><body><form action=\"/F\" method=\"post\"><a 
href=\"/2\">previous </a> <input type=\"hidden\" name=\"DONE\" value=\"yes\" 
/><input type=\"submit\" value=\"Submit\" /></body></html>"
+#define SUBMIT_PAGE \
+  "<html><head><title>Ready to submit?</title></head><body><form action=\"/F\" 
method=\"post\"><a href=\"/2\">previous </a> <input type=\"hidden\" 
name=\"DONE\" value=\"yes\" /><input type=\"submit\" value=\"Submit\" 
/></body></html>"
 
 /**
  * Last page.
  */
-#define LAST_PAGE "<html><head><title>Thank you</title></head><body>Thank 
you.</body></html>"
+#define LAST_PAGE \
+  "<html><head><title>Thank you</title></head><body>Thank you.</body></html>"
 
 /**
  * Name of our cookie.
@@ -159,8 +167,6 @@ struct Request
 static struct Session *sessions;
 
 
-
-
 /**
  * Return the session handle for this connection, or
  * create one if this is a new user.
@@ -172,40 +178,40 @@ get_session (struct MHD_Connection *connection)
   const char *cookie;
 
   cookie = MHD_lookup_connection_value (connection,
-                                       MHD_COOKIE_KIND,
-                                       COOKIE_NAME);
+                                        MHD_COOKIE_KIND,
+                                        COOKIE_NAME);
   if (cookie != NULL)
+  {
+    /* find existing session */
+    ret = sessions;
+    while (NULL != ret)
     {
-      /* find existing session */
-      ret = sessions;
-      while (NULL != ret)
-       {
-         if (0 == strcmp (cookie, ret->sid))
-           break;
-         ret = ret->next;
-       }
-      if (NULL != ret)
-       {
-         ret->rc++;
-         return ret;
-       }
+      if (0 == strcmp (cookie, ret->sid))
+        break;
+      ret = ret->next;
     }
+    if (NULL != ret)
+    {
+      ret->rc++;
+      return ret;
+    }
+  }
   /* create fresh session */
   ret = calloc (1, sizeof (struct Session));
   if (NULL == ret)
-    {
-      fprintf (stderr, "calloc error: %s\n", strerror (errno));
-      return NULL;
-    }
+  {
+    fprintf (stderr, "calloc error: %s\n", strerror (errno));
+    return NULL;
+  }
   /* not a super-secure way to generate a random session ID,
      but should do for a simple example... */
   snprintf (ret->sid,
-           sizeof (ret->sid),
-           "%X%X%X%X",
-           (unsigned int) rand (),
-           (unsigned int) rand (),
-           (unsigned int) rand (),
-           (unsigned int) rand ());
+            sizeof (ret->sid),
+            "%X%X%X%X",
+            (unsigned int) rand (),
+            (unsigned int) rand (),
+            (unsigned int) rand (),
+            (unsigned int) rand ());
   ret->rc++;
   ret->start = time (NULL);
   ret->next = sessions;
@@ -221,12 +227,12 @@ get_session (struct MHD_Connection *connection)
  * @param mime mime type to use
  * @param session session information
  * @param connection connection to process
- * @param MHD_YES on success, MHD_NO on failure
+ * @param #MHD_YES on success, #MHD_NO on failure
  */
-typedef int (*PageHandler)(const void *cls,
-                          const char *mime,
-                          struct Session *session,
-                          struct MHD_Connection *connection);
+typedef enum MHD_Result (*PageHandler)(const void *cls,
+                                       const char *mime,
+                                       struct Session *session,
+                                       struct MHD_Connection *connection);
 
 
 /**
@@ -264,22 +270,22 @@ struct Page
  */
 static void
 add_session_cookie (struct Session *session,
-                   struct MHD_Response *response)
+                    struct MHD_Response *response)
 {
   char cstr[256];
   snprintf (cstr,
-           sizeof (cstr),
-           "%s=%s",
-           COOKIE_NAME,
-           session->sid);
+            sizeof (cstr),
+            "%s=%s",
+            COOKIE_NAME,
+            session->sid);
   if (MHD_NO ==
       MHD_add_response_header (response,
-                              MHD_HTTP_HEADER_SET_COOKIE,
-                              cstr))
-    {
-      fprintf (stderr,
-              "Failed to set session cookie header!\n");
-    }
+                               MHD_HTTP_HEADER_SET_COOKIE,
+                               cstr))
+  {
+    fprintf (stderr,
+             "Failed to set session cookie header!\n");
+  }
 }
 
 
@@ -292,27 +298,27 @@ add_session_cookie (struct Session *session,
  * @param session session handle
  * @param connection connection to use
  */
-static int
+static enum MHD_Result
 serve_simple_form (const void *cls,
-                  const char *mime,
-                  struct Session *session,
-                  struct MHD_Connection *connection)
+                   const char *mime,
+                   struct Session *session,
+                   struct MHD_Connection *connection)
 {
-  int ret;
+  enum MHD_Result ret;
   const char *form = cls;
   struct MHD_Response *response;
 
   /* return static form */
   response = MHD_create_response_from_buffer (strlen (form),
-                                             (void *) form,
-                                             MHD_RESPMEM_PERSISTENT);
+                                              (void *) form,
+                                              MHD_RESPMEM_PERSISTENT);
   add_session_cookie (session, response);
   MHD_add_response_header (response,
-                          MHD_HTTP_HEADER_CONTENT_ENCODING,
-                          mime);
+                           MHD_HTTP_HEADER_CONTENT_ENCODING,
+                           mime);
   ret = MHD_queue_response (connection,
-                           MHD_HTTP_OK,
-                           response);
+                            MHD_HTTP_OK,
+                            response);
   MHD_destroy_response (response);
   return ret;
 }
@@ -326,35 +332,35 @@ serve_simple_form (const void *cls,
  * @param session session handle
  * @param connection connection to use
  */
-static int
+static enum MHD_Result
 fill_v1_form (const void *cls,
-             const char *mime,
-             struct Session *session,
-             struct MHD_Connection *connection)
+              const char *mime,
+              struct Session *session,
+              struct MHD_Connection *connection)
 {
-  int ret;
+  enum MHD_Result ret;
   const char *form = cls;
   char *reply;
   struct MHD_Response *response;
 
   if (-1 == asprintf (&reply,
-                     form,
-                     session->value_1))
-    {
-      /* oops */
-      return MHD_NO;
-    }
+                      form,
+                      session->value_1))
+  {
+    /* oops */
+    return MHD_NO;
+  }
   /* return static form */
   response = MHD_create_response_from_buffer (strlen (reply),
-                                             (void *) reply,
-                                             MHD_RESPMEM_MUST_FREE);
+                                              (void *) reply,
+                                              MHD_RESPMEM_MUST_FREE);
   add_session_cookie (session, response);
   MHD_add_response_header (response,
-                          MHD_HTTP_HEADER_CONTENT_ENCODING,
-                          mime);
+                           MHD_HTTP_HEADER_CONTENT_ENCODING,
+                           mime);
   ret = MHD_queue_response (connection,
-                           MHD_HTTP_OK,
-                           response);
+                            MHD_HTTP_OK,
+                            response);
   MHD_destroy_response (response);
   return ret;
 }
@@ -368,36 +374,36 @@ fill_v1_form (const void *cls,
  * @param session session handle
  * @param connection connection to use
  */
-static int
+static enum MHD_Result
 fill_v1_v2_form (const void *cls,
-                const char *mime,
-                struct Session *session,
-                struct MHD_Connection *connection)
+                 const char *mime,
+                 struct Session *session,
+                 struct MHD_Connection *connection)
 {
-  int ret;
+  enum MHD_Result ret;
   const char *form = cls;
   char *reply;
   struct MHD_Response *response;
 
   if (-1 == asprintf (&reply,
-                     form,
-                     session->value_1,
-                     session->value_2))
-    {
-      /* oops */
-      return MHD_NO;
-    }
+                      form,
+                      session->value_1,
+                      session->value_2))
+  {
+    /* oops */
+    return MHD_NO;
+  }
   /* return static form */
   response = MHD_create_response_from_buffer (strlen (reply),
-                                             (void *) reply,
-                                             MHD_RESPMEM_MUST_FREE);
+                                              (void *) reply,
+                                              MHD_RESPMEM_MUST_FREE);
   add_session_cookie (session, response);
   MHD_add_response_header (response,
-                          MHD_HTTP_HEADER_CONTENT_ENCODING,
-                          mime);
+                           MHD_HTTP_HEADER_CONTENT_ENCODING,
+                           mime);
   ret = MHD_queue_response (connection,
-                           MHD_HTTP_OK,
-                           response);
+                            MHD_HTTP_OK,
+                            response);
   MHD_destroy_response (response);
   return ret;
 }
@@ -411,27 +417,27 @@ fill_v1_v2_form (const void *cls,
  * @param session session handle
  * @param connection connection to use
  */
-static int
+static enum MHD_Result
 not_found_page (const void *cls,
-               const char *mime,
-               struct Session *session,
-               struct MHD_Connection *connection)
+                const char *mime,
+                struct Session *session,
+                struct MHD_Connection *connection)
 {
-  int ret;
+  enum MHD_Result ret;
   struct MHD_Response *response;
-  (void)cls;     /* Unused. Silent compiler warning. */
-  (void)session; /* Unused. Silent compiler warning. */
+  (void) cls;     /* Unused. Silent compiler warning. */
+  (void) session; /* Unused. Silent compiler warning. */
 
   /* unsupported HTTP method */
   response = MHD_create_response_from_buffer (strlen (NOT_FOUND_ERROR),
-                                             (void *) NOT_FOUND_ERROR,
-                                             MHD_RESPMEM_PERSISTENT);
+                                              (void *) NOT_FOUND_ERROR,
+                                              MHD_RESPMEM_PERSISTENT);
   ret = MHD_queue_response (connection,
-                           MHD_HTTP_NOT_FOUND,
-                           response);
+                            MHD_HTTP_NOT_FOUND,
+                            response);
   MHD_add_response_header (response,
-                          MHD_HTTP_HEADER_CONTENT_ENCODING,
-                          mime);
+                           MHD_HTTP_HEADER_CONTENT_ENCODING,
+                           mime);
   MHD_destroy_response (response);
   return ret;
 }
@@ -440,15 +446,13 @@ 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 },
-    { "/S", "text/html", &serve_simple_form, SUBMIT_PAGE },
-    { "/F", "text/html", &serve_simple_form, LAST_PAGE },
-    { NULL, NULL, &not_found_page, NULL } /* 404 */
-  };
-
+static struct Page pages[] = {
+  { "/", "text/html",  &fill_v1_form, MAIN_PAGE },
+  { "/2", "text/html", &fill_v1_v2_form, SECOND_PAGE },
+  { "/S", "text/html", &serve_simple_form, SUBMIT_PAGE },
+  { "/F", "text/html", &serve_simple_form, LAST_PAGE },
+  { NULL, NULL, &not_found_page, NULL }   /* 404 */
+};
 
 
 /**
@@ -470,53 +474,53 @@ static struct Page pages[] =
  * @return MHD_YES to continue iterating,
  *         MHD_NO to abort the iteration
  */
-static int
+static enum MHD_Result
 post_iterator (void *cls,
-              enum MHD_ValueKind kind,
-              const char *key,
-              const char *filename,
-              const char *content_type,
-              const char *transfer_encoding,
-              const char *data, uint64_t off, size_t size)
+               enum MHD_ValueKind kind,
+               const char *key,
+               const char *filename,
+               const char *content_type,
+               const char *transfer_encoding,
+               const char *data, uint64_t off, size_t size)
 {
   struct Request *request = cls;
   struct Session *session = request->session;
-  (void)kind;               /* Unused. Silent compiler warning. */
-  (void)filename;           /* Unused. Silent compiler warning. */
-  (void)content_type;       /* Unused. Silent compiler warning. */
-  (void)transfer_encoding;  /* Unused. Silent compiler warning. */
+  (void) kind;               /* Unused. Silent compiler warning. */
+  (void) filename;           /* Unused. Silent compiler warning. */
+  (void) content_type;       /* Unused. Silent compiler warning. */
+  (void) transfer_encoding;  /* Unused. Silent compiler warning. */
 
   if (0 == strcmp ("DONE", key))
-    {
-      fprintf (stdout,
-              "Session `%s' submitted `%s', `%s'\n",
-              session->sid,
-              session->value_1,
-              session->value_2);
-      return MHD_YES;
-    }
+  {
+    fprintf (stdout,
+             "Session `%s' submitted `%s', `%s'\n",
+             session->sid,
+             session->value_1,
+             session->value_2);
+    return MHD_YES;
+  }
   if (0 == strcmp ("v1", key))
-    {
-      if (size + off > sizeof(session->value_1))
-       size = sizeof (session->value_1) - off;
-      memcpy (&session->value_1[off],
-             data,
-             size);
-      if (size + off < sizeof (session->value_1))
-       session->value_1[size+off] = '\0';
-      return MHD_YES;
-    }
+  {
+    if (size + off > sizeof(session->value_1))
+      size = sizeof (session->value_1) - off;
+    memcpy (&session->value_1[off],
+            data,
+            size);
+    if (size + off < sizeof (session->value_1))
+      session->value_1[size + off] = '\0';
+    return MHD_YES;
+  }
   if (0 == strcmp ("v2", key))
-    {
-      if (size + off > sizeof(session->value_2))
-       size = sizeof (session->value_2) - off;
-      memcpy (&session->value_2[off],
-             data,
-             size);
-      if (size + off < sizeof (session->value_2))
-       session->value_2[size+off] = '\0';
-      return MHD_YES;
-    }
+  {
+    if (size + off > sizeof(session->value_2))
+      size = sizeof (session->value_2) - off;
+    memcpy (&session->value_2[off],
+            data,
+            size);
+    if (size + off < sizeof (session->value_2))
+      session->value_2[size + off] = '\0';
+    return MHD_YES;
+  }
   fprintf (stderr, "Unsupported form value `%s'\n", key);
   return MHD_YES;
 }
@@ -556,101 +560,101 @@ post_iterator (void *cls,
  *         MHS_NO if the socket must be closed due to a serious
  *         error while handling the request
  */
-static int
+static enum MHD_Result
 create_response (void *cls,
-                struct MHD_Connection *connection,
-                const char *url,
-                const char *method,
-                const char *version,
-                const char *upload_data,
-                size_t *upload_data_size,
-                void **ptr)
+                 struct MHD_Connection *connection,
+                 const char *url,
+                 const char *method,
+                 const char *version,
+                 const char *upload_data,
+                 size_t *upload_data_size,
+                 void **ptr)
 {
   struct MHD_Response *response;
   struct Request *request;
   struct Session *session;
-  int ret;
+  enum MHD_Result ret;
   unsigned int i;
-  (void)cls;               /* Unused. Silent compiler warning. */
-  (void)version;           /* Unused. Silent compiler warning. */
+  (void) cls;               /* Unused. Silent compiler warning. */
+  (void) version;           /* Unused. Silent compiler warning. */
 
   request = *ptr;
   if (NULL == request)
+  {
+    request = calloc (1, sizeof (struct Request));
+    if (NULL == request)
     {
-      request = calloc (1, sizeof (struct Request));
-      if (NULL == request)
-       {
-         fprintf (stderr, "calloc error: %s\n", strerror (errno));
-         return MHD_NO;
-       }
-      *ptr = request;
-      if (0 == strcmp (method, MHD_HTTP_METHOD_POST))
-       {
-         request->pp = MHD_create_post_processor (connection, 1024,
-                                                  &post_iterator, request);
-         if (NULL == request->pp)
-           {
-             fprintf (stderr, "Failed to setup post processor for `%s'\n",
-                      url);
-             return MHD_NO; /* internal error */
-           }
-       }
-      return MHD_YES;
+      fprintf (stderr, "calloc error: %s\n", strerror (errno));
+      return MHD_NO;
+    }
+    *ptr = request;
+    if (0 == strcmp (method, MHD_HTTP_METHOD_POST))
+    {
+      request->pp = MHD_create_post_processor (connection, 1024,
+                                               &post_iterator, request);
+      if (NULL == request->pp)
+      {
+        fprintf (stderr, "Failed to setup post processor for `%s'\n",
+                 url);
+        return MHD_NO; /* internal error */
+      }
     }
+    return MHD_YES;
+  }
   if (NULL == request->session)
+  {
+    request->session = get_session (connection);
+    if (NULL == request->session)
     {
-      request->session = get_session (connection);
-      if (NULL == request->session)
-       {
-         fprintf (stderr, "Failed to setup session for `%s'\n",
-                  url);
-         return MHD_NO; /* internal error */
-       }
+      fprintf (stderr, "Failed to setup session for `%s'\n",
+               url);
+      return MHD_NO; /* internal error */
     }
+  }
   session = request->session;
   session->start = time (NULL);
   if (0 == strcmp (method, MHD_HTTP_METHOD_POST))
+  {
+    /* evaluate POST data */
+    MHD_post_process (request->pp,
+                      upload_data,
+                      *upload_data_size);
+    if (0 != *upload_data_size)
     {
-      /* evaluate POST data */
-      MHD_post_process (request->pp,
-                       upload_data,
-                       *upload_data_size);
-      if (0 != *upload_data_size)
-       {
-         *upload_data_size = 0;
-         return MHD_YES;
-       }
-      /* done with POST data, serve response */
-      MHD_destroy_post_processor (request->pp);
-      request->pp = NULL;
-      method = MHD_HTTP_METHOD_GET; /* fake 'GET' */
-      if (NULL != request->post_url)
-       url = request->post_url;
+      *upload_data_size = 0;
+      return MHD_YES;
     }
+    /* done with POST data, serve response */
+    MHD_destroy_post_processor (request->pp);
+    request->pp = NULL;
+    method = MHD_HTTP_METHOD_GET;   /* fake 'GET' */
+    if (NULL != request->post_url)
+      url = request->post_url;
+  }
 
   if ( (0 == strcmp (method, MHD_HTTP_METHOD_GET)) ||
        (0 == strcmp (method, MHD_HTTP_METHOD_HEAD)) )
-    {
-      /* find out which page to serve */
-      i=0;
-      while ( (pages[i].url != NULL) &&
-             (0 != strcmp (pages[i].url, url)) )
-       i++;
-      ret = pages[i].handler (pages[i].handler_cls,
-                             pages[i].mime,
-                             session, connection);
-      if (ret != MHD_YES)
-       fprintf (stderr, "Failed to create page for `%s'\n",
-                url);
-      return ret;
-    }
+  {
+    /* find out which page to serve */
+    i = 0;
+    while ( (pages[i].url != NULL) &&
+            (0 != strcmp (pages[i].url, url)) )
+      i++;
+    ret = pages[i].handler (pages[i].handler_cls,
+                            pages[i].mime,
+                            session, connection);
+    if (ret != MHD_YES)
+      fprintf (stderr, "Failed to create page for `%s'\n",
+               url);
+    return ret;
+  }
   /* unsupported HTTP method */
   response = MHD_create_response_from_buffer (strlen (METHOD_ERROR),
-                                             (void *) METHOD_ERROR,
-                                             MHD_RESPMEM_PERSISTENT);
+                                              (void *) METHOD_ERROR,
+                                              MHD_RESPMEM_PERSISTENT);
   ret = MHD_queue_response (connection,
-                           MHD_HTTP_NOT_ACCEPTABLE,
-                           response);
+                            MHD_HTTP_NOT_ACCEPTABLE,
+                            response);
   MHD_destroy_response (response);
   return ret;
 }
@@ -667,14 +671,14 @@ create_response (void *cls,
  */
 static void
 request_completed_callback (void *cls,
-                           struct MHD_Connection *connection,
-                           void **con_cls,
-                           enum MHD_RequestTerminationCode toe)
+                            struct MHD_Connection *connection,
+                            void **con_cls,
+                            enum MHD_RequestTerminationCode toe)
 {
   struct Request *request = *con_cls;
-  (void)cls;         /* Unused. Silent compiler warning. */
-  (void)connection;  /* Unused. Silent compiler warning. */
-  (void)toe;         /* Unused. Silent compiler warning. */
+  (void) cls;         /* Unused. Silent compiler warning. */
+  (void) connection;  /* Unused. Silent compiler warning. */
+  (void) toe;         /* Unused. Silent compiler warning. */
 
   if (NULL == request)
     return;
@@ -702,21 +706,21 @@ expire_sessions ()
   prev = NULL;
   pos = sessions;
   while (NULL != pos)
+  {
+    next = pos->next;
+    if (now - pos->start > 60 * 60)
     {
-      next = pos->next;
-      if (now - pos->start > 60 * 60)
-       {
-         /* expire sessions after 1h */
-         if (NULL == prev)
-           sessions = pos->next;
-         else
-           prev->next = next;
-         free (pos);
-       }
+      /* expire sessions after 1h */
+      if (NULL == prev)
+        sessions = pos->next;
       else
-        prev = pos;
-      pos = next;
+        prev->next = next;
+      free (pos);
     }
+    else
+      prev = pos;
+    pos = next;
+  }
 }
 
 
@@ -737,48 +741,49 @@ main (int argc, char *const *argv)
   MHD_UNSIGNED_LONG_LONG mhd_timeout;
 
   if (argc != 2)
-    {
-      printf ("%s PORT\n", argv[0]);
-      return 1;
-    }
+  {
+    printf ("%s PORT\n", argv[0]);
+    return 1;
+  }
   /* initialize PRNG */
   srand ((unsigned int) time (NULL));
   d = MHD_start_daemon (MHD_USE_ERROR_LOG,
                         atoi (argv[1]),
                         NULL, NULL,
-                       &create_response, NULL,
-                       MHD_OPTION_CONNECTION_TIMEOUT, (unsigned int) 15,
-                       MHD_OPTION_NOTIFY_COMPLETED, 
&request_completed_callback, NULL,
-                       MHD_OPTION_END);
+                        &create_response, NULL,
+                        MHD_OPTION_CONNECTION_TIMEOUT, (unsigned int) 15,
+                        MHD_OPTION_NOTIFY_COMPLETED,
+                        &request_completed_callback, NULL,
+                        MHD_OPTION_END);
   if (NULL == d)
     return 1;
   while (1)
+  {
+    expire_sessions ();
+    max = 0;
+    FD_ZERO (&rs);
+    FD_ZERO (&ws);
+    FD_ZERO (&es);
+    if (MHD_YES != MHD_get_fdset (d, &rs, &ws, &es, &max))
+      break; /* fatal internal error */
+    if (MHD_get_timeout (d, &mhd_timeout) == MHD_YES)
     {
-      expire_sessions ();
-      max = 0;
-      FD_ZERO (&rs);
-      FD_ZERO (&ws);
-      FD_ZERO (&es);
-      if (MHD_YES != MHD_get_fdset (d, &rs, &ws, &es, &max))
-       break; /* fatal internal error */
-      if (MHD_get_timeout (d, &mhd_timeout) == MHD_YES)
-       {
-         tv.tv_sec = mhd_timeout / 1000;
-         tv.tv_usec = (mhd_timeout - (tv.tv_sec * 1000)) * 1000;
-         tvp = &tv;
-       }
-      else
-       tvp = NULL;
-      if (-1 == select (max + 1, &rs, &ws, &es, tvp))
-       {
-         if (EINTR != errno)
-           fprintf (stderr,
-                    "Aborting due to error during select: %s\n",
-                    strerror (errno));
-         break;
-       }
-      MHD_run (d);
+      tv.tv_sec = mhd_timeout / 1000;
+      tv.tv_usec = (mhd_timeout - (tv.tv_sec * 1000)) * 1000;
+      tvp = &tv;
     }
+    else
+      tvp = NULL;
+    if (-1 == select (max + 1, &rs, &ws, &es, tvp))
+    {
+      if (EINTR != errno)
+        fprintf (stderr,
+                 "Aborting due to error during select: %s\n",
+                 strerror (errno));
+      break;
+    }
+    MHD_run (d);
+  }
   MHD_stop_daemon (d);
   return 0;
 }
diff --git a/doc/examples/simplepost.c b/doc/examples/simplepost.c
index a3bba94a..1e52e5dd 100644
--- a/doc/examples/simplepost.c
+++ b/doc/examples/simplepost.c
@@ -13,7 +13,7 @@
 #include <string.h>
 #include <stdlib.h>
 
-#if defined(_MSC_VER) && _MSC_VER+0 <= 1800
+#if defined(_MSC_VER) && _MSC_VER + 0 <= 1800
 /* Substitution is OK while return value is not used */
 #define snprintf _snprintf
 #endif
@@ -33,7 +33,8 @@ struct connection_info_struct
   struct MHD_PostProcessor *postprocessor;
 };
 
-const char *askpage = "<html><body>\
+const char *askpage =
+  "<html><body>\
                        What's your name, Sir?<br>\
                        <form action=\"/namepost\" method=\"post\">\
                        <input name=\"name\" type=\"text\">\
@@ -47,17 +48,17 @@ const char *errorpage =
   "<html><body>This doesn't seem to be right.</body></html>";
 
 
-static int
+static enum MHD_Result
 send_page (struct MHD_Connection *connection, const char *page)
 {
-  int ret;
+  enum MHD_Result ret;
   struct MHD_Response *response;
 
 
   response =
     MHD_create_response_from_buffer (strlen (page), (void *) page,
-                                    MHD_RESPMEM_PERSISTENT);
-  if (!response)
+                                     MHD_RESPMEM_PERSISTENT);
+  if (! response)
     return MHD_NO;
 
   ret = MHD_queue_response (connection, MHD_HTTP_OK, response);
@@ -67,135 +68,138 @@ send_page (struct MHD_Connection *connection, const char 
*page)
 }
 
 
-static int
+static enum MHD_Result
 iterate_post (void *coninfo_cls, enum MHD_ValueKind kind, const char *key,
               const char *filename, const char *content_type,
               const char *transfer_encoding, const char *data, uint64_t off,
               size_t size)
 {
   struct connection_info_struct *con_info = coninfo_cls;
-  (void)kind;               /* Unused. Silent compiler warning. */
-  (void)filename;           /* Unused. Silent compiler warning. */
-  (void)content_type;       /* Unused. Silent compiler warning. */
-  (void)transfer_encoding;  /* Unused. Silent compiler warning. */
-  (void)off;                /* Unused. Silent compiler warning. */
+  (void) kind;               /* Unused. Silent compiler warning. */
+  (void) filename;           /* Unused. Silent compiler warning. */
+  (void) content_type;       /* Unused. Silent compiler warning. */
+  (void) transfer_encoding;  /* Unused. Silent compiler warning. */
+  (void) off;                /* Unused. Silent compiler warning. */
 
   if (0 == strcmp (key, "name"))
+  {
+    if ((size > 0) && (size <= MAXNAMESIZE))
     {
-      if ((size > 0) && (size <= MAXNAMESIZE))
-        {
-          char *answerstring;
-          answerstring = malloc (MAXANSWERSIZE);
-          if (!answerstring)
-            return MHD_NO;
-
-          snprintf (answerstring, MAXANSWERSIZE, greetingpage, data);
-          con_info->answerstring = answerstring;
-        }
-      else
-        con_info->answerstring = NULL;
+      char *answerstring;
+      answerstring = malloc (MAXANSWERSIZE);
+      if (! answerstring)
+        return MHD_NO;
 
-      return MHD_NO;
+      snprintf (answerstring, MAXANSWERSIZE, greetingpage, data);
+      con_info->answerstring = answerstring;
     }
+    else
+      con_info->answerstring = NULL;
+
+    return MHD_NO;
+  }
 
   return MHD_YES;
 }
 
+
 static void
 request_completed (void *cls, struct MHD_Connection *connection,
                    void **con_cls, enum MHD_RequestTerminationCode toe)
 {
   struct connection_info_struct *con_info = *con_cls;
-  (void)cls;         /* Unused. Silent compiler warning. */
-  (void)connection;  /* Unused. Silent compiler warning. */
-  (void)toe;         /* Unused. Silent compiler warning. */
+  (void) cls;         /* Unused. Silent compiler warning. */
+  (void) connection;  /* Unused. Silent compiler warning. */
+  (void) toe;         /* Unused. Silent compiler warning. */
 
   if (NULL == con_info)
     return;
 
   if (con_info->connectiontype == POST)
-    {
-      MHD_destroy_post_processor (con_info->postprocessor);
-      if (con_info->answerstring)
-        free (con_info->answerstring);
-    }
+  {
+    MHD_destroy_post_processor (con_info->postprocessor);
+    if (con_info->answerstring)
+      free (con_info->answerstring);
+  }
 
   free (con_info);
   *con_cls = NULL;
 }
 
 
-static int
+static enum MHD_Result
 answer_to_connection (void *cls, struct MHD_Connection *connection,
                       const char *url, const char *method,
                       const char *version, const char *upload_data,
                       size_t *upload_data_size, void **con_cls)
 {
-  (void)cls;               /* Unused. Silent compiler warning. */
-  (void)url;               /* Unused. Silent compiler warning. */
-  (void)version;           /* Unused. Silent compiler warning. */
+  (void) cls;               /* Unused. Silent compiler warning. */
+  (void) url;               /* Unused. Silent compiler warning. */
+  (void) version;           /* Unused. Silent compiler warning. */
 
   if (NULL == *con_cls)
-    {
-      struct connection_info_struct *con_info;
+  {
+    struct connection_info_struct *con_info;
 
-      con_info = malloc (sizeof (struct connection_info_struct));
-      if (NULL == con_info)
-        return MHD_NO;
-      con_info->answerstring = NULL;
+    con_info = malloc (sizeof (struct connection_info_struct));
+    if (NULL == con_info)
+      return MHD_NO;
+    con_info->answerstring = NULL;
 
-      if (0 == strcmp (method, "POST"))
-        {
-          con_info->postprocessor =
-            MHD_create_post_processor (connection, POSTBUFFERSIZE,
-                                       iterate_post, (void *) con_info);
+    if (0 == strcmp (method, "POST"))
+    {
+      con_info->postprocessor =
+        MHD_create_post_processor (connection, POSTBUFFERSIZE,
+                                   iterate_post, (void *) con_info);
 
-          if (NULL == con_info->postprocessor)
-            {
-              free (con_info);
-              return MHD_NO;
-            }
+      if (NULL == con_info->postprocessor)
+      {
+        free (con_info);
+        return MHD_NO;
+      }
 
-          con_info->connectiontype = POST;
-        }
-      else
-        con_info->connectiontype = GET;
+      con_info->connectiontype = POST;
+    }
+    else
+      con_info->connectiontype = GET;
 
-      *con_cls = (void *) con_info;
+    *con_cls = (void *) con_info;
 
-      return MHD_YES;
-    }
+    return MHD_YES;
+  }
 
   if (0 == strcmp (method, "GET"))
-    {
-      return send_page (connection, askpage);
-    }
+  {
+    return send_page (connection, askpage);
+  }
 
   if (0 == strcmp (method, "POST"))
+  {
+    struct connection_info_struct *con_info = *con_cls;
+
+    if (*upload_data_size != 0)
     {
-      struct connection_info_struct *con_info = *con_cls;
-
-      if (*upload_data_size != 0)
-        {
-          MHD_post_process (con_info->postprocessor, upload_data,
-                            *upload_data_size);
-          *upload_data_size = 0;
-
-          return MHD_YES;
-        }
-      else if (NULL != con_info->answerstring)
-        return send_page (connection, con_info->answerstring);
+      MHD_post_process (con_info->postprocessor, upload_data,
+                        *upload_data_size);
+      *upload_data_size = 0;
+
+      return MHD_YES;
     }
+    else if (NULL != con_info->answerstring)
+      return send_page (connection, con_info->answerstring);
+  }
 
   return send_page (connection, errorpage);
 }
 
+
 int
 main ()
 {
   struct MHD_Daemon *daemon;
 
-  daemon = MHD_start_daemon (MHD_USE_AUTO | MHD_USE_INTERNAL_POLLING_THREAD, 
PORT, NULL, NULL,
+  daemon = MHD_start_daemon (MHD_USE_AUTO | MHD_USE_INTERNAL_POLLING_THREAD,
+                             PORT, NULL, NULL,
                              &answer_to_connection, NULL,
                              MHD_OPTION_NOTIFY_COMPLETED, request_completed,
                              NULL, MHD_OPTION_END);
diff --git a/doc/examples/tlsauthentication.c b/doc/examples/tlsauthentication.c
index 43b41bf1..ca8187bc 100644
--- a/doc/examples/tlsauthentication.c
+++ b/doc/examples/tlsauthentication.c
@@ -38,20 +38,20 @@ string_to_base64 (const char *message)
     return NULL;
   tmp[0] = 0;
   for (i = 0; i < length; i += 3)
-    {
-      l = (((unsigned long) message[i]) << 16)
+  {
+    l = (((unsigned long) message[i]) << 16)
         | (((i + 1) < length) ? (((unsigned long) message[i + 1]) << 8) : 0)
         | (((i + 2) < length) ? ((unsigned long) message[i + 2]) : 0);
 
 
-      strncat (tmp, &lookup[(l >> 18) & 0x3F], 1);
-      strncat (tmp, &lookup[(l >> 12) & 0x3F], 1);
+    strncat (tmp, &lookup[(l >> 18) & 0x3F], 1);
+    strncat (tmp, &lookup[(l >> 12) & 0x3F], 1);
 
-      if (i + 1 < length)
-        strncat (tmp, &lookup[(l >> 6) & 0x3F], 1);
-      if (i + 2 < length)
-        strncat (tmp, &lookup[l & 0x3F], 1);
-    }
+    if (i + 1 < length)
+      strncat (tmp, &lookup[(l >> 6) & 0x3F], 1);
+    if (i + 2 < length)
+      strncat (tmp, &lookup[l & 0x3F], 1);
+  }
 
   if (length % 3)
     strncat (tmp, "===", 3 - length % 3);
@@ -67,16 +67,16 @@ get_file_size (const char *filename)
 
   fp = fopen (filename, "rb");
   if (fp)
-    {
-      long size;
+  {
+    long size;
 
-      if ((0 != fseek (fp, 0, SEEK_END)) || (-1 == (size = ftell (fp))))
-        size = 0;
+    if ((0 != fseek (fp, 0, SEEK_END)) || (-1 == (size = ftell (fp))))
+      size = 0;
 
-      fclose (fp);
+    fclose (fp);
 
-      return size;
-    }
+    return size;
+  }
   else
     return 0;
 }
@@ -99,58 +99,58 @@ load_file (const char *filename)
 
   buffer = malloc (size + 1);
   if (! buffer)
-    {
-      fclose (fp);
-      return NULL;
-    }
+  {
+    fclose (fp);
+    return NULL;
+  }
   buffer[size] = '\0';
 
-  if (size != (long)fread (buffer, 1, size, fp))
-    {
-      free (buffer);
-      buffer = NULL;
-    }
+  if (size != (long) fread (buffer, 1, size, fp))
+  {
+    free (buffer);
+    buffer = NULL;
+  }
 
   fclose (fp);
   return buffer;
 }
 
 
-static int
+static enum MHD_Result
 ask_for_authentication (struct MHD_Connection *connection, const char *realm)
 {
-  int ret;
+  enum MHD_Result ret;
   struct MHD_Response *response;
   char *headervalue;
   size_t slen;
   const char *strbase = "Basic realm=";
 
   response = MHD_create_response_from_buffer (0, NULL,
-                                             MHD_RESPMEM_PERSISTENT);
-  if (!response)
+                                              MHD_RESPMEM_PERSISTENT);
+  if (! response)
     return MHD_NO;
 
   slen = strlen (strbase) + strlen (realm) + 1;
   if (NULL == (headervalue = malloc (slen)))
     return MHD_NO;
   snprintf (headervalue,
-           slen,
-           "%s%s",
-           strbase,
-           realm);
+            slen,
+            "%s%s",
+            strbase,
+            realm);
   ret = MHD_add_response_header (response,
-                                "WWW-Authenticate",
-                                headervalue);
+                                 "WWW-Authenticate",
+                                 headervalue);
   free (headervalue);
   if (! ret)
-    {
-      MHD_destroy_response (response);
-      return MHD_NO;
-    }
+  {
+    MHD_destroy_response (response);
+    return MHD_NO;
+  }
 
   ret = MHD_queue_response (connection,
-                           MHD_HTTP_UNAUTHORIZED,
-                           response);
+                            MHD_HTTP_UNAUTHORIZED,
+                            response);
   MHD_destroy_response (response);
   return ret;
 }
@@ -159,7 +159,7 @@ ask_for_authentication (struct MHD_Connection *connection, 
const char *realm)
 static int
 is_authenticated (struct MHD_Connection *connection,
                   const char *username,
-                 const char *password)
+                  const char *password)
 {
   const char *headervalue;
   char *expected_b64;
@@ -180,10 +180,10 @@ is_authenticated (struct MHD_Connection *connection,
   if (NULL == (expected = malloc (slen)))
     return 0;
   snprintf (expected,
-           slen,
-           "%s:%s",
-           username,
-           password);
+            slen,
+            "%s:%s",
+            username,
+            password);
   expected_b64 = string_to_base64 (expected);
   free (expected);
   if (NULL == expected_b64)
@@ -196,17 +196,17 @@ is_authenticated (struct MHD_Connection *connection,
 }
 
 
-static int
+static enum MHD_Result
 secret_page (struct MHD_Connection *connection)
 {
-  int ret;
+  enum MHD_Result ret;
   struct MHD_Response *response;
   const char *page = "<html><body>A secret.</body></html>";
 
   response =
     MHD_create_response_from_buffer (strlen (page), (void *) page,
-                                    MHD_RESPMEM_PERSISTENT);
-  if (!response)
+                                     MHD_RESPMEM_PERSISTENT);
+  if (! response)
     return MHD_NO;
 
   ret = MHD_queue_response (connection, MHD_HTTP_OK, response);
@@ -216,27 +216,27 @@ secret_page (struct MHD_Connection *connection)
 }
 
 
-static int
+static enum MHD_Result
 answer_to_connection (void *cls, struct MHD_Connection *connection,
                       const char *url, const char *method,
                       const char *version, const char *upload_data,
                       size_t *upload_data_size, void **con_cls)
 {
-  (void)cls;               /* Unused. Silent compiler warning. */
-  (void)url;               /* Unused. Silent compiler warning. */
-  (void)version;           /* Unused. Silent compiler warning. */
-  (void)upload_data;       /* Unused. Silent compiler warning. */
-  (void)upload_data_size;  /* Unused. Silent compiler warning. */
+  (void) cls;               /* Unused. Silent compiler warning. */
+  (void) url;               /* Unused. Silent compiler warning. */
+  (void) version;           /* Unused. Silent compiler warning. */
+  (void) upload_data;       /* Unused. Silent compiler warning. */
+  (void) upload_data_size;  /* Unused. Silent compiler warning. */
 
   if (0 != strcmp (method, "GET"))
     return MHD_NO;
   if (NULL == *con_cls)
-    {
-      *con_cls = connection;
-      return MHD_YES;
-    }
+  {
+    *con_cls = connection;
+    return MHD_YES;
+  }
 
-  if (!is_authenticated (connection, USER, PASSWORD))
+  if (! is_authenticated (connection, USER, PASSWORD))
     return ask_for_authentication (connection, REALM);
 
   return secret_page (connection);
@@ -254,14 +254,14 @@ main ()
   cert_pem = load_file (SERVERCERTFILE);
 
   if ((key_pem == NULL) || (cert_pem == NULL))
-    {
-      printf ("The key/certificate files could not be read.\n");
-      if (NULL != key_pem)
-        free (key_pem);
-      if (NULL != cert_pem)
-        free (cert_pem);
-      return 1;
-    }
+  {
+    printf ("The key/certificate files could not be read.\n");
+    if (NULL != key_pem)
+      free (key_pem);
+    if (NULL != cert_pem)
+      free (cert_pem);
+    return 1;
+  }
 
   daemon =
     MHD_start_daemon (MHD_USE_INTERNAL_POLLING_THREAD | MHD_USE_TLS, PORT, 
NULL,
@@ -269,14 +269,14 @@ main ()
                       MHD_OPTION_HTTPS_MEM_KEY, key_pem,
                       MHD_OPTION_HTTPS_MEM_CERT, cert_pem, MHD_OPTION_END);
   if (NULL == daemon)
-    {
-      printf ("%s\n", cert_pem);
+  {
+    printf ("%s\n", cert_pem);
 
-      free (key_pem);
-      free (cert_pem);
+    free (key_pem);
+    free (cert_pem);
 
-      return 1;
-    }
+    return 1;
+  }
 
   (void) getchar ();
 
diff --git a/doc/libmicrohttpd.texi b/doc/libmicrohttpd.texi
index 09ae691b..419cf44a 100644
--- a/doc/libmicrohttpd.texi
+++ b/doc/libmicrohttpd.texi
@@ -1284,7 +1284,7 @@ Information about an MHD daemon.
 @chapter Callback functions definition
 
 
-@deftypefn {Function Pointer} int {*MHD_AcceptPolicyCallback} (void *cls, 
const struct sockaddr * addr, socklen_t addrlen)
+@deftypefn {Function Pointer} enum MHD_Result {*MHD_AcceptPolicyCallback} 
(void *cls, const struct sockaddr * addr, socklen_t addrlen)
 Invoked in the context of a connection to allow or deny a client to
 connect.  This callback return @code{MHD_YES} if connection is allowed,
 @code{MHD_NO} if not.
@@ -1300,7 +1300,7 @@ length of the address information.
 @end deftypefn
 
 
-@deftypefn {Function Pointer} int {*MHD_AccessHandlerCallback} (void *cls, 
struct MHD_Connection * connection, const char *url, const char *method, const 
char *version, const char *upload_data, size_t *upload_data_size, void 
**con_cls)
+@deftypefn {Function Pointer} enum MHD_Result {*MHD_AccessHandlerCallback} 
(void *cls, struct MHD_Connection * connection, const char *url, const char 
*method, const char *version, const char *upload_data, size_t 
*upload_data_size, void **con_cls)
 Invoked in the context of a connection to answer a request from the
 client.  This callback must call MHD functions (example: the
 @code{MHD_Response} ones) to provide content to give back to the client
@@ -1403,7 +1403,7 @@ reason for request termination see 
@code{MHD_OPTION_NOTIFY_COMPLETED}.
 @end deftypefn
 
 
-@deftypefn {Function Pointer} int {*MHD_KeyValueIterator} (void *cls, enum 
MHD_ValueKind kind, const char *key, const char *value, size_t value_size)
+@deftypefn {Function Pointer} enum MHD_Result {*MHD_KeyValueIterator} (void 
*cls, enum MHD_ValueKind kind, const char *key, const char *value, size_t 
value_size)
 Iterator over key-value pairs.  This iterator can be used to iterate
 over all of the cookies, headers, or @code{POST}-data fields of a
 request, and also to iterate over the headers that have been added to a
@@ -1440,7 +1440,7 @@ iteration.
 @end deftypefn
 
 
-@deftypefn {Function Pointer} int {*MHD_ContentReaderCallback} (void *cls, 
uint64_t pos, char *buf, size_t max)
+@deftypefn {Function Pointer} ssize_t {*MHD_ContentReaderCallback} (void *cls, 
uint64_t pos, char *buf, size_t max)
 Callback used by MHD in order to obtain content.  The callback has to
 copy at most @var{max} bytes of content into @var{buf}.  The total
 number of bytes that has been placed into @var{buf} should be returned.
@@ -1496,7 +1496,7 @@ It should be used to free resources associated with the 
content reader.
 @end deftypefn
 
 
-@deftypefn {Function Pointer} int {*MHD_PostDataIterator} (void *cls, enum 
MHD_ValueKind kind, const char *key, const char *filename, const char 
*content_type, const char *transfer_encoding, const char *data, uint64_t off, 
size_t size)
+@deftypefn {Function Pointer} enum MHD_Result {*MHD_PostDataIterator} (void 
*cls, enum MHD_ValueKind kind, const char *key, const char *filename, const 
char *content_type, const char *transfer_encoding, const char *data, uint64_t 
off, size_t size)
 Iterator over key-value pairs where the value maybe made available in
 increments and/or may not be zero-terminated.  Used for processing
 @code{POST} data.
@@ -1587,7 +1587,7 @@ Return @code{NULL} on error, handle to daemon on success.
 @end deftypefun
 
 
-@deftypefun int MHD_quiesce_daemon (struct MHD_Daemon *daemon)
+@deftypefun MHD_socket MHD_quiesce_daemon (struct MHD_Daemon *daemon)
 @cindex quiesce
 Stop accepting connections from the listening socket.  Allows clients
 to continue processing, but stops accepting new connections.  Note
@@ -1613,7 +1613,7 @@ Shutdown an HTTP daemon.
 @end deftypefun
 
 
-@deftypefun int MHD_run (struct MHD_Daemon *daemon)
+@deftypefun enum MHD_Result MHD_run (struct MHD_Daemon *daemon)
 Run webserver operations (without blocking unless in client callbacks).
 This method should be called by clients in combination with
 @code{MHD_get_fdset()} if the client-controlled @code{select}-method is used.
@@ -1634,7 +1634,7 @@ started with the right options for this call.
 @end deftypefun
 
 
-@deftypefun int MHD_run_from_select (struct MHD_Daemon *daemon, const fd_set 
*read_fd_set, const fd_set *write_fd_set, const fd_set *except_fd_set)
+@deftypefun enum MHD_Result MHD_run_from_select (struct MHD_Daemon *daemon, 
const fd_set *read_fd_set, const fd_set *write_fd_set, const fd_set 
*except_fd_set)
 Run webserver operations given sets of ready socket handles.
 @cindex select
 
@@ -1710,7 +1710,7 @@ to indicate further details about the error.
 @chapter Implementing external @code{select}
 
 
-@deftypefun int MHD_get_fdset (struct MHD_Daemon *daemon, fd_set * 
read_fd_set, fd_set * write_fd_set, fd_set * except_fd_set, int *max_fd)
+@deftypefun enum MHD_Result MHD_get_fdset (struct MHD_Daemon *daemon, fd_set * 
read_fd_set, fd_set * write_fd_set, fd_set * except_fd_set, int *max_fd)
 Obtain the @code{select()} sets for this daemon. The daemon's socket
 is added to @var{read_fd_set}. The list of currently existent
 connections is scanned and their file descriptors added to the correct
@@ -1736,12 +1736,12 @@ the right options for this call.
 @end deftypefun
 
 
-@deftypefun int MHD_get_fdset2 (struct MHD_Daemon *daemon, fd_set * 
read_fd_set, fd_set * write_fd_set, fd_set * except_fd_set, int *max_fd, 
unsigned int fd_setsize)
+@deftypefun enum MHD_Result MHD_get_fdset2 (struct MHD_Daemon *daemon, fd_set 
* read_fd_set, fd_set * write_fd_set, fd_set * except_fd_set, int *max_fd, 
unsigned int fd_setsize)
 Like @code{MHD_get_fdset()}, except that you can manually specify the value of 
FD_SETSIZE used by your application.
 @end deftypefun
 
 
-@deftypefun int MHD_get_timeout (struct MHD_Daemon *daemon, unsigned long long 
*timeout)
+@deftypefun enum MHD_Result MHD_get_timeout (struct MHD_Daemon *daemon, 
unsigned long long *timeout)
 @cindex timeout
 Obtain timeout value for select for this daemon (only needed if
 connection timeout is used).  The returned value is how many
@@ -1802,7 +1802,7 @@ would contain the string ``key''.
 @end deftypefun
 
 
-@deftypefun int MHD_set_connection_value (struct MHD_Connection *connection, 
enum MHD_ValueKind kind, const char *key, const char *value)
+@deftypefun enum MHD_Result MHD_set_connection_value (struct MHD_Connection 
*connection, enum MHD_ValueKind kind, const char *key, const char *value)
 This function can be used to append an entry to
 the list of HTTP headers of a connection (so that the
 @code{MHD_get_connection_values function} will return
@@ -1884,7 +1884,7 @@ response and we finally destroy it only when the daemon 
shuts down.
 @section Enqueuing a response
 
 
-@deftypefun int MHD_queue_response (struct MHD_Connection *connection, 
unsigned int status_code, struct MHD_Response *response)
+@deftypefun enum MHD_Result MHD_queue_response (struct MHD_Connection 
*connection, unsigned int status_code, struct MHD_Response *response)
 Queue a response to be transmitted to the client as soon as possible
 but only after MHD_AccessHandlerCallback returns.  This function
 checks that it is legal to queue a response at this time for the
@@ -2148,7 +2148,7 @@ MHD_destroy_response(response);
 @section Adding headers to a response
 
 
-@deftypefun int MHD_add_response_header (struct MHD_Response *response, const 
char *header, const char *content)
+@deftypefun enum MHD_Result MHD_add_response_header (struct MHD_Response 
*response, const char *header, const char *content)
 Add a header line to the response. The strings referenced by
 @var{header} and @var{content} must be zero-terminated and they are
 duplicated into memory blocks embedded in @var{response}.
@@ -2172,7 +2172,7 @@ memory allocation error).
 @end deftypefun
 
 
-@deftypefun int MHD_add_response_footer (struct MHD_Response *response, const 
char *footer, const char *content)
+@deftypefun enum MHD_Result MHD_add_response_footer (struct MHD_Response 
*response, const char *footer, const char *content)
 Add a footer line to the response. The strings referenced by
 @var{footer} and @var{content} must be zero-terminated and they are
 duplicated into memory blocks embedded in @var{response}.
@@ -2190,7 +2190,7 @@ memory allocation error).
 
 
 
-@deftypefun int MHD_del_response_header (struct MHD_Response *response, const 
char *header, const char *content)
+@deftypefun enum MHD_Result MHD_del_response_header (struct MHD_Response 
*response, const char *header, const char *content)
 Delete a header (or footer) line from the response.  Return @code{MHD_NO} on 
error
 (arguments are invalid or no such header known).
 @end deftypefun
@@ -2201,7 +2201,7 @@ Delete a header (or footer) line from the response.  
Return @code{MHD_NO} on err
 @section Setting response options
 
 
-@deftypefun int MHD_set_response_options (struct MHD_Response *response, enum 
MHD_ResponseFlags flags, ...)
+@deftypefun enum MHD_Result MHD_set_response_options (struct MHD_Response 
*response, enum MHD_ResponseFlags flags, ...)
 Set special flags and options for a response.
 
 Calling this functions sets the given flags and options for the response.
@@ -2281,7 +2281,7 @@ a connection by queueing a response (using the
 have been created with the following function:
 
 
-@deftypefun int MHD_create_response_for_upgrade (MHD_UpgradeHandler 
upgrade_handler, void *upgrade_handler_cls)
+@deftypefun enum MHD_Result MHD_create_response_for_upgrade 
(MHD_UpgradeHandler upgrade_handler, void *upgrade_handler_cls)
 Create a response suitable for switching protocols.  Returns @code{MHD_YES} on 
success.  @code{upgrade_handler} must not be @code{NULL}.
 
 When creating this type of response, the ``Connection: Upgrade''
@@ -2322,7 +2322,7 @@ argument for calls to @code{MHD_upgrade_action}.  
Applications must eventually u
 
 @end deftypefn
 
-@deftypefun int MHD_upgrade_action (struct MHD_UpgradeResponseHandle *urh, 
enum MHD_UpgradeAction action, ...)
+@deftypefun enum MHD_Result MHD_upgrade_action (struct 
MHD_UpgradeResponseHandle *urh, enum MHD_UpgradeAction action, ...)
 Perform special operations related to upgraded connections.
 
 @table @var
@@ -2374,7 +2374,7 @@ Instead, applications using thread modes other than
 @code{MHD_USE_THREAD_PER_CONNECTION} should use the
 following functions to perform flow control.
 
-@deftypefun int MHD_suspend_connection (struct MHD_Connection *connection)
+@deftypefun enum MHD_Result MHD_suspend_connection (struct MHD_Connection 
*connection)
 Suspend handling of network data for a given connection.  This can
 be used to dequeue a connection from MHD's event loop (external
 select, internal select or thread pool; not applicable to
@@ -2408,7 +2408,7 @@ the connection to suspend
 @end table
 @end deftypefun
 
-@deftypefun int MHD_resume_connection (struct MHD_Connection *connection)
+@deftypefun enum MHD_Result MHD_resume_connection (struct MHD_Connection 
*connection)
 Resume handling of network data for suspended connection.  It is safe
 to resume a suspended connection at any time.  Calling this function
 on a connection that was not previously suspended will result in
@@ -2602,7 +2602,7 @@ Most of the time it is sound to specify 300 seconds as 
its values.
 @end deftypefun
 
 
-@deftypefun int MHD_queue_auth_fail_response2 (struct MHD_Connection 
*connection, const char *realm, const char *opaque, struct MHD_Response 
*response, int signal_stale, enum MHD_DigestAuthAlgorithm algo)
+@deftypefun enum MHD_Result MHD_queue_auth_fail_response2 (struct 
MHD_Connection *connection, const char *realm, const char *opaque, struct 
MHD_Response *response, int signal_stale, enum MHD_DigestAuthAlgorithm algo)
 Queues a response to request authentication from the client,
 return @code{MHD_YES} if successful, otherwise @code{MHD_NO}.
 
@@ -2626,7 +2626,7 @@ must then be selected when checking digests received from 
clients!
 @end deftypefun
 
 
-@deftypefun int MHD_queue_auth_fail_response (struct MHD_Connection 
*connection, const char *realm, const char *opaque, struct MHD_Response 
*response, int signal_stale)
+@deftypefun enum MHD_Result MHD_queue_auth_fail_response (struct 
MHD_Connection *connection, const char *realm, const char *opaque, struct 
MHD_Response *response, int signal_stale)
 Queues a response to request authentication from the client,
 return @code{MHD_YES} if successful, otherwise @code{MHD_NO}.
 
@@ -2847,7 +2847,7 @@ a PP handle.
 @end deftypefun
 
 
-@deftypefun int MHD_post_process (struct MHD_PostProcessor *pp, const char 
*post_data, size_t post_data_len)
+@deftypefun enum MHD_Result MHD_post_process (struct MHD_PostProcessor *pp, 
const char *post_data, size_t post_data_len)
 Parse and process @code{POST} data.  Call this function when @code{POST}
 data is available (usually during an @code{MHD_AccessHandlerCallback})
 with the @var{upload_data} and @var{upload_data_size}.  Whenever
@@ -2870,7 +2870,7 @@ Return @code{MHD_YES} on success, @code{MHD_NO} on error
 @end deftypefun
 
 
-@deftypefun int MHD_destroy_post_processor (struct MHD_PostProcessor *pp)
+@deftypefun enum MHD_Result MHD_destroy_post_processor (struct 
MHD_PostProcessor *pp)
 Release PostProcessor resources.  After this function is being called,
 the PostProcessor is guaranteed to no longer call its iterator.  There
 is no special call to the iterator to indicate the end of the post processing
diff --git a/src/examples/authorization_example.c 
b/src/examples/authorization_example.c
index 40bffcb7..644b03ef 100644
--- a/src/examples/authorization_example.c
+++ b/src/examples/authorization_example.c
@@ -39,7 +39,7 @@
   "<html><head><title>Access denied</title></head><body>Access 
denied</body></html>"
 
 
-static int
+static enum MHD_Result
 ahc_echo (void *cls,
           struct MHD_Connection *connection,
           const char *url,
@@ -50,7 +50,7 @@ ahc_echo (void *cls,
   static int aptr;
   const char *me = cls;
   struct MHD_Response *response;
-  int ret;
+  enum MHD_Result ret;
   char *user;
   char *pass;
   int fail;
diff --git a/src/examples/benchmark.c b/src/examples/benchmark.c
index 9b07e5c8..939995c9 100644
--- a/src/examples/benchmark.c
+++ b/src/examples/benchmark.c
@@ -106,7 +106,7 @@ uri_logger_cb (void *cls,
 }
 
 
-static int
+static enum MHD_Result
 ahc_echo (void *cls,
           struct MHD_Connection *connection,
           const char *url,
diff --git a/src/examples/benchmark_https.c b/src/examples/benchmark_https.c
index 53b83e0a..6f0cd478 100644
--- a/src/examples/benchmark_https.c
+++ b/src/examples/benchmark_https.c
@@ -106,7 +106,7 @@ uri_logger_cb (void *cls,
 }
 
 
-static int
+static enum MHD_Result
 ahc_echo (void *cls,
           struct MHD_Connection *connection,
           const char *url,
diff --git a/src/examples/chunked_example.c b/src/examples/chunked_example.c
index 9b2cb51c..19a37155 100644
--- a/src/examples/chunked_example.c
+++ b/src/examples/chunked_example.c
@@ -86,7 +86,7 @@ static const char simple_response_text[] =
   "<body>Simple response text</body></html>";
 
 
-static int
+static enum MHD_Result
 ahc_echo (void *cls,
           struct MHD_Connection *connection,
           const char *url,
@@ -99,7 +99,7 @@ ahc_echo (void *cls,
   static int aptr;
   struct ResponseContentCallbackParam *callback_param;
   struct MHD_Response *response;
-  int ret;
+  enum MHD_Result ret;
   (void) cls;               /* Unused. Silent compiler warning. */
   (void) url;               /* Unused. Silent compiler warning. */
   (void) version;           /* Unused. Silent compiler warning. */
diff --git a/src/examples/demo.c b/src/examples/demo.c
index 6b2b20f6..eb974d3a 100644
--- a/src/examples/demo.c
+++ b/src/examples/demo.c
@@ -264,7 +264,7 @@ struct ResponseDataContext
  * @param dirname name of the directory to list
  * @return #MHD_YES on success, #MHD_NO on error
  */
-static int
+static enum MHD_Result
 list_directory (struct ResponseDataContext *rdc,
                 const char *dirname)
 {
@@ -444,7 +444,7 @@ struct UploadContext
  * @param size number of bytes in 'data'
  * @return #MHD_NO on allocation failure, #MHD_YES on success
  */
-static int
+static enum MHD_Result
 do_append (char **ret,
            const char *data,
            size_t size)
@@ -493,7 +493,7 @@ do_append (char **ret,
  * @return #MHD_YES to continue iterating,
  *         #MHD_NO to abort the iteration
  */
-static int
+static enum MHD_Result
 process_upload_data (void *cls,
                      enum MHD_ValueKind kind,
                      const char *key,
@@ -662,12 +662,12 @@ response_completed_callback (void *cls,
  * Return the current directory listing.
  *
  * @param connection connection to return the directory for
- * @return MHD_YES on success, MHD_NO on error
+ * @return #MHD_YES on success, #MHD_NO on error
  */
-static int
+static enum MHD_Result
 return_directory_response (struct MHD_Connection *connection)
 {
-  int ret;
+  enum MHD_Result ret;
 
   (void) pthread_mutex_lock (&mutex);
   if (NULL == cached_directory_response)
@@ -696,7 +696,7 @@ return_directory_response (struct MHD_Connection 
*connection)
  * @param ptr our context
  * @return #MHD_YES on success, #MHD_NO to drop connection
  */
-static int
+static enum MHD_Result
 generate_page (void *cls,
                struct MHD_Connection *connection,
                const char *url,
@@ -706,7 +706,7 @@ generate_page (void *cls,
                size_t *upload_data_size, void **ptr)
 {
   struct MHD_Response *response;
-  int ret;
+  enum MHD_Result ret;
   int fd;
   struct stat buf;
   (void) cls;               /* Unused. Silent compiler warning. */
diff --git a/src/examples/demo_https.c b/src/examples/demo_https.c
index 591c4fc0..6e42f3a5 100644
--- a/src/examples/demo_https.c
+++ b/src/examples/demo_https.c
@@ -267,7 +267,7 @@ struct ResponseDataContext
  * @param dirname name of the directory to list
  * @return MHD_YES on success, MHD_NO on error
  */
-static int
+static enum MHD_Result
 list_directory (struct ResponseDataContext *rdc,
                 const char *dirname)
 {
@@ -447,7 +447,7 @@ struct UploadContext
  * @param size number of bytes in 'data'
  * @return #MHD_NO on allocation failure, #MHD_YES on success
  */
-static int
+static enum MHD_Result
 do_append (char **ret,
            const char *data,
            size_t size)
@@ -493,10 +493,10 @@ do_append (char **ret,
  *              specified offset
  * @param off offset of data in the overall value
  * @param size number of bytes in data available
- * @return MHD_YES to continue iterating,
- *         MHD_NO to abort the iteration
+ * @return #MHD_YES to continue iterating,
+ *         #MHD_NO to abort the iteration
  */
-static int
+static enum MHD_Result
 process_upload_data (void *cls,
                      enum MHD_ValueKind kind,
                      const char *key,
@@ -667,10 +667,10 @@ response_completed_callback (void *cls,
  * @param connection connection to return the directory for
  * @return MHD_YES on success, MHD_NO on error
  */
-static int
+static enum MHD_Result
 return_directory_response (struct MHD_Connection *connection)
 {
-  int ret;
+  enum MHD_Result ret;
 
   (void) pthread_mutex_lock (&mutex);
   if (NULL == cached_directory_response)
@@ -699,7 +699,7 @@ return_directory_response (struct MHD_Connection 
*connection)
  * @param ptr our context
  * @return #MHD_YES on success, #MHD_NO to drop connection
  */
-static int
+static enum MHD_Result
 generate_page (void *cls,
                struct MHD_Connection *connection,
                const char *url,
@@ -709,7 +709,7 @@ generate_page (void *cls,
                size_t *upload_data_size, void **ptr)
 {
   struct MHD_Response *response;
-  int ret;
+  enum MHD_Result ret;
   int fd;
   struct stat buf;
   (void) cls;               /* Unused. Silent compiler warning. */
diff --git a/src/examples/digest_auth_example.c 
b/src/examples/digest_auth_example.c
index 25fb4086..e3edf206 100644
--- a/src/examples/digest_auth_example.c
+++ b/src/examples/digest_auth_example.c
@@ -34,7 +34,7 @@
 
 #define MY_OPAQUE_STR "11733b200778ce33060f31c9af70a870ba96ddd4"
 
-static int
+static enum MHD_Result
 ahc_echo (void *cls,
           struct MHD_Connection *connection,
           const char *url,
@@ -46,7 +46,7 @@ ahc_echo (void *cls,
   char *username;
   const char *password = "testpass";
   const char *realm = "address@hidden";
-  int ret;
+  enum MHD_Result ret;
   (void) cls;               /* Unused. Silent compiler warning. */
   (void) url;               /* Unused. Silent compiler warning. */
   (void) method;            /* Unused. Silent compiler warning. */
diff --git a/src/examples/dual_stack_example.c 
b/src/examples/dual_stack_example.c
index ffacec4a..15bafc44 100644
--- a/src/examples/dual_stack_example.c
+++ b/src/examples/dual_stack_example.c
@@ -28,7 +28,7 @@
 #define PAGE \
   "<html><head><title>libmicrohttpd demo</title></head><body>libmicrohttpd 
demo</body></html>"
 
-static int
+static enum MHD_Result
 ahc_echo (void *cls,
           struct MHD_Connection *connection,
           const char *url,
@@ -39,7 +39,7 @@ ahc_echo (void *cls,
   static int aptr;
   const char *me = cls;
   struct MHD_Response *response;
-  int ret;
+  enum MHD_Result ret;
   (void) url;               /* Unused. Silent compiler warning. */
   (void) version;           /* Unused. Silent compiler warning. */
   (void) upload_data;       /* Unused. Silent compiler warning. */
diff --git a/src/examples/fileserver_example.c 
b/src/examples/fileserver_example.c
index 46e6aad6..767810f9 100644
--- a/src/examples/fileserver_example.c
+++ b/src/examples/fileserver_example.c
@@ -41,7 +41,7 @@
 #define S_ISREG(x) (S_IFREG == (x & S_IFREG))
 #endif /* S_ISREG */
 
-static int
+static enum MHD_Result
 ahc_echo (void *cls,
           struct MHD_Connection *connection,
           const char *url,
@@ -52,7 +52,7 @@ ahc_echo (void *cls,
 {
   static int aptr;
   struct MHD_Response *response;
-  int ret;
+  enum MHD_Result ret;
   int fd;
   struct stat buf;
   (void) cls;               /* Unused. Silent compiler warning. */
diff --git a/src/examples/fileserver_example_dirs.c 
b/src/examples/fileserver_example_dirs.c
index 2b544b69..e6c9ed1f 100644
--- a/src/examples/fileserver_example_dirs.c
+++ b/src/examples/fileserver_example_dirs.c
@@ -81,7 +81,7 @@ dir_reader (void *cls, uint64_t pos, char *buf, size_t max)
 }
 
 
-static int
+static enum MHD_Result
 ahc_echo (void *cls,
           struct MHD_Connection *connection,
           const char *url,
@@ -92,7 +92,7 @@ ahc_echo (void *cls,
 {
   static int aptr;
   struct MHD_Response *response;
-  int ret;
+  enum MHD_Result ret;
   FILE *file;
   int fd;
   DIR *dir;
diff --git a/src/examples/fileserver_example_external_select.c 
b/src/examples/fileserver_example_external_select.c
index 187cdf7e..7209751f 100644
--- a/src/examples/fileserver_example_external_select.c
+++ b/src/examples/fileserver_example_external_select.c
@@ -48,7 +48,7 @@ free_callback (void *cls)
 }
 
 
-static int
+static enum MHD_Result
 ahc_echo (void *cls,
           struct MHD_Connection *connection,
           const char *url,
@@ -59,7 +59,7 @@ ahc_echo (void *cls,
 {
   static int aptr;
   struct MHD_Response *response;
-  int ret;
+  enum MHD_Result ret;
   FILE *file;
   int fd;
   struct stat buf;
diff --git a/src/examples/http_chunked_compression.c 
b/src/examples/http_chunked_compression.c
index ba71923b..07fd00ec 100644
--- a/src/examples/http_chunked_compression.c
+++ b/src/examples/http_chunked_compression.c
@@ -51,13 +51,13 @@ struct Holder
   void *buf;
 };
 
-static int
+static enum MHD_Result
 compress_buf (z_stream *strm, const void *src, size_t src_size, size_t *offset,
               void **dest, size_t *dest_size,
               void *tmp)
 {
   unsigned int have;
-  int ret;
+  enum MHD_Result ret;
   int flush;
   void *tmp_dest;
   *dest = NULL;
@@ -152,14 +152,14 @@ free_cb (void *cls)
 }
 
 
-static int
+static enum MHD_Result
 ahc_echo (void *cls, struct MHD_Connection *con, const char *url, const
           char *method, const char *version,
           const char *upload_data, size_t *upload_size, void **ptr)
 {
   struct Holder *holder;
   struct MHD_Response *res;
-  int ret;
+  enum MHD_Result ret;
   (void) cls;
   (void) url;
   (void) method;
diff --git a/src/examples/http_compression.c b/src/examples/http_compression.c
index f7d8db21..0419a803 100644
--- a/src/examples/http_compression.c
+++ b/src/examples/http_compression.c
@@ -31,7 +31,7 @@
   "hello, hello. This is a 'hello world' message for the world, "   \
   "repeat, for the world.</body></html>"
 
-static int
+static enum MHD_Result
 can_compress (struct MHD_Connection *con)
 {
   const char *ae;
@@ -60,7 +60,7 @@ can_compress (struct MHD_Connection *con)
 }
 
 
-static int
+static enum MHD_Result
 body_compress (void **buf,
                size_t *buf_size)
 {
@@ -90,7 +90,7 @@ body_compress (void **buf,
 }
 
 
-static int
+static enum MHD_Result
 ahc_echo (void *cls,
           struct MHD_Connection *connection,
           const char *url,
@@ -99,8 +99,8 @@ ahc_echo (void *cls,
           const char *upload_data, size_t *upload_data_size, void **ptr)
 {
   struct MHD_Response *response;
-  int ret;
-  int comp;
+  enum MHD_Result ret;
+  enum MHD_Result comp;
   size_t body_len;
   char *body_str;
   (void) cls;               /* Unused. Silent compiler warning. */
diff --git a/src/examples/https_fileserver_example.c 
b/src/examples/https_fileserver_example.c
index 627bc739..5148c8b6 100644
--- a/src/examples/https_fileserver_example.c
+++ b/src/examples/https_fileserver_example.c
@@ -113,7 +113,7 @@ file_free_callback (void *cls)
 
 
 /* HTTP access handler call back */
-static int
+static enum MHD_Result
 http_ahc (void *cls,
           struct MHD_Connection *connection,
           const char *url,
@@ -124,7 +124,7 @@ http_ahc (void *cls,
 {
   static int aptr;
   struct MHD_Response *response;
-  int ret;
+  enum MHD_Result ret;
   FILE *file;
   int fd;
   struct stat buf;
diff --git a/src/examples/minimal_example.c b/src/examples/minimal_example.c
index d6589cf9..a02b5d50 100644
--- a/src/examples/minimal_example.c
+++ b/src/examples/minimal_example.c
@@ -28,7 +28,7 @@
 #define PAGE \
   "<html><head><title>libmicrohttpd demo</title></head><body>libmicrohttpd 
demo</body></html>"
 
-static int
+static enum MHD_Result
 ahc_echo (void *cls,
           struct MHD_Connection *connection,
           const char *url,
@@ -41,7 +41,7 @@ ahc_echo (void *cls,
   static int aptr;
   const char *me = cls;
   struct MHD_Response *response;
-  int ret;
+  enum MHD_Result ret;
 
   (void) url;               /* Unused. Silent compiler warning. */
   (void) version;           /* Unused. Silent compiler warning. */
diff --git a/src/examples/minimal_example_comet.c 
b/src/examples/minimal_example_comet.c
index 80c4258a..c36bf2ce 100644
--- a/src/examples/minimal_example_comet.c
+++ b/src/examples/minimal_example_comet.c
@@ -38,7 +38,7 @@ data_generator (void *cls, uint64_t pos, char *buf, size_t 
max)
 }
 
 
-static int
+static enum MHD_Result
 ahc_echo (void *cls,
           struct MHD_Connection *connection,
           const char *url,
@@ -48,7 +48,7 @@ ahc_echo (void *cls,
 {
   static int aptr;
   struct MHD_Response *response;
-  int ret;
+  enum MHD_Result ret;
   (void) cls;               /* Unused. Silent compiler warning. */
   (void) url;               /* Unused. Silent compiler warning. */
   (void) version;           /* Unused. Silent compiler warning. */
diff --git a/src/examples/minimal_example_empty.c 
b/src/examples/minimal_example_empty.c
index 2de1cc8b..986a2504 100644
--- a/src/examples/minimal_example_empty.c
+++ b/src/examples/minimal_example_empty.c
@@ -26,7 +26,7 @@
 #include <microhttpd.h>
 
 
-static int
+static enum MHD_Result
 ahc_echo (void *cls,
           struct MHD_Connection *connection,
           const char *url,
@@ -38,7 +38,7 @@ ahc_echo (void *cls,
 {
   static int aptr;
   struct MHD_Response *response;
-  int ret;
+  enum MHD_Result ret;
 
   (void) url;               /* Unused. Silent compiler warning. */
   (void) version;           /* Unused. Silent compiler warning. */
diff --git a/src/examples/minimal_example_empty_tls.c 
b/src/examples/minimal_example_empty_tls.c
index e3daca5f..0b9a0e25 100644
--- a/src/examples/minimal_example_empty_tls.c
+++ b/src/examples/minimal_example_empty_tls.c
@@ -26,7 +26,7 @@
 #include <microhttpd.h>
 
 
-static int
+static enum MHD_Result
 ahc_echo (void *cls,
           struct MHD_Connection *connection,
           const char *url,
@@ -38,7 +38,7 @@ ahc_echo (void *cls,
 {
   static int aptr;
   struct MHD_Response *response;
-  int ret;
+  enum MHD_Result ret;
 
   (void) url;               /* Unused. Silent compiler warning. */
   (void) version;           /* Unused. Silent compiler warning. */
diff --git a/src/examples/post_example.c b/src/examples/post_example.c
index 166d8f22..9f4fbcf9 100644
--- a/src/examples/post_example.c
+++ b/src/examples/post_example.c
@@ -205,10 +205,10 @@ get_session (struct MHD_Connection *connection)
  * @param connection connection to process
  * @param MHD_YES on success, MHD_NO on failure
  */
-typedef int (*PageHandler)(const void *cls,
-                           const char *mime,
-                           struct Session *session,
-                           struct MHD_Connection *connection);
+typedef enum MHD_Result (*PageHandler)(const void *cls,
+                                       const char *mime,
+                                       struct Session *session,
+                                       struct MHD_Connection *connection);
 
 
 /**
@@ -274,13 +274,13 @@ add_session_cookie (struct Session *session,
  * @param session session handle
  * @param connection connection to use
  */
-static int
+static enum MHD_Result
 serve_simple_form (const void *cls,
                    const char *mime,
                    struct Session *session,
                    struct MHD_Connection *connection)
 {
-  int ret;
+  enum MHD_Result ret;
   const char *form = cls;
   struct MHD_Response *response;
 
@@ -310,13 +310,13 @@ serve_simple_form (const void *cls,
  * @param session session handle
  * @param connection connection to use
  */
-static int
+static enum MHD_Result
 fill_v1_form (const void *cls,
               const char *mime,
               struct Session *session,
               struct MHD_Connection *connection)
 {
-  int ret;
+  enum MHD_Result ret;
   size_t slen;
   char *reply;
   struct MHD_Response *response;
@@ -359,13 +359,13 @@ fill_v1_form (const void *cls,
  * @param session session handle
  * @param connection connection to use
  */
-static int
+static enum MHD_Result
 fill_v1_v2_form (const void *cls,
                  const char *mime,
                  struct Session *session,
                  struct MHD_Connection *connection)
 {
-  int ret;
+  enum MHD_Result ret;
   char *reply;
   struct MHD_Response *response;
   size_t slen;
@@ -410,13 +410,13 @@ fill_v1_v2_form (const void *cls,
  * @param session session handle
  * @param connection connection to use
  */
-static int
+static enum MHD_Result
 not_found_page (const void *cls,
                 const char *mime,
                 struct Session *session,
                 struct MHD_Connection *connection)
 {
-  int ret;
+  enum MHD_Result ret;
   struct MHD_Response *response;
   (void) cls;     /* Unused. Silent compiler warning. */
   (void) session; /* Unused. Silent compiler warning. */
@@ -469,7 +469,7 @@ static struct Page pages[] = {
  * @return MHD_YES to continue iterating,
  *         MHD_NO to abort the iteration
  */
-static int
+static enum MHD_Result
 post_iterator (void *cls,
                enum MHD_ValueKind kind,
                const char *key,
@@ -554,7 +554,7 @@ post_iterator (void *cls,
  *         MHS_NO if the socket must be closed due to a serious
  *         error while handling the request
  */
-static int
+static enum MHD_Result
 create_response (void *cls,
                  struct MHD_Connection *connection,
                  const char *url,
@@ -567,7 +567,7 @@ create_response (void *cls,
   struct MHD_Response *response;
   struct Request *request;
   struct Session *session;
-  int ret;
+  enum MHD_Result ret;
   unsigned int i;
   (void) cls;               /* Unused. Silent compiler warning. */
   (void) version;           /* Unused. Silent compiler warning. */
diff --git a/src/examples/querystring_example.c 
b/src/examples/querystring_example.c
index 8abd8596..4bff891a 100644
--- a/src/examples/querystring_example.c
+++ b/src/examples/querystring_example.c
@@ -29,7 +29,7 @@
 #define PAGE \
   "<html><head><title>libmicrohttpd demo</title></head><body>Query string for 
&quot;%s&quot; was &quot;%s&quot;</body></html>"
 
-static int
+static enum MHD_Result
 ahc_echo (void *cls,
           struct MHD_Connection *connection,
           const char *url,
@@ -42,7 +42,7 @@ ahc_echo (void *cls,
   const char *val;
   char *me;
   struct MHD_Response *response;
-  int ret;
+  enum MHD_Result ret;
   (void) url;               /* Unused. Silent compiler warning. */
   (void) version;           /* Unused. Silent compiler warning. */
   (void) upload_data;       /* Unused. Silent compiler warning. */
diff --git a/src/examples/refuse_post_example.c 
b/src/examples/refuse_post_example.c
index 3a34f36d..7e100d9f 100644
--- a/src/examples/refuse_post_example.c
+++ b/src/examples/refuse_post_example.c
@@ -35,7 +35,7 @@ const char *askpage =
 #define BUSYPAGE \
   "<html><head><title>Webserver busy</title></head><body>We are too busy to 
process POSTs right now.</body></html>"
 
-static int
+static enum MHD_Result
 ahc_echo (void *cls,
           struct MHD_Connection *connection,
           const char *url,
@@ -46,7 +46,7 @@ ahc_echo (void *cls,
   static int aptr;
   const char *me = cls;
   struct MHD_Response *response;
-  int ret;
+  enum MHD_Result ret;
   (void) cls;               /* Unused. Silent compiler warning. */
   (void) url;               /* Unused. Silent compiler warning. */
   (void) version;           /* Unused. Silent compiler warning. */
diff --git a/src/examples/suspend_resume_epoll.c 
b/src/examples/suspend_resume_epoll.c
index a69fdc4a..afa1169c 100644
--- a/src/examples/suspend_resume_epoll.c
+++ b/src/examples/suspend_resume_epoll.c
@@ -43,7 +43,7 @@ static int epfd;
 static struct epoll_event evt;
 
 
-static int
+static enum MHD_Result
 ahc_echo (void *cls,
           struct MHD_Connection *connection,
           const char *url,
@@ -52,7 +52,7 @@ ahc_echo (void *cls,
           const char *upload_data, size_t *upload_data_size, void **ptr)
 {
   struct MHD_Response *response;
-  int ret;
+  enum MHD_Result ret;
   struct Request*req;
   struct itimerspec ts;
 
diff --git a/src/examples/timeout.c b/src/examples/timeout.c
index cfb66950..b31ff21f 100644
--- a/src/examples/timeout.c
+++ b/src/examples/timeout.c
@@ -29,7 +29,7 @@
 
 #define PORT 8080
 
-static int
+static enum MHD_Result
 answer_to_connection (void *cls,
                       struct MHD_Connection *connection,
                       const char *url,
@@ -41,7 +41,7 @@ answer_to_connection (void *cls,
 {
   const char *page = "<html><body>Hello timeout!</body></html>";
   struct MHD_Response *response;
-  int ret;
+  enum MHD_Result ret;
   (void) cls;               /* Unused. Silent compiler warning. */
   (void) url;               /* Unused. Silent compiler warning. */
   (void) version;           /* Unused. Silent compiler warning. */
diff --git a/src/examples/upgrade_example.c b/src/examples/upgrade_example.c
index 98675e09..85a06646 100644
--- a/src/examples/upgrade_example.c
+++ b/src/examples/upgrade_example.c
@@ -240,7 +240,7 @@ uh_cb (void *cls,
 }
 
 
-static int
+static enum MHD_Result
 ahc_echo (void *cls,
           struct MHD_Connection *connection,
           const char *url,
@@ -252,7 +252,7 @@ ahc_echo (void *cls,
 {
   static int aptr;
   struct MHD_Response *response;
-  int ret;
+  enum MHD_Result ret;
   (void) cls;               /* Unused. Silent compiler warning. */
   (void) url;               /* Unused. Silent compiler warning. */
   (void) version;           /* Unused. Silent compiler warning. */
diff --git a/src/examples/websocket_threaded_example.c 
b/src/examples/websocket_threaded_example.c
index 69abb0f3..2310b82b 100644
--- a/src/examples/websocket_threaded_example.c
+++ b/src/examples/websocket_threaded_example.c
@@ -402,7 +402,7 @@ BASE64Encode (const void *in, size_t len, unsigned char 
**output)
 
 /********** end Base64 **********/
 
-static int
+static enum MHD_Result
 is_websocket_request (struct MHD_Connection *con, const char *upg_header,
                       const char *con_header)
 {
@@ -414,11 +414,11 @@ is_websocket_request (struct MHD_Connection *con, const 
char *upg_header,
 }
 
 
-static int
+static enum MHD_Result
 send_chat_page (struct MHD_Connection *con, uint16_t port)
 {
   struct MHD_Response *res;
-  int ret;
+  enum MHD_Result 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);
@@ -427,11 +427,11 @@ send_chat_page (struct MHD_Connection *con, uint16_t port)
 }
 
 
-static int
+static enum MHD_Result
 send_bad_request (struct MHD_Connection *con)
 {
   struct MHD_Response *res;
-  int ret;
+  enum MHD_Result ret;
   res = MHD_create_response_from_buffer (strlen (BAD_REQUEST_PAGE),
                                          (void *) BAD_REQUEST_PAGE,
                                          MHD_RESPMEM_PERSISTENT);
@@ -441,11 +441,11 @@ send_bad_request (struct MHD_Connection *con)
 }
 
 
-static int
+static enum MHD_Result
 send_upgrade_required (struct MHD_Connection *con)
 {
   struct MHD_Response *res;
-  int ret;
+  enum MHD_Result ret;
   res = MHD_create_response_from_buffer (strlen (UPGRADE_REQUIRED_PAGE),
                                          (void *) UPGRADE_REQUIRED_PAGE,
                                          MHD_RESPMEM_PERSISTENT);
@@ -457,7 +457,7 @@ send_upgrade_required (struct MHD_Connection *con)
 }
 
 
-static int
+static enum MHD_Result
 ws_get_accept_value (char *key, unsigned char **val)
 {
   struct SHA1Context ctx;
@@ -731,7 +731,7 @@ run_usock (void *cls)
 }
 
 
-static int
+static enum MHD_Result
 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)
@@ -764,7 +764,7 @@ uh_cb (void *cls, struct MHD_Connection *con, void *con_cls,
   {
     free (ws);
     MHD_upgrade_action (urh, MHD_UPGRADE_ACTION_CLOSE);
-    return;
+    return MHD_YES;
   }
   pthread_mutex_unlock (&MUTEX);
   if (0 != pthread_create (&pt, NULL, &run_usock, ws))
@@ -773,10 +773,11 @@ uh_cb (void *cls, struct MHD_Connection *con, void 
*con_cls,
      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);
+  return MHD_YES;
 }
 
 
-static int
+static enum MHD_Result
 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)
@@ -788,7 +789,7 @@ ahc_cb (void *cls, struct MHD_Connection *con, const char 
*url,
   const char *ws_key_header;
   char ws_ac_header[60];
   char *ws_ac_value;
-  int ret;
+  enum MHD_Result ret;
   (void) url;
   (void) upload_data;
   (void) upload_data_size;
diff --git a/src/include/microhttpd.h b/src/include/microhttpd.h
index 5bf33547..00d4f9bd 100644
--- a/src/include/microhttpd.h
+++ b/src/include/microhttpd.h
@@ -1,6 +1,6 @@
 /*
      This file is part of libmicrohttpd
-     Copyright (C) 2006--2019 Christian Grothoff (and other contributing 
authors)
+     Copyright (C) 2006--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
@@ -135,14 +135,22 @@ typedef intptr_t ssize_t;
 #define MHD_VERSION 0x00097002
 
 /**
- * MHD-internal return code for "YES".
+ * Operational results from MHD calls.
  */
-#define MHD_YES 1
+enum MHD_Result
+{
+  /**
+   * MHD result code for "NO".
+   */
+  MHD_NO = 0,
+
+  /**
+   * MHD result code for "YES".
+   */
+  MHD_YES = 1
+
+};
 
-/**
- * MHD-internal return code for "NO".
- */
-#define MHD_NO 0
 
 /**
  * MHD digest auth internal code for an invalid nonce.
@@ -2118,10 +2126,10 @@ typedef void
  * @param addrlen length of @a addr
  * @return #MHD_YES if connection is allowed, #MHD_NO if not
  */
-typedef int
-(*MHD_AcceptPolicyCallback) (void *cls,
-                             const struct sockaddr *addr,
-                             socklen_t addrlen);
+typedef enum MHD_Result
+(*MHD_AcceptPolicyCallback)(void *cls,
+                            const struct sockaddr *addr,
+                            socklen_t addrlen);
 
 
 /**
@@ -2163,15 +2171,15 @@ typedef int
  *         #MHD_NO if the socket must be closed due to a serious
  *         error while handling the request
  */
-typedef int
-(*MHD_AccessHandlerCallback) (void *cls,
-                              struct MHD_Connection *connection,
-                              const char *url,
-                              const char *method,
-                              const char *version,
-                              const char *upload_data,
-                              size_t *upload_data_size,
-                              void **con_cls);
+typedef enum MHD_Result
+(*MHD_AccessHandlerCallback)(void *cls,
+                             struct MHD_Connection *connection,
+                             const char *url,
+                             const char *method,
+                             const char *version,
+                             const char *upload_data,
+                             size_t *upload_data_size,
+                             void **con_cls);
 
 
 /**
@@ -2234,11 +2242,11 @@ typedef void
  *         #MHD_NO to abort the iteration
  * @ingroup request
  */
-typedef int
-(*MHD_KeyValueIterator) (void *cls,
-                         enum MHD_ValueKind kind,
-                         const char *key,
-                         const char *value);
+typedef enum MHD_Result
+(*MHD_KeyValueIterator)(void *cls,
+                        enum MHD_ValueKind kind,
+                        const char *key,
+                        const char *value);
 
 
 /**
@@ -2259,13 +2267,13 @@ typedef int
  *         #MHD_NO to abort the iteration
  * @ingroup request
  */
-typedef int
-(*MHD_KeyValueIteratorN) (void *cls,
-                          enum MHD_ValueKind kind,
-                          const char *key,
-                          size_t key_size,
-                          const char *value,
-                          size_t value_size);
+typedef enum MHD_Result
+(*MHD_KeyValueIteratorN)(void *cls,
+                         enum MHD_ValueKind kind,
+                         const char *key,
+                         size_t key_size,
+                         const char *value,
+                         size_t value_size);
 
 
 /**
@@ -2351,16 +2359,16 @@ typedef void
  * @return #MHD_YES to continue iterating,
  *         #MHD_NO to abort the iteration
  */
-typedef int
-(*MHD_PostDataIterator) (void *cls,
-                         enum MHD_ValueKind kind,
-                         const char *key,
-                         const char *filename,
-                         const char *content_type,
-                         const char *transfer_encoding,
-                         const char *data,
-                         uint64_t off,
-                         size_t size);
+typedef enum MHD_Result
+(*MHD_PostDataIterator)(void *cls,
+                        enum MHD_ValueKind kind,
+                        const char *key,
+                        const char *filename,
+                        const char *content_type,
+                        const char *transfer_encoding,
+                        const char *data,
+                        uint64_t off,
+                        size_t size);
 
 /* **************** Daemon handling functions ***************** */
 
@@ -2481,7 +2489,7 @@ MHD_stop_daemon (struct MHD_Daemon *daemon);
  *        set to indicate further details about the error.
  * @ingroup specialized
  */
-_MHD_EXTERN int
+_MHD_EXTERN enum MHD_Result
 MHD_add_connection (struct MHD_Daemon *daemon,
                     MHD_socket client_socket,
                     const struct sockaddr *addr,
@@ -2517,7 +2525,7 @@ MHD_add_connection (struct MHD_Daemon *daemon,
  *         fit fd_set.
  * @ingroup event
  */
-_MHD_EXTERN int
+_MHD_EXTERN enum MHD_Result
 MHD_get_fdset (struct MHD_Daemon *daemon,
                fd_set *read_fd_set,
                fd_set *write_fd_set,
@@ -2557,7 +2565,7 @@ MHD_get_fdset (struct MHD_Daemon *daemon,
  *         fit fd_set.
  * @ingroup event
  */
-_MHD_EXTERN int
+_MHD_EXTERN enum MHD_Result
 MHD_get_fdset2 (struct MHD_Daemon *daemon,
                 fd_set *read_fd_set,
                 fd_set *write_fd_set,
@@ -2613,7 +2621,7 @@ MHD_get_fdset2 (struct MHD_Daemon *daemon,
  *        necessitate the use of a timeout right now).
  * @ingroup event
  */
-_MHD_EXTERN int
+_MHD_EXTERN enum MHD_Result
 MHD_get_timeout (struct MHD_Daemon *daemon,
                  MHD_UNSIGNED_LONG_LONG *timeout);
 
@@ -2638,7 +2646,7 @@ MHD_get_timeout (struct MHD_Daemon *daemon,
  *         options for this call.
  * @ingroup event
  */
-_MHD_EXTERN int
+_MHD_EXTERN enum MHD_Result
 MHD_run (struct MHD_Daemon *daemon);
 
 
@@ -2664,7 +2672,7 @@ MHD_run (struct MHD_Daemon *daemon);
  * @return #MHD_NO on serious errors, #MHD_YES on success
  * @ingroup event
  */
-_MHD_EXTERN int
+_MHD_EXTERN enum MHD_Result
 MHD_run_from_select (struct MHD_Daemon *daemon,
                      const fd_set *read_fd_set,
                      const fd_set *write_fd_set,
@@ -2737,7 +2745,7 @@ MHD_get_connection_values_n (struct MHD_Connection 
*connection,
  *         #MHD_YES on success
  * @ingroup request
  */
-_MHD_EXTERN int
+_MHD_EXTERN enum MHD_Result
 MHD_set_connection_value (struct MHD_Connection *connection,
                           enum MHD_ValueKind kind,
                           const char *key,
@@ -2769,7 +2777,7 @@ MHD_set_connection_value (struct MHD_Connection 
*connection,
  *         #MHD_YES on success
  * @ingroup request
  */
-int
+_MHD_EXTERN enum MHD_Result
 MHD_set_connection_value_n (struct MHD_Connection *connection,
                             enum MHD_ValueKind kind,
                             const char *key,
@@ -2846,7 +2854,7 @@ MHD_lookup_connection_value (struct MHD_Connection 
*connection,
  *         #MHD_NO otherwise.
  * @ingroup request
  */
-_MHD_EXTERN int
+_MHD_EXTERN enum MHD_Result
 MHD_lookup_connection_value_n (struct MHD_Connection *connection,
                                enum MHD_ValueKind kind,
                                const char *key,
@@ -2866,7 +2874,7 @@ MHD_lookup_connection_value_n (struct MHD_Connection 
*connection,
  *         #MHD_YES on success or if message has been queued
  * @ingroup response
  */
-_MHD_EXTERN int
+_MHD_EXTERN enum MHD_Result
 MHD_queue_response (struct MHD_Connection *connection,
                     unsigned int status_code,
                     struct MHD_Response *response);
@@ -2980,7 +2988,7 @@ enum MHD_ResponseOptions
  * @param ... #MHD_RO_END terminated list of options
  * @return #MHD_YES on success, #MHD_NO on error
  */
-_MHD_EXTERN int
+_MHD_EXTERN enum MHD_Result
 MHD_set_response_options (struct MHD_Response *response,
                           enum MHD_ResponseFlags flags,
                           ...);
@@ -3239,7 +3247,7 @@ struct MHD_UpgradeResponseHandle;
  * @param ... arguments to the action (depends on the action)
  * @return #MHD_NO on error, #MHD_YES on success
  */
-_MHD_EXTERN int
+_MHD_EXTERN enum MHD_Result
 MHD_upgrade_action (struct MHD_UpgradeResponseHandle *urh,
                     enum MHD_UpgradeAction action,
                     ...);
@@ -3359,7 +3367,7 @@ MHD_destroy_response (struct MHD_Response *response);
  *         or out of memory
  * @ingroup response
  */
-_MHD_EXTERN int
+_MHD_EXTERN enum MHD_Result
 MHD_add_response_header (struct MHD_Response *response,
                          const char *header,
                          const char *content);
@@ -3374,7 +3382,7 @@ MHD_add_response_header (struct MHD_Response *response,
  * @return #MHD_NO on error (i.e. invalid footer or content format).
  * @ingroup response
  */
-_MHD_EXTERN int
+_MHD_EXTERN enum MHD_Result
 MHD_add_response_footer (struct MHD_Response *response,
                          const char *footer,
                          const char *content);
@@ -3389,7 +3397,7 @@ MHD_add_response_footer (struct MHD_Response *response,
  * @return #MHD_NO on error (no such header known)
  * @ingroup response
  */
-_MHD_EXTERN int
+_MHD_EXTERN enum MHD_Result
 MHD_del_response_header (struct MHD_Response *response,
                          const char *header,
                          const char *content);
@@ -3470,7 +3478,7 @@ MHD_create_post_processor (struct MHD_Connection 
*connection,
  *         (out-of-memory, iterator aborted, parse error)
  * @ingroup request
  */
-_MHD_EXTERN int
+_MHD_EXTERN enum MHD_Result
 MHD_post_process (struct MHD_PostProcessor *pp,
                   const char *post_data, size_t post_data_len);
 
@@ -3485,7 +3493,7 @@ MHD_post_process (struct MHD_PostProcessor *pp,
  *                value of this function
  * @ingroup request
  */
-_MHD_EXTERN int
+_MHD_EXTERN enum MHD_Result
 MHD_destroy_post_processor (struct MHD_PostProcessor *pp);
 
 
@@ -3665,7 +3673,7 @@ MHD_digest_auth_check_digest (struct MHD_Connection 
*connection,
  * @return #MHD_YES on success, #MHD_NO otherwise
  * @ingroup authentication
  */
-_MHD_EXTERN int
+_MHD_EXTERN enum MHD_Result
 MHD_queue_auth_fail_response2 (struct MHD_Connection *connection,
                                const char *realm,
                                const char *opaque,
@@ -3691,7 +3699,7 @@ MHD_queue_auth_fail_response2 (struct MHD_Connection 
*connection,
  * @ingroup authentication
  * @deprecated use MHD_queue_auth_fail_response2()
  */
-_MHD_EXTERN int
+_MHD_EXTERN enum MHD_Result
 MHD_queue_auth_fail_response (struct MHD_Connection *connection,
                               const char *realm,
                               const char *opaque,
@@ -3777,7 +3785,7 @@ enum MHD_CONNECTION_OPTION
  * @return #MHD_YES on success, #MHD_NO if setting the option failed
  * @ingroup specialized
  */
-_MHD_EXTERN int
+_MHD_EXTERN enum MHD_Result
 MHD_set_connection_option (struct MHD_Connection *connection,
                            enum MHD_CONNECTION_OPTION option,
                            ...);
@@ -4042,7 +4050,7 @@ enum MHD_FEATURE
  * feature is not supported or feature is unknown.
  * @ingroup specialized
  */
-_MHD_EXTERN int
+_MHD_EXTERN enum MHD_Result
 MHD_is_feature_supported (enum MHD_FEATURE feature);
 
 
diff --git a/src/microhttpd/connection.c b/src/microhttpd/connection.c
index 80a9bff0..44fc86a2 100644
--- a/src/microhttpd/connection.c
+++ b/src/microhttpd/connection.c
@@ -388,7 +388,7 @@ MHD_get_connection_values_n (struct MHD_Connection 
*connection,
  *         #MHD_YES on success
  * @ingroup request
  */
-static int
+static enum MHD_Result
 MHD_set_connection_value_n_nocheck_ (struct MHD_Connection *connection,
                                      enum MHD_ValueKind kind,
                                      const char *key,
@@ -449,7 +449,7 @@ MHD_set_connection_value_n_nocheck_ (struct MHD_Connection 
*connection,
  *         #MHD_YES on success
  * @ingroup request
  */
-int
+enum MHD_Result
 MHD_set_connection_value_n (struct MHD_Connection *connection,
                             enum MHD_ValueKind kind,
                             const char *key,
@@ -496,7 +496,7 @@ MHD_set_connection_value_n (struct MHD_Connection 
*connection,
  *         #MHD_YES on success
  * @ingroup request
  */
-int
+enum MHD_Result
 MHD_set_connection_value (struct MHD_Connection *connection,
                           enum MHD_ValueKind kind,
                           const char *key,
@@ -562,7 +562,7 @@ MHD_lookup_connection_value (struct MHD_Connection 
*connection,
  *         #MHD_NO otherwise.
  * @ingroup request
  */
-_MHD_EXTERN int
+_MHD_EXTERN enum MHD_Result
 MHD_lookup_connection_value_n (struct MHD_Connection *connection,
                                enum MHD_ValueKind kind,
                                const char *key,
@@ -679,9 +679,9 @@ MHD_lookup_header_token_ci (const struct MHD_Connection 
*connection,
  * message for this connection?
  *
  * @param connection connection to test
- * @return 0 if we don't need 100 CONTINUE, 1 if we do
+ * @return false if we don't need 100 CONTINUE, true if we do
  */
-static int
+static bool
 need_100_continue (struct MHD_Connection *connection)
 {
   const char *expect;
@@ -880,7 +880,7 @@ connection_close_error (struct MHD_Connection *connection,
  *  lock on the response will have been released already
  *  in this case).
  */
-static int
+static enum MHD_Result
 try_ready_normal_body (struct MHD_Connection *connection)
 {
   ssize_t ret;
@@ -951,7 +951,7 @@ try_ready_normal_body (struct MHD_Connection *connection)
  * @param connection the connection
  * @return #MHD_NO if readying the response failed
  */
-static int
+static enum MHD_Result
 try_ready_chunked_body (struct MHD_Connection *connection)
 {
   ssize_t ret;
@@ -1082,7 +1082,7 @@ try_ready_chunked_body (struct MHD_Connection *connection)
  * @return #MHD_YES if (based on the request), a keepalive is
  *        legal
  */
-static int
+static enum MHD_Result
 keepalive_possible (struct MHD_Connection *connection)
 {
   if (MHD_CONN_MUST_CLOSE == connection->keepalive)
@@ -1248,7 +1248,7 @@ try_grow_read_buffer (struct MHD_Connection *connection,
  * @param connection the connection
  * @return #MHD_YES on success, #MHD_NO on failure (out of memory)
  */
-static int
+static enum MHD_Result
 build_header_response (struct MHD_Connection *connection)
 {
   struct MHD_Response *response = connection->response;
@@ -1627,7 +1627,7 @@ transmit_error_response (struct MHD_Connection 
*connection,
                          const char *message)
 {
   struct MHD_Response *response;
-  int iret;
+  enum MHD_Result iret;
 
   if (NULL == connection->version)
   {
@@ -1933,7 +1933,7 @@ get_next_header_line (struct MHD_Connection *connection,
  * @param value_size number of bytes in @a value
  * @return #MHD_NO on failure (out of memory), #MHD_YES for success
  */
-static int
+static enum MHD_Result
 connection_add_header (struct MHD_Connection *connection,
                        const char *key,
                        size_t key_size,
@@ -1968,7 +1968,7 @@ connection_add_header (struct MHD_Connection *connection,
  * @param connection connection to parse header of
  * @return #MHD_YES for success, #MHD_NO for failure (malformed, out of memory)
  */
-static int
+static enum MHD_Result
 parse_cookie_header (struct MHD_Connection *connection)
 {
   const char *hdr;
@@ -2094,7 +2094,7 @@ parse_cookie_header (struct MHD_Connection *connection)
  * @param line_len length of the first @a line
  * @return #MHD_YES if the line is ok, #MHD_NO if it is malformed
  */
-static int
+static enum MHD_Result
 parse_initial_message_line (struct MHD_Connection *connection,
                             char *line,
                             size_t line_len)
@@ -2485,7 +2485,7 @@ process_request_body (struct MHD_Connection *connection)
  * @param next_state the next state to transition to
  * @return #MHD_NO if we are not done, #MHD_YES if we are
  */
-static int
+static enum MHD_Result
 check_write_done (struct MHD_Connection *connection,
                   enum MHD_CONNECTION_STATE next_state)
 {
@@ -2514,7 +2514,7 @@ check_write_done (struct MHD_Connection *connection,
  * @param line line from the header to process
  * @return #MHD_YES on success, #MHD_NO on error (malformed @a line)
  */
-static int
+static enum MHD_Result
 process_header_line (struct MHD_Connection *connection,
                      char *line)
 {
@@ -2573,7 +2573,7 @@ process_header_line (struct MHD_Connection *connection,
  *        of the given kind
  * @return #MHD_YES if the line was processed successfully
  */
-static int
+static enum MHD_Result
 process_broken_line (struct MHD_Connection *connection,
                      char *line,
                      enum MHD_ValueKind kind)
@@ -2681,7 +2681,7 @@ parse_connection_headers (struct MHD_Connection 
*connection)
                                        NULL,
                                        NULL)) )
   {
-    int iret;
+    enum MHD_Result iret;
 
     /* die, http 1.1 request without host and we are pedantic */
     connection->state = MHD_CONNECTION_FOOTERS_RECEIVED;
@@ -3272,13 +3272,13 @@ cleanup_connection (struct MHD_Connection *connection)
  * @return #MHD_YES if we should continue to process the
  *         connection (not dead yet), #MHD_NO if it died
  */
-int
+enum MHD_Result
 MHD_connection_handle_idle (struct MHD_Connection *connection)
 {
   struct MHD_Daemon *daemon = connection->daemon;
   char *line;
   size_t line_len;
-  int ret;
+  enum MHD_Result ret;
 
   connection->in_idle = true;
   while (! connection->suspended)
@@ -3763,7 +3763,7 @@ MHD_connection_handle_idle (struct MHD_Connection 
*connection)
  * @return #MHD_YES if we should continue to process the
  *         connection (not dead yet), #MHD_NO if it died
  */
-int
+enum MHD_Result
 MHD_connection_epoll_update_ (struct MHD_Connection *connection)
 {
   struct MHD_Daemon *daemon = connection->daemon;
@@ -3888,7 +3888,7 @@ MHD_get_connection_info (struct MHD_Connection 
*connection,
  * @return #MHD_YES on success, #MHD_NO if setting the option failed
  * @ingroup specialized
  */
-int
+enum MHD_Result
 MHD_set_connection_option (struct MHD_Connection *connection,
                            enum MHD_CONNECTION_OPTION option,
                            ...)
@@ -3954,7 +3954,7 @@ MHD_set_connection_option (struct MHD_Connection 
*connection,
  *         #MHD_YES on success or if message has been queued
  * @ingroup response
  */
-int
+enum MHD_Result
 MHD_queue_response (struct MHD_Connection *connection,
                     unsigned int status_code,
                     struct MHD_Response *response)
diff --git a/src/microhttpd/connection.h b/src/microhttpd/connection.h
index 88f31dbd..29724a24 100644
--- a/src/microhttpd/connection.h
+++ b/src/microhttpd/connection.h
@@ -114,10 +114,10 @@ MHD_connection_handle_write (struct MHD_Connection 
*connection);
  * recv(), send() and response.
  *
  * @param connection connection to handle
- * @return MHD_YES if we should continue to process the
- *         connection (not dead yet), MHD_NO if it died
+ * @return #MHD_YES if we should continue to process the
+ *         connection (not dead yet), #MHD_NO if it died
  */
-int
+enum MHD_Result
 MHD_connection_handle_idle (struct MHD_Connection *connection);
 
 
@@ -165,10 +165,10 @@ MHD_connection_finish_forward_ (struct MHD_Connection 
*connection);
  * the epoll set if needed.
  *
  * @param connection connection to process
- * @return MHD_YES if we should continue to process the
- *         connection (not dead yet), MHD_NO if it died
+ * @return #MHD_YES if we should continue to process the
+ *         connection (not dead yet), #MHD_NO if it died
  */
-int
+enum MHD_Result
 MHD_connection_epoll_update_ (struct MHD_Connection *connection);
 
 #endif
diff --git a/src/microhttpd/daemon.c b/src/microhttpd/daemon.c
index f7c138aa..660ee61e 100644
--- a/src/microhttpd/daemon.c
+++ b/src/microhttpd/daemon.c
@@ -113,7 +113,7 @@ close_all_connections (struct MHD_Daemon *daemon);
  * @param may_block #MHD_YES if blocking, #MHD_NO if non-blocking
  * @return #MHD_NO on serious errors, #MHD_YES on success
  */
-static int
+static enum MHD_Result
 MHD_epoll (struct MHD_Daemon *daemon,
            int may_block);
 
@@ -361,7 +361,7 @@ MHD_ip_addr_compare (const void *a1,
  * @param key where to store the parsed address
  * @return #MHD_YES on success and #MHD_NO otherwise (e.g., invalid address 
type)
  */
-static int
+static enum MHD_Result
 MHD_ip_addr_to_key (const struct sockaddr *addr,
                     socklen_t addrlen,
                     struct MHD_IPCount *key)
@@ -412,7 +412,7 @@ MHD_ip_addr_to_key (const struct sockaddr *addr,
  * @return Return #MHD_YES if IP below limit, #MHD_NO if IP has surpassed 
limit.
  *   Also returns #MHD_NO if fails to allocate memory.
  */
-static int
+static enum MHD_Result
 MHD_ip_limit_add (struct MHD_Daemon *daemon,
                   const struct sockaddr *addr,
                   socklen_t addrlen)
@@ -420,7 +420,7 @@ MHD_ip_limit_add (struct MHD_Daemon *daemon,
   struct MHD_IPCount *key;
   void **nodep;
   void *node;
-  int result;
+  enum MHD_Result result;
 
   daemon = MHD_get_master (daemon);
   /* Ignore if no connection limit assigned */
@@ -723,7 +723,7 @@ MHD_TLS_init (struct MHD_Daemon *daemon)
  *         fit fd_set.
  * @ingroup event
  */
-int
+enum MHD_Result
 MHD_get_fdset (struct MHD_Daemon *daemon,
                fd_set *read_fd_set,
                fd_set *write_fd_set,
@@ -976,7 +976,7 @@ urh_from_pollfd (struct MHD_UpgradeResponseHandle *urh,
  *         fit fd_set.
  * @ingroup event
  */
-static int
+static enum MHD_Result
 internal_get_fdset2 (struct MHD_Daemon *daemon,
                      fd_set *read_fd_set,
                      fd_set *write_fd_set,
@@ -987,7 +987,7 @@ internal_get_fdset2 (struct MHD_Daemon *daemon,
 {
   struct MHD_Connection *pos;
   struct MHD_Connection *posn;
-  int result = MHD_YES;
+  enum MHD_Result result = MHD_YES;
   MHD_socket ls;
 
   if (daemon->shutdown)
@@ -1125,7 +1125,7 @@ internal_get_fdset2 (struct MHD_Daemon *daemon,
  *         fit fd_set.
  * @ingroup event
  */
-int
+enum MHD_Result
 MHD_get_fdset2 (struct MHD_Daemon *daemon,
                 fd_set *read_fd_set,
                 fd_set *write_fd_set,
@@ -1191,13 +1191,13 @@ MHD_get_fdset2 (struct MHD_Daemon *daemon,
  *         #MHD_NO if a serious error was encountered and the
  *         connection is to be closed.
  */
-static int
+static enum MHD_Result
 call_handlers (struct MHD_Connection *con,
                bool read_ready,
                bool write_ready,
                bool force_close)
 {
-  int ret;
+  enum MHD_Result ret;
   bool states_info_processed = false;
   /* Fast track flag */
   bool on_fasttrack = (con->state == MHD_CONNECTION_INIT);
@@ -2369,7 +2369,7 @@ psk_gnutls_adapter (gnutls_session_t session,
  *        The socket will be closed in any case; 'errno' is
  *        set to indicate further details about the error.
  */
-static int
+static enum MHD_Result
 internal_add_connection (struct MHD_Daemon *daemon,
                          MHD_socket client_socket,
                          const struct sockaddr *addr,
@@ -2969,12 +2969,12 @@ MHD_resume_connection (struct MHD_Connection 
*connection)
  * @param daemon daemon context
  * @return #MHD_YES if a connection was actually resumed
  */
-static int
+static enum MHD_Result
 resume_suspended_connections (struct MHD_Daemon *daemon)
 {
   struct MHD_Connection *pos;
   struct MHD_Connection *prev = NULL;
-  int ret;
+  enum MHD_Result ret;
   const bool used_thr_p_c = (0 != (daemon->options
                                    & MHD_USE_THREAD_PER_CONNECTION));
 #if defined(MHD_USE_POSIX_THREADS) || defined(MHD_USE_W32_THREADS)
@@ -3124,7 +3124,7 @@ resume_suspended_connections (struct MHD_Daemon *daemon)
  *        set to indicate further details about the error.
  * @ingroup specialized
  */
-int
+enum MHD_Result
 MHD_add_connection (struct MHD_Daemon *daemon,
                     MHD_socket client_socket,
                     const struct sockaddr *addr,
@@ -3185,7 +3185,7 @@ MHD_add_connection (struct MHD_Daemon *daemon,
  *         a return code of #MHD_NO only refers to the actual
  *         accept() system call.
  */
-static int
+static enum MHD_Result
 MHD_accept_connection (struct MHD_Daemon *daemon)
 {
 #if HAVE_INET6
@@ -3443,7 +3443,7 @@ MHD_cleanup_connections (struct MHD_Daemon *daemon)
  *        necessitate the use of a timeout right now).
  * @ingroup event
  */
-int
+enum MHD_Result
 MHD_get_timeout (struct MHD_Daemon *daemon,
                  MHD_UNSIGNED_LONG_LONG *timeout)
 {
@@ -3533,7 +3533,7 @@ MHD_get_timeout (struct MHD_Daemon *daemon,
  * @return #MHD_NO on serious errors, #MHD_YES on success
  * @ingroup event
  */
-static int
+static enum MHD_Result
 internal_run_from_select (struct MHD_Daemon *daemon,
                           const fd_set *read_fd_set,
                           const fd_set *write_fd_set,
@@ -3637,7 +3637,7 @@ internal_run_from_select (struct MHD_Daemon *daemon,
  * @return #MHD_NO on serious errors, #MHD_YES on success
  * @ingroup event
  */
-int
+enum MHD_Result
 MHD_run_from_select (struct MHD_Daemon *daemon,
                      const fd_set *read_fd_set,
                      const fd_set *write_fd_set,
@@ -3662,8 +3662,8 @@ MHD_run_from_select (struct MHD_Daemon *daemon,
   if (0 != (daemon->options & MHD_USE_EPOLL))
   {
 #ifdef EPOLL_SUPPORT
-    int ret = MHD_epoll (daemon,
-                         MHD_NO);
+    enum MHD_Result ret = MHD_epoll (daemon,
+                                     MHD_NO);
 
     MHD_cleanup_connections (daemon);
     return ret;
@@ -3691,7 +3691,7 @@ MHD_run_from_select (struct MHD_Daemon *daemon,
  * @param may_block #MHD_YES if blocking, #MHD_NO if non-blocking
  * @return #MHD_NO on serious errors, #MHD_YES on success
  */
-static int
+static enum MHD_Result
 MHD_select (struct MHD_Daemon *daemon,
             int may_block)
 {
@@ -3860,7 +3860,7 @@ MHD_select (struct MHD_Daemon *daemon,
  * @param may_block #MHD_YES if blocking, #MHD_NO if non-blocking
  * @return #MHD_NO on serious errors, #MHD_YES on success
  */
-static int
+static enum MHD_Result
 MHD_poll_all (struct MHD_Daemon *daemon,
               int may_block)
 {
@@ -4075,7 +4075,7 @@ MHD_poll_all (struct MHD_Daemon *daemon,
  * @param may_block #MHD_YES if blocking, #MHD_NO if non-blocking
  * @return #MHD_NO on serious errors, #MHD_YES on success
  */
-static int
+static enum MHD_Result
 MHD_poll_listen_socket (struct MHD_Daemon *daemon,
                         int may_block)
 {
@@ -4159,7 +4159,7 @@ MHD_poll_listen_socket (struct MHD_Daemon *daemon,
  * @param may_block #MHD_YES if blocking, #MHD_NO if non-blocking
  * @return #MHD_NO on serious errors, #MHD_YES on success
  */
-static int
+static enum MHD_Result
 MHD_poll (struct MHD_Daemon *daemon,
           int may_block)
 {
@@ -4238,7 +4238,7 @@ is_urh_ready (struct MHD_UpgradeResponseHandle *const urh)
  * @remark To be called only from thread that process
  * daemon's select()/poll()/etc.
  */
-static int
+static enum MHD_Result
 run_epoll_for_upgrade (struct MHD_Daemon *daemon)
 {
   struct epoll_event events[MAX_EVENTS];
@@ -4357,7 +4357,7 @@ static const char *const epoll_itc_marker = "itc_marker";
  * @param may_block #MHD_YES if blocking, #MHD_NO if non-blocking
  * @return #MHD_NO on serious errors, #MHD_YES on success
  */
-static int
+static enum MHD_Result
 MHD_epoll (struct MHD_Daemon *daemon,
            int may_block)
 {
@@ -4673,7 +4673,7 @@ MHD_epoll (struct MHD_Daemon *daemon,
  *         options for this call.
  * @ingroup event
  */
-int
+enum MHD_Result
 MHD_run (struct MHD_Daemon *daemon)
 {
   if ( (daemon->shutdown) ||
@@ -4967,7 +4967,7 @@ typedef void
  * @param ap the options
  * @return #MHD_YES on success, #MHD_NO on error
  */
-static int
+static enum MHD_Result
 parse_options_va (struct MHD_Daemon *daemon,
                   const struct sockaddr **servaddr,
                   va_list ap);
@@ -4981,13 +4981,13 @@ parse_options_va (struct MHD_Daemon *daemon,
  * @param ... the options
  * @return #MHD_YES on success, #MHD_NO on error
  */
-static int
+static enum MHD_Result
 parse_options (struct MHD_Daemon *daemon,
                const struct sockaddr **servaddr,
                ...)
 {
   va_list ap;
-  int ret;
+  enum MHD_Result ret;
 
   va_start (ap, servaddr);
   ret = parse_options_va (daemon,
@@ -5006,7 +5006,7 @@ parse_options (struct MHD_Daemon *daemon,
  * @param ap the options
  * @return #MHD_YES on success, #MHD_NO on error
  */
-static int
+static enum MHD_Result
 parse_options_va (struct MHD_Daemon *daemon,
                   const struct sockaddr **servaddr,
                   va_list ap)
@@ -5016,7 +5016,7 @@ parse_options_va (struct MHD_Daemon *daemon,
   unsigned int i;
   unsigned int uv;
 #ifdef HTTPS_SUPPORT
-  int ret;
+  enum MHD_Result ret;
   const char *pstr;
 #if GNUTLS_VERSION_MAJOR >= 3
   gnutls_certificate_retrieve_function2 *pgcrf;
@@ -5614,7 +5614,7 @@ setup_epoll_fd (struct MHD_Daemon *daemon)
  * @param daemon daemon to initialize for epoll()
  * @return #MHD_YES on success, #MHD_NO on failure
  */
-static int
+static enum MHD_Result
 setup_epoll_to_listen (struct MHD_Daemon *daemon)
 {
   struct epoll_event event;
@@ -7093,7 +7093,7 @@ MHD_get_version (void)
  * feature is not supported or feature is unknown.
  * @ingroup specialized
  */
-_MHD_EXTERN int
+enum MHD_Result
 MHD_is_feature_supported (enum MHD_FEATURE feature)
 {
   switch (feature)
diff --git a/src/microhttpd/digestauth.c b/src/microhttpd/digestauth.c
index e5c66d56..49ce4dce 100644
--- a/src/microhttpd/digestauth.c
+++ b/src/microhttpd/digestauth.c
@@ -521,7 +521,7 @@ lookup_sub_value (char *dest,
  * @param nc The nonce counter, zero to add the nonce to the array
  * @return #MHD_YES if successful, #MHD_NO if invalid (or we have no NC array)
  */
-static int
+static enum MHD_Result
 check_nonce_nc (struct MHD_Connection *connection,
                 const char *nonce,
                 uint64_t nc)
@@ -743,7 +743,7 @@ calculate_nonce (uint32_t nonce_time,
  * @return #MHD_YES if the key-value pair is in the headers,
  *         #MHD_NO if not
  */
-static int
+static enum MHD_Result
 test_header (struct MHD_Connection *connection,
              const char *key,
              size_t key_size,
@@ -790,14 +790,14 @@ test_header (struct MHD_Connection *connection,
  * @return #MHD_YES if the arguments match,
  *         #MHD_NO if not
  */
-static int
+static enum MHD_Result
 check_argument_match (struct MHD_Connection *connection,
                       const char *args)
 {
   struct MHD_HTTP_Header *pos;
   char *argb;
   unsigned int num_headers;
-  int ret;
+  enum MHD_Result ret;
 
   argb = strdup (args);
   if (NULL == argb)
@@ -1338,7 +1338,7 @@ MHD_digest_auth_check_digest (struct MHD_Connection 
*connection,
  * @return #MHD_YES on success, #MHD_NO otherwise
  * @ingroup authentication
  */
-int
+enum MHD_Result
 MHD_queue_auth_fail_response2 (struct MHD_Connection *connection,
                                const char *realm,
                                const char *opaque,
@@ -1461,7 +1461,7 @@ MHD_queue_auth_fail_response2 (struct MHD_Connection 
*connection,
  * @return #MHD_YES on success, #MHD_NO otherwise
  * @ingroup authentication
  */
-int
+enum MHD_Result
 MHD_queue_auth_fail_response (struct MHD_Connection *connection,
                               const char *realm,
                               const char *opaque,
diff --git a/src/microhttpd/internal.c b/src/microhttpd/internal.c
index b8d8f540..ba601fa0 100644
--- a/src/microhttpd/internal.c
+++ b/src/microhttpd/internal.c
@@ -184,7 +184,7 @@ MHD_http_unescape (char *val)
  *         #MHD_YES for success (parsing succeeded, @a cb always
  *                               returned #MHD_YES)
  */
-int
+enum MHD_Result
 MHD_parse_arguments_ (struct MHD_Connection *connection,
                       enum MHD_ValueKind kind,
                       char *args,
diff --git a/src/microhttpd/internal.h b/src/microhttpd/internal.h
index 96e24780..4cec6787 100644
--- a/src/microhttpd/internal.h
+++ b/src/microhttpd/internal.h
@@ -1910,7 +1910,7 @@ MHD_unescape_plus (char *arg);
  * @return #MHD_YES on success (continue to iterate)
  *         #MHD_NO to signal failure (and abort iteration)
  */
-typedef int
+typedef enum MHD_Result
 (*MHD_ArgumentIterator_)(struct MHD_Connection *connection,
                          const char *key,
                          size_t key_size,
@@ -1933,7 +1933,7 @@ typedef int
  *         #MHD_YES for success (parsing succeeded, @a cb always
  *                               returned #MHD_YES)
  */
-int
+enum MHD_Result
 MHD_parse_arguments_ (struct MHD_Connection *connection,
                       enum MHD_ValueKind kind,
                       char *args,
diff --git a/src/microhttpd/postprocessor.c b/src/microhttpd/postprocessor.c
index b7f6b108..0069147b 100644
--- a/src/microhttpd/postprocessor.c
+++ b/src/microhttpd/postprocessor.c
@@ -176,7 +176,7 @@ struct MHD_PostProcessor
    * Value data left over from previous iteration.
    */
   char xbuf[2];
-  
+
   /**
    * Size of our buffer for the key.
    */
@@ -220,9 +220,9 @@ struct MHD_PostProcessor
   /**
    * Set if we still need to run the unescape logic
    * on the key allocated at the end of this struct.
-   */ 
+   */
   bool must_unescape_key;
-  
+
   /**
    * State of the parser.
    */
@@ -478,7 +478,8 @@ post_process_urlencoded (struct MHD_PostProcessor *pp,
             (pp->state == PP_Callback) ) &&
           (pp->state != PP_Error) )
   {
-    switch (pp->state) {
+    switch (pp->state)
+    {
     case PP_Error:
       /* clearly impossible as per while loop invariant */
       abort ();
@@ -520,7 +521,8 @@ post_process_urlencoded (struct MHD_PostProcessor *pp,
     case PP_ProcessValue:
       if (NULL == start_value)
         start_value = &post_data[poff];
-      switch (post_data[poff]) {
+      switch (post_data[poff])
+      {
       case '=':
         /* case 'key==' */
         pp->state = PP_Error;
@@ -529,8 +531,8 @@ post_process_urlencoded (struct MHD_PostProcessor *pp,
         /* case 'value&' */
         end_value = &post_data[poff];
         poff++;
-        if ( pp->must_ikvi ||
-             (start_value != end_value) )
+        if (pp->must_ikvi ||
+            (start_value != end_value) )
         {
           pp->state = PP_Callback;
         }
@@ -538,7 +540,7 @@ post_process_urlencoded (struct MHD_PostProcessor *pp,
         {
           pp->buffer_pos = 0;
           pp->value_offset = 0;
-          pp->state = PP_Init; 
+          pp->state = PP_Init;
         }
         continue;
       case '\n':
@@ -576,7 +578,8 @@ post_process_urlencoded (struct MHD_PostProcessor *pp,
       }
       break; /* end PP_ProcessValue */
     case PP_Done:
-      switch (post_data[poff]) {
+      switch (post_data[poff])
+      {
       case '\n':
       case '\r':
         poff++;
@@ -632,9 +635,9 @@ post_process_urlencoded (struct MHD_PostProcessor *pp,
   }
 
   /* save remaining data for next iteration */
-  if (NULL != start_key) 
+  if (NULL != start_key)
   {
-    if (NULL == end_key) 
+    if (NULL == end_key)
       end_key = &post_data[poff];
     memcpy (&kbuf[pp->buffer_pos],
             start_key,
@@ -1366,7 +1369,7 @@ END:
  *         (out-of-memory, iterator aborted, parse error)
  * @ingroup request
  */
-int
+enum MHD_Result
 MHD_post_process (struct MHD_PostProcessor *pp,
                   const char *post_data,
                   size_t post_data_len)
@@ -1404,10 +1407,10 @@ MHD_post_process (struct MHD_PostProcessor *pp,
  *                value of this function
  * @ingroup request
  */
-int
+enum MHD_Result
 MHD_destroy_post_processor (struct MHD_PostProcessor *pp)
 {
-  int ret;
+  enum MHD_Result ret;
 
   if (NULL == pp)
     return MHD_YES;
diff --git a/src/microhttpd/response.c b/src/microhttpd/response.c
index 5adfdfa9..abedefcf 100644
--- a/src/microhttpd/response.c
+++ b/src/microhttpd/response.c
@@ -78,7 +78,7 @@
  * @param content value to add
  * @return #MHD_NO on error (i.e. invalid header or content format).
  */
-static int
+static enum MHD_Result
 add_response_entry (struct MHD_Response *response,
                     enum MHD_ValueKind kind,
                     const char *header,
@@ -129,7 +129,7 @@ add_response_entry (struct MHD_Response *response,
  * @return #MHD_NO on error (i.e. invalid header or content format).
  * @ingroup response
  */
-int
+enum MHD_Result
 MHD_add_response_header (struct MHD_Response *response,
                          const char *header,
                          const char *content)
@@ -173,7 +173,7 @@ MHD_add_response_header (struct MHD_Response *response,
  * @return #MHD_NO on error (i.e. invalid footer or content format).
  * @ingroup response
  */
-int
+enum MHD_Result
 MHD_add_response_footer (struct MHD_Response *response,
                          const char *footer,
                          const char *content)
@@ -194,7 +194,7 @@ MHD_add_response_footer (struct MHD_Response *response,
  * @return #MHD_NO on error (no such header known)
  * @ingroup response
  */
-int
+enum MHD_Result
 MHD_del_response_header (struct MHD_Response *response,
                          const char *header,
                          const char *content)
@@ -412,13 +412,13 @@ MHD_create_response_from_callback (uint64_t size,
  * @param ... #MHD_RO_END terminated list of options
  * @return #MHD_YES on success, #MHD_NO on error
  */
-int
+enum MHD_Result
 MHD_set_response_options (struct MHD_Response *response,
                           enum MHD_ResponseFlags flags,
                           ...)
 {
   va_list ap;
-  int ret;
+  enum MHD_Result ret;
   enum MHD_ResponseOptions ro;
 
   ret = MHD_YES;
@@ -788,7 +788,7 @@ MHD_create_response_from_buffer_with_free_callback (size_t 
size,
  * @param ... arguments to the action (depends on the action)
  * @return #MHD_NO on error, #MHD_YES on success
  */
-_MHD_EXTERN int
+_MHD_EXTERN enum MHD_Result
 MHD_upgrade_action (struct MHD_UpgradeResponseHandle *urh,
                     enum MHD_UpgradeAction action,
                     ...)
@@ -894,7 +894,7 @@ MHD_upgrade_action (struct MHD_UpgradeResponseHandle *urh,
  * @return #MHD_YES on success, #MHD_NO on failure (will cause
  *        connection to be closed)
  */
-int
+enum MHD_Result
 MHD_response_execute_upgrade_ (struct MHD_Response *response,
                                struct MHD_Connection *connection)
 {
diff --git a/src/microhttpd/response.h b/src/microhttpd/response.h
index 3f4717de..03448e56 100644
--- a/src/microhttpd/response.h
+++ b/src/microhttpd/response.h
@@ -49,7 +49,7 @@ MHD_increment_response_rc (struct MHD_Response *response);
  * @return #MHD_YES on success, #MHD_NO on failure (will cause
  *        connection to be closed)
  */
-int
+enum MHD_Result
 MHD_response_execute_upgrade_ (struct MHD_Response *response,
                                struct MHD_Connection *connection);
 
diff --git a/src/microhttpd/test_daemon.c b/src/microhttpd/test_daemon.c
index 4f600ef0..430c8e18 100644
--- a/src/microhttpd/test_daemon.c
+++ b/src/microhttpd/test_daemon.c
@@ -52,7 +52,7 @@ testStartError ()
 }
 
 
-static int
+static enum MHD_Result
 apc_nothing (void *cls,
              const struct sockaddr *addr,
              socklen_t addrlen)
@@ -63,7 +63,7 @@ apc_nothing (void *cls,
 }
 
 
-static int
+static enum MHD_Result
 apc_all (void *cls,
          const struct sockaddr *addr,
          socklen_t addrlen)
@@ -74,7 +74,7 @@ apc_all (void *cls,
 }
 
 
-static int
+static enum MHD_Result
 ahc_nothing (void *cls,
              struct MHD_Connection *connection,
              const char *url,
diff --git a/src/microhttpd/test_postprocessor.c 
b/src/microhttpd/test_postprocessor.c
index 2c37565c..e70171cc 100644
--- a/src/microhttpd/test_postprocessor.c
+++ b/src/microhttpd/test_postprocessor.c
@@ -92,7 +92,7 @@ mismatch (const char *a, const char *b)
 }
 
 
-static int
+static enum MHD_Result
 value_checker (void *cls,
                enum MHD_ValueKind kind,
                const char *key,
@@ -140,10 +140,10 @@ value_checker (void *cls,
     fprintf (stderr,
              "Wanted: `%s' `%s' `%s' `%s' `%s'\n",
              want[idx],
-             want[idx+1],
-             want[idx+2],
-             want[idx+3],
-             want[idx+4]);
+             want[idx + 1],
+             want[idx + 2],
+             want[idx + 3],
+             want[idx + 4]);
     fprintf (stderr,
              "Unexpected result: %d/%d/%d/%d/%d/%d/%d\n",
              (idx < 0),
@@ -155,7 +155,7 @@ value_checker (void *cls,
              (0 != memcmp (data, &want[idx + 4][off], size)));
     return MHD_NO;
   }
-  if ( ( (NULL == want[idx+4]) &&
+  if ( ( (NULL == want[idx + 4]) &&
          (0 == off + size) ) ||
        (off + size == strlen (want[idx + 4])) )
     *want_off = idx + 5;
diff --git a/src/microhttpd/test_postprocessor_amp.c 
b/src/microhttpd/test_postprocessor_amp.c
index 54936979..8692d443 100644
--- a/src/microhttpd/test_postprocessor_amp.c
+++ b/src/microhttpd/test_postprocessor_amp.c
@@ -7,7 +7,7 @@
 
 uint64_t num_errors;
 
-int
+enum MHD_Result
 check_post (void *cls, enum MHD_ValueKind kind, const char*key,
             const char*filename, const char*content_type,
             const char*content_encoding, const char*data,
diff --git a/src/microhttpd/test_postprocessor_large.c 
b/src/microhttpd/test_postprocessor_large.c
index 0e2a10d2..678de808 100644
--- a/src/microhttpd/test_postprocessor_large.c
+++ b/src/microhttpd/test_postprocessor_large.c
@@ -33,7 +33,7 @@
 #include <unistd.h>
 #endif
 
-static int
+static enum MHD_Result
 value_checker (void *cls,
                enum MHD_ValueKind kind,
                const char *key,
diff --git a/src/microhttpd/test_upgrade.c b/src/microhttpd/test_upgrade.c
index 7c76d221..fd9c2537 100644
--- a/src/microhttpd/test_upgrade.c
+++ b/src/microhttpd/test_upgrade.c
@@ -843,7 +843,7 @@ upgrade_cb (void *cls,
  *         #MHD_NO if the socket must be closed due to a serious
  *         error while handling the request
  */
-static int
+static enum MHD_Result
 ahc_upgrade (void *cls,
              struct MHD_Connection *connection,
              const char *url,
@@ -854,7 +854,7 @@ ahc_upgrade (void *cls,
              void **con_cls)
 {
   struct MHD_Response *resp;
-  int ret;
+  enum MHD_Result ret;
   (void) cls;
   (void) url;
   (void) method;                        /* Unused. Silent compiler warning. */
diff --git a/src/microhttpd/test_upgrade_large.c 
b/src/microhttpd/test_upgrade_large.c
index 89eba4b7..43c04b7f 100644
--- a/src/microhttpd/test_upgrade_large.c
+++ b/src/microhttpd/test_upgrade_large.c
@@ -867,7 +867,7 @@ upgrade_cb (void *cls,
  *         #MHD_NO if the socket must be closed due to a serious
  *         error while handling the request
  */
-static int
+static enum MHD_Result
 ahc_upgrade (void *cls,
              struct MHD_Connection *connection,
              const char *url,
@@ -878,7 +878,7 @@ ahc_upgrade (void *cls,
              void **con_cls)
 {
   struct MHD_Response *resp;
-  int ret;
+  enum MHD_Result ret;
   (void) cls;
   (void) url;
   (void) method;                        /* Unused. Silent compiler warning. */
diff --git a/src/testcurl/https/test_empty_response.c 
b/src/testcurl/https/test_empty_response.c
index cfd75e8f..8e1ef1a8 100644
--- a/src/testcurl/https/test_empty_response.c
+++ b/src/testcurl/https/test_empty_response.c
@@ -38,7 +38,7 @@ extern const char srv_self_signed_cert_pem[];
 
 static int oneone;
 
-static int
+static enum MHD_Result
 ahc_echo (void *cls,
           struct MHD_Connection *connection,
           const char *url,
@@ -48,7 +48,7 @@ ahc_echo (void *cls,
           void **unused)
 {
   struct MHD_Response *response;
-  int ret;
+  enum MHD_Result ret;
   (void) cls; (void) url; (void) method; (void) version;               /* 
Unused. Silent compiler warning. */
   (void) upload_data; (void) upload_data_size; (void) unused;        /* 
Unused. Silent compiler warning. */
 
diff --git a/src/testcurl/https/test_https_get.c 
b/src/testcurl/https/test_https_get.c
index c012fa46..b8de81a9 100644
--- a/src/testcurl/https/test_https_get.c
+++ b/src/testcurl/https/test_https_get.c
@@ -91,7 +91,7 @@ test_secure_get (FILE *test_fd,
 }
 
 
-static int
+static enum MHD_Result
 ahc_empty (void *cls,
            struct MHD_Connection *connection,
            const char *url,
@@ -103,7 +103,7 @@ ahc_empty (void *cls,
 {
   static int ptr;
   struct MHD_Response *response;
-  int ret;
+  enum MHD_Result ret;
   (void) cls;
   (void) url;
   (void) url;
diff --git a/src/testcurl/https/test_https_get_select.c 
b/src/testcurl/https/test_https_get_select.c
index e5bd73f5..d42f4463 100644
--- a/src/testcurl/https/test_https_get_select.c
+++ b/src/testcurl/https/test_https_get_select.c
@@ -39,7 +39,7 @@ extern const char srv_self_signed_cert_pem[];
 
 static int oneone;
 
-static int
+static enum MHD_Result
 ahc_echo (void *cls,
           struct MHD_Connection *connection,
           const char *url,
@@ -51,7 +51,7 @@ ahc_echo (void *cls,
   static int ptr;
   const char *me = cls;
   struct MHD_Response *response;
-  int ret;
+  enum MHD_Result ret;
   (void) version; (void) upload_data; (void) upload_data_size;       /* 
Unused. Silent compiler warning. */
 
   if (0 != strcmp (me, method))
diff --git a/src/testcurl/https/test_https_session_info.c 
b/src/testcurl/https/test_https_session_info.c
index e961edc4..f8b37cff 100644
--- a/src/testcurl/https/test_https_session_info.c
+++ b/src/testcurl/https/test_https_session_info.c
@@ -41,14 +41,15 @@ struct MHD_Daemon *d;
  * HTTP access handler call back
  * used to query negotiated security parameters
  */
-static int
+static enum MHD_Result
 query_session_ahc (void *cls, struct MHD_Connection *connection,
                    const char *url, const char *method,
                    const char *version, const char *upload_data,
                    size_t *upload_data_size, void **ptr)
 {
   struct MHD_Response *response;
-  int ret;
+  enum MHD_Result ret;
+  int gret;
   (void) cls; (void) url; (void) method; (void) version;       /* Unused. 
Silent compiler warning. */
   (void) upload_data; (void) upload_data_size;             /* Unused. Silent 
compiler warning. */
 
@@ -59,11 +60,11 @@ query_session_ahc (void *cls, struct MHD_Connection 
*connection,
   }
 
   if (GNUTLS_TLS1_1 !=
-      (ret = MHD_get_connection_info
-               (connection,
-               MHD_CONNECTION_INFO_PROTOCOL)->protocol))
+      (gret = MHD_get_connection_info
+                (connection,
+                MHD_CONNECTION_INFO_PROTOCOL)->protocol))
   {
-    if (GNUTLS_TLS1_2 == ret)
+    if (GNUTLS_TLS1_2 == gret)
     {
       /* as usual, TLS implementations sometimes don't
          quite do what was asked, just mildly complain... */
@@ -76,8 +77,8 @@ query_session_ahc (void *cls, struct MHD_Connection 
*connection,
       fprintf (stderr,
                "Error: requested protocol mismatch (wanted %d, got %d)\n",
                GNUTLS_TLS1_1,
-               ret);
-      return -1;
+               gret);
+      return MHD_NO;
     }
   }
 
diff --git a/src/testcurl/https/tls_test_common.c 
b/src/testcurl/https/tls_test_common.c
index c0c6a4f8..1d24c701 100644
--- a/src/testcurl/https/tls_test_common.c
+++ b/src/testcurl/https/tls_test_common.c
@@ -176,7 +176,7 @@ copyBuffer (void *ptr,
 /**
  *  HTTP access handler call back
  */
-int
+enum MHD_Result
 http_ahc (void *cls,
           struct MHD_Connection *connection,
           const char *url,
@@ -188,7 +188,7 @@ http_ahc (void *cls,
 {
   static int aptr;
   struct MHD_Response *response;
-  int ret;
+  enum MHD_Result ret;
   (void) cls; (void) url; (void) version;            /* Unused. Silent 
compiler warning. */
   (void) upload_data; (void) upload_data_size;     /* Unused. Silent compiler 
warning. */
 
@@ -211,7 +211,7 @@ http_ahc (void *cls,
 
 
 /* HTTP access handler call back */
-int
+enum MHD_Result
 http_dummy_ahc (void *cls,
                 struct MHD_Connection *connection,
                 const char *url,
diff --git a/src/testcurl/https/tls_test_common.h 
b/src/testcurl/https/tls_test_common.h
index 36f5ffa5..fd2a47b1 100644
--- a/src/testcurl/https/tls_test_common.h
+++ b/src/testcurl/https/tls_test_common.h
@@ -95,12 +95,12 @@ print_test_result (int test_outcome, char *test_name);
 size_t
 copyBuffer (void *ptr, size_t size, size_t nmemb, void *ctx);
 
-int
+enum MHD_Result
 http_ahc (void *cls, struct MHD_Connection *connection,
           const char *url, const char *method, const char *upload_data,
           const char *version, size_t *upload_data_size, void **ptr);
 
-int
+enum MHD_Result
 http_dummy_ahc (void *cls, struct MHD_Connection *connection,
                 const char *url, const char *method, const char *upload_data,
                 const char *version, size_t *upload_data_size,
diff --git a/src/testcurl/perf_get.c b/src/testcurl/perf_get.c
index 53992b17..eb33ea0c 100644
--- a/src/testcurl/perf_get.c
+++ b/src/testcurl/perf_get.c
@@ -151,7 +151,7 @@ copyBuffer (void *ptr,
 }
 
 
-static int
+static enum MHD_Result
 ahc_echo (void *cls,
           struct MHD_Connection *connection,
           const char *url,
@@ -162,7 +162,7 @@ ahc_echo (void *cls,
 {
   static int ptr;
   const char *me = cls;
-  int ret;
+  enum MHD_Result ret;
   (void) url; (void) version;                      /* Unused. Silent compiler 
warning. */
   (void) upload_data; (void) upload_data_size;     /* Unused. Silent compiler 
warning. */
 
diff --git a/src/testcurl/perf_get_concurrent.c 
b/src/testcurl/perf_get_concurrent.c
index 12c57dae..0471143c 100644
--- a/src/testcurl/perf_get_concurrent.c
+++ b/src/testcurl/perf_get_concurrent.c
@@ -146,7 +146,7 @@ copyBuffer (void *ptr,
 }
 
 
-static int
+static enum MHD_Result
 ahc_echo (void *cls,
           struct MHD_Connection *connection,
           const char *url,
@@ -157,7 +157,7 @@ ahc_echo (void *cls,
 {
   static int ptr;
   const char *me = cls;
-  int ret;
+  enum MHD_Result ret;
   (void) url; (void) version;                      /* Unused. Silent compiler 
warning. */
   (void) upload_data; (void) upload_data_size;     /* Unused. Silent compiler 
warning. */
 
diff --git a/src/testcurl/test_callback.c b/src/testcurl/test_callback.c
index 2e2be470..d9dfecef 100644
--- a/src/testcurl/test_callback.c
+++ b/src/testcurl/test_callback.c
@@ -58,7 +58,7 @@ called_twice (void *cls, uint64_t pos, char *buf, size_t max)
 }
 
 
-static int
+static enum MHD_Result
 callback (void *cls,
           struct MHD_Connection *connection,
           const char *url,
@@ -70,7 +70,7 @@ callback (void *cls,
 {
   struct callback_closure *cbc = calloc (1, sizeof(struct callback_closure));
   struct MHD_Response *r;
-  int ret;
+  enum MHD_Result ret;
 
   (void) cls;
   (void) url;                          /* Unused. Silent compiler warning. */
diff --git a/src/testcurl/test_concurrent_stop.c 
b/src/testcurl/test_concurrent_stop.c
index 750fddc8..6716f491 100644
--- a/src/testcurl/test_concurrent_stop.c
+++ b/src/testcurl/test_concurrent_stop.c
@@ -134,7 +134,7 @@ copyBuffer (void *ptr,
 }
 
 
-static int
+static enum MHD_Result
 ahc_echo (void *cls,
           struct MHD_Connection *connection,
           const char *url,
@@ -146,7 +146,7 @@ ahc_echo (void *cls,
 {
   static int ptr;
   const char *me = cls;
-  int ret;
+  enum MHD_Result ret;
   (void) url; (void) version;                      /* Unused. Silent compiler 
warning. */
   (void) upload_data; (void) upload_data_size;     /* Unused. Silent compiler 
warning. */
 
diff --git a/src/testcurl/test_delete.c b/src/testcurl/test_delete.c
index 8854cde7..ae62311b 100644
--- a/src/testcurl/test_delete.c
+++ b/src/testcurl/test_delete.c
@@ -81,7 +81,7 @@ copyBuffer (void *ptr, size_t size, size_t nmemb, void *ctx)
 }
 
 
-static int
+static enum MHD_Result
 ahc_echo (void *cls,
           struct MHD_Connection *connection,
           const char *url,
@@ -92,7 +92,7 @@ ahc_echo (void *cls,
 {
   int *done = cls;
   struct MHD_Response *response;
-  int ret;
+  enum MHD_Result ret;
   (void) version; (void) unused;   /* Unused. Silent compiler warning. */
 
   if (0 != strcasecmp ("DELETE", method))
diff --git a/src/testcurl/test_digestauth.c b/src/testcurl/test_digestauth.c
index 4de006b7..9b33eb9b 100644
--- a/src/testcurl/test_digestauth.c
+++ b/src/testcurl/test_digestauth.c
@@ -76,7 +76,7 @@ copyBuffer (void *ptr,
 }
 
 
-static int
+static enum MHD_Result
 ahc_echo (void *cls,
           struct MHD_Connection *connection,
           const char *url,
@@ -90,7 +90,7 @@ ahc_echo (void *cls,
   char *username;
   const char *password = "testpass";
   const char *realm = "address@hidden";
-  int ret;
+  enum MHD_Result ret;
   (void) cls; (void) url;                          /* Unused. Silent compiler 
warning. */
   (void) method; (void) version; (void) upload_data; /* Unused. Silent 
compiler warning. */
   (void) upload_data_size; (void) unused;         /* Unused. Silent compiler 
warning. */
diff --git a/src/testcurl/test_digestauth_sha256.c 
b/src/testcurl/test_digestauth_sha256.c
index 3482d14d..ffeabd0c 100644
--- a/src/testcurl/test_digestauth_sha256.c
+++ b/src/testcurl/test_digestauth_sha256.c
@@ -77,7 +77,7 @@ copyBuffer (void *ptr,
 }
 
 
-static int
+static enum MHD_Result
 ahc_echo (void *cls,
           struct MHD_Connection *connection,
           const char *url,
@@ -91,7 +91,7 @@ ahc_echo (void *cls,
   char *username;
   const char *password = "testpass";
   const char *realm = "address@hidden";
-  int ret;
+  enum MHD_Result ret;
   (void) cls; (void) url;                          /* Unused. Silent compiler 
warning. */
   (void) method; (void) version; (void) upload_data; /* Unused. Silent 
compiler warning. */
   (void) upload_data_size; (void) unused;         /* Unused. Silent compiler 
warning. */
diff --git a/src/testcurl/test_digestauth_with_arguments.c 
b/src/testcurl/test_digestauth_with_arguments.c
index f1927d1a..70d5f644 100644
--- a/src/testcurl/test_digestauth_with_arguments.c
+++ b/src/testcurl/test_digestauth_with_arguments.c
@@ -71,7 +71,7 @@ copyBuffer (void *ptr, size_t size, size_t nmemb, void *ctx)
 }
 
 
-static int
+static enum MHD_Result
 ahc_echo (void *cls,
           struct MHD_Connection *connection,
           const char *url,
@@ -84,7 +84,7 @@ ahc_echo (void *cls,
   char *username;
   const char *password = "testpass";
   const char *realm = "address@hidden";
-  int ret;
+  enum MHD_Result ret;
   (void) cls; (void) url;                          /* Unused. Silent compiler 
warning. */
   (void) method; (void) version; (void) upload_data; /* Unused. Silent 
compiler warning. */
   (void) upload_data_size; (void) unused;         /* Unused. Silent compiler 
warning. */
diff --git a/src/testcurl/test_get.c b/src/testcurl/test_get.c
index 3ab05d9a..91efdefd 100644
--- a/src/testcurl/test_get.c
+++ b/src/testcurl/test_get.c
@@ -98,7 +98,7 @@ log_cb (void *cls,
 }
 
 
-static int
+static enum MHD_Result
 ahc_echo (void *cls,
           struct MHD_Connection *connection,
           const char *url,
@@ -110,7 +110,7 @@ ahc_echo (void *cls,
   static int ptr;
   const char *me = cls;
   struct MHD_Response *response;
-  int ret;
+  enum MHD_Result ret;
   const char *v;
   (void) version;
   (void) upload_data;
@@ -714,7 +714,7 @@ testStopRace (int poll_flag)
 }
 
 
-static int
+static enum MHD_Result
 ahc_empty (void *cls,
            struct MHD_Connection *connection,
            const char *url,
@@ -726,7 +726,7 @@ ahc_empty (void *cls,
 {
   static int ptr;
   struct MHD_Response *response;
-  int ret;
+  enum MHD_Result ret;
   (void) cls;
   (void) url;
   (void) url;
diff --git a/src/testcurl/test_get_chunked.c b/src/testcurl/test_get_chunked.c
index 7be1db60..aa60e2f8 100644
--- a/src/testcurl/test_get_chunked.c
+++ b/src/testcurl/test_get_chunked.c
@@ -106,7 +106,7 @@ crcf (void *ptr)
 }
 
 
-static int
+static enum MHD_Result
 ahc_echo (void *cls,
           struct MHD_Connection *connection,
           const char *url,
@@ -118,7 +118,7 @@ ahc_echo (void *cls,
   const char *me = cls;
   struct MHD_Response *response;
   struct MHD_Response **responseptr;
-  int ret;
+  enum MHD_Result ret;
 
   (void) url;
   (void) version;                      /* Unused. Silent compiler warning. */
diff --git a/src/testcurl/test_get_response_cleanup.c 
b/src/testcurl/test_get_response_cleanup.c
index 14c2f240..026fd254 100644
--- a/src/testcurl/test_get_response_cleanup.c
+++ b/src/testcurl/test_get_response_cleanup.c
@@ -116,7 +116,7 @@ push_free_callback (void *cls)
 }
 
 
-static int
+static enum MHD_Result
 ahc_echo (void *cls,
           struct MHD_Connection *connection,
           const char *url,
@@ -128,7 +128,7 @@ ahc_echo (void *cls,
   static int ptr;
   const char *me = cls;
   struct MHD_Response *response;
-  int ret;
+  enum MHD_Result ret;
   (void) url; (void) version;                      /* Unused. Silent compiler 
warning. */
   (void) upload_data; (void) upload_data_size;     /* Unused. Silent compiler 
warning. */
 
diff --git a/src/testcurl/test_get_sendfile.c b/src/testcurl/test_get_sendfile.c
index ad102f0b..0095731e 100644
--- a/src/testcurl/test_get_sendfile.c
+++ b/src/testcurl/test_get_sendfile.c
@@ -75,7 +75,7 @@ copyBuffer (void *ptr, size_t size, size_t nmemb, void *ctx)
 }
 
 
-static int
+static enum MHD_Result
 ahc_echo (void *cls,
           struct MHD_Connection *connection,
           const char *url,
@@ -87,7 +87,7 @@ ahc_echo (void *cls,
   static int ptr;
   const char *me = cls;
   struct MHD_Response *response;
-  int ret;
+  enum MHD_Result ret;
   int fd;
   (void) url; (void) version;                      /* Unused. Silent compiler 
warning. */
   (void) upload_data; (void) upload_data_size;     /* Unused. Silent compiler 
warning. */
@@ -490,7 +490,7 @@ testExternalGet ()
   if (cbc.pos != strlen (TESTSTR))
   {
     fprintf (stderr,
-             "Got %.*s instead of %S!\n",
+             "Got %.*s instead of %s!\n",
              (int) cbc.pos,
              cbc.buf,
              TESTSTR);
diff --git a/src/testcurl/test_iplimit.c b/src/testcurl/test_iplimit.c
index 60570886..3b61f827 100644
--- a/src/testcurl/test_iplimit.c
+++ b/src/testcurl/test_iplimit.c
@@ -74,7 +74,7 @@ copyBuffer (void *ptr, size_t size, size_t nmemb, void *ctx)
 }
 
 
-static int
+static enum MHD_Result
 ahc_echo (void *cls,
           struct MHD_Connection *connection,
           const char *url,
@@ -86,7 +86,7 @@ ahc_echo (void *cls,
   static int ptr;
   const char *me = cls;
   struct MHD_Response *response;
-  int ret;
+  enum MHD_Result ret;
   (void) version; (void) upload_data; (void) upload_data_size;       /* 
Unused. Silent compiler warning. */
 
   if (0 != strcmp (me, method))
diff --git a/src/testcurl/test_large_put.c b/src/testcurl/test_large_put.c
index b52246ef..d93942e4 100644
--- a/src/testcurl/test_large_put.c
+++ b/src/testcurl/test_large_put.c
@@ -118,7 +118,7 @@ copyBuffer (void *ptr, size_t size, size_t nmemb, void *ctx)
 }
 
 
-static int
+static enum MHD_Result
 ahc_echo (void *cls,
           struct MHD_Connection *connection,
           const char *url,
@@ -129,7 +129,7 @@ ahc_echo (void *cls,
 {
   int *done = cls;
   struct MHD_Response *response;
-  int ret;
+  enum MHD_Result ret;
   static size_t processed;
   (void) version;        /* Unused. Silent compiler warning. */
 
diff --git a/src/testcurl/test_long_header.c b/src/testcurl/test_long_header.c
index 17d8904b..54030c21 100644
--- a/src/testcurl/test_long_header.c
+++ b/src/testcurl/test_long_header.c
@@ -46,7 +46,7 @@
 
 static int oneone;
 
-static int
+static enum MHD_Result
 apc_all (void *cls, const struct sockaddr *addr, socklen_t addrlen)
 {
   (void) cls; (void) addr; (void) addrlen;   /* Unused. Silent compiler 
warning. */
@@ -69,7 +69,7 @@ copyBuffer (void *ptr, size_t size, size_t nmemb, void *ctx)
 }
 
 
-static int
+static enum MHD_Result
 ahc_echo (void *cls,
           struct MHD_Connection *connection,
           const char *url,
@@ -80,7 +80,7 @@ ahc_echo (void *cls,
 {
   const char *me = cls;
   struct MHD_Response *response;
-  int ret;
+  enum MHD_Result ret;
   (void) version; (void) upload_data;      /* Unused. Silent compiler warning. 
*/
   (void) upload_data_size; (void) unused;  /* Unused. Silent compiler warning. 
*/
 
diff --git a/src/testcurl/test_parse_cookies.c 
b/src/testcurl/test_parse_cookies.c
index d4c291ea..8a786cc2 100644
--- a/src/testcurl/test_parse_cookies.c
+++ b/src/testcurl/test_parse_cookies.c
@@ -59,7 +59,7 @@ copyBuffer (void *ptr, size_t size, size_t nmemb, void *ctx)
 }
 
 
-static int
+static enum MHD_Result
 ahc_echo (void *cls,
           struct MHD_Connection *connection,
           const char *url,
@@ -71,7 +71,7 @@ ahc_echo (void *cls,
   static int ptr;
   const char *me = cls;
   struct MHD_Response *response;
-  int ret;
+  enum MHD_Result ret;
   const char *hdr;
   (void) version; (void) upload_data; (void) upload_data_size;       /* 
Unused. Silent compiler warning. */
 
diff --git a/src/testcurl/test_patch.c b/src/testcurl/test_patch.c
index 86327b0d..6be3ab30 100644
--- a/src/testcurl/test_patch.c
+++ b/src/testcurl/test_patch.c
@@ -81,7 +81,7 @@ copyBuffer (void *ptr, size_t size, size_t nmemb, void *ctx)
 }
 
 
-static int
+static enum MHD_Result
 ahc_echo (void *cls,
           struct MHD_Connection *connection,
           const char *url,
@@ -92,7 +92,7 @@ ahc_echo (void *cls,
 {
   int *done = cls;
   struct MHD_Response *response;
-  int ret;
+  enum MHD_Result ret;
   (void) version; (void) unused;   /* Unused. Silent compiler warning. */
 
   if (0 != strcasecmp ("PATCH", method))
diff --git a/src/testcurl/test_post.c b/src/testcurl/test_post.c
index 97c9bcc9..675f8db6 100644
--- a/src/testcurl/test_post.c
+++ b/src/testcurl/test_post.c
@@ -97,7 +97,7 @@ copyBuffer (void *ptr, size_t size, size_t nmemb, void *ctx)
  * in that it fails to support incremental processing.
  * (to be fixed in the future)
  */
-static int
+static enum MHD_Result
 post_iterator (void *cls,
                enum MHD_ValueKind kind,
                const char *key,
@@ -120,7 +120,7 @@ post_iterator (void *cls,
 }
 
 
-static int
+static enum MHD_Result
 ahc_echo (void *cls,
           struct MHD_Connection *connection,
           const char *url,
@@ -132,7 +132,7 @@ ahc_echo (void *cls,
   static int eok;
   struct MHD_Response *response;
   struct MHD_PostProcessor *pp;
-  int ret;
+  enum MHD_Result ret;
   (void) cls; (void) version;      /* Unused. Silent compiler warning. */
 
   if (0 != strcasecmp ("POST", method))
@@ -562,7 +562,7 @@ testExternalPost ()
 }
 
 
-static int
+static enum MHD_Result
 ahc_cancel (void *cls,
             struct MHD_Connection *connection,
             const char *url,
@@ -572,7 +572,7 @@ ahc_cancel (void *cls,
             void **unused)
 {
   struct MHD_Response *response;
-  int ret;
+  enum MHD_Result ret;
   (void) cls; (void) url; (void) version;            /* Unused. Silent 
compiler warning. */
   (void) upload_data; (void) upload_data_size;     /* Unused. Silent compiler 
warning. */
 
diff --git a/src/testcurl/test_post_loop.c b/src/testcurl/test_post_loop.c
index 38f9de6e..0eaf2730 100644
--- a/src/testcurl/test_post_loop.c
+++ b/src/testcurl/test_post_loop.c
@@ -72,7 +72,7 @@ copyBuffer (void *ptr, size_t size, size_t nmemb, void *ctx)
 }
 
 
-static int
+static enum MHD_Result
 ahc_echo (void *cls,
           struct MHD_Connection *connection,
           const char *url,
@@ -83,7 +83,7 @@ ahc_echo (void *cls,
 {
   static int marker;
   struct MHD_Response *response;
-  int ret;
+  enum MHD_Result ret;
   (void) cls; (void) url; (void) version;            /* Unused. Silent 
compiler warning. */
   (void) upload_data; (void) upload_data_size;     /* Unused. Silent compiler 
warning. */
 
diff --git a/src/testcurl/test_postform.c b/src/testcurl/test_postform.c
index 25e6d0e4..18a0fc62 100644
--- a/src/testcurl/test_postform.c
+++ b/src/testcurl/test_postform.c
@@ -93,7 +93,7 @@ copyBuffer (void *ptr, size_t size, size_t nmemb, void *ctx)
  * in that it fails to support incremental processing.
  * (to be fixed in the future)
  */
-static int
+static enum MHD_Result
 post_iterator (void *cls,
                enum MHD_ValueKind kind,
                const char *key,
@@ -119,7 +119,7 @@ post_iterator (void *cls,
 }
 
 
-static int
+static enum MHD_Result
 ahc_echo (void *cls,
           struct MHD_Connection *connection,
           const char *url,
@@ -131,7 +131,7 @@ ahc_echo (void *cls,
   static int eok;
   struct MHD_Response *response;
   struct MHD_PostProcessor *pp;
-  int ret;
+  enum MHD_Result ret;
   (void) cls; (void) version;      /* Unused. Silent compiler warning. */
 
   if (0 != strcmp ("POST", method))
diff --git a/src/testcurl/test_process_arguments.c 
b/src/testcurl/test_process_arguments.c
index dc50396d..f7e03531 100644
--- a/src/testcurl/test_process_arguments.c
+++ b/src/testcurl/test_process_arguments.c
@@ -60,7 +60,7 @@ copyBuffer (void *ptr, size_t size, size_t nmemb, void *ctx)
 }
 
 
-static int
+static enum MHD_Result
 ahc_echo (void *cls,
           struct MHD_Connection *connection,
           const char *url,
@@ -72,7 +72,7 @@ ahc_echo (void *cls,
   static int ptr;
   const char *me = cls;
   struct MHD_Response *response;
-  int ret;
+  enum MHD_Result ret;
   const char *hdr;
   (void) version; (void) upload_data; (void) upload_data_size;       /* 
Unused. Silent compiler warning. */
 
diff --git a/src/testcurl/test_process_headers.c 
b/src/testcurl/test_process_headers.c
index 34200082..5784f5b7 100644
--- a/src/testcurl/test_process_headers.c
+++ b/src/testcurl/test_process_headers.c
@@ -66,7 +66,7 @@ copyBuffer (void *ptr, size_t size, size_t nmemb, void *ctx)
 }
 
 
-static int
+static enum MHD_Result
 kv_cb (void *cls, enum MHD_ValueKind kind, const char *key, const char *value)
 {
   if ((0 == strcmp (key, MHD_HTTP_HEADER_HOST)) &&
@@ -80,7 +80,7 @@ kv_cb (void *cls, enum MHD_ValueKind kind, const char *key, 
const char *value)
 }
 
 
-static int
+static enum MHD_Result
 ahc_echo (void *cls,
           struct MHD_Connection *connection,
           const char *url,
@@ -92,7 +92,7 @@ ahc_echo (void *cls,
   static int ptr;
   const char *me = cls;
   struct MHD_Response *response;
-  int ret;
+  enum MHD_Result ret;
   const char *hdr;
   (void) version; (void) upload_data; (void) upload_data_size;       /* 
Unused. Silent compiler warning. */
 
diff --git a/src/testcurl/test_put.c b/src/testcurl/test_put.c
index 2326310a..c582a418 100644
--- a/src/testcurl/test_put.c
+++ b/src/testcurl/test_put.c
@@ -81,7 +81,7 @@ copyBuffer (void *ptr, size_t size, size_t nmemb, void *ctx)
 }
 
 
-static int
+static enum MHD_Result
 ahc_echo (void *cls,
           struct MHD_Connection *connection,
           const char *url,
@@ -92,7 +92,7 @@ ahc_echo (void *cls,
 {
   int *done = cls;
   struct MHD_Response *response;
-  int ret;
+  enum MHD_Result ret;
   (void) version; (void) unused;   /* Unused. Silent compiler warning. */
 
   if (0 != strcasecmp ("PUT", method))
diff --git a/src/testcurl/test_put_chunked.c b/src/testcurl/test_put_chunked.c
index 0824b286..e393523d 100644
--- a/src/testcurl/test_put_chunked.c
+++ b/src/testcurl/test_put_chunked.c
@@ -81,7 +81,7 @@ copyBuffer (void *ptr, size_t size, size_t nmemb, void *ctx)
 }
 
 
-static int
+static enum MHD_Result
 ahc_echo (void *cls,
           struct MHD_Connection *connection,
           const char *url,
@@ -92,7 +92,7 @@ ahc_echo (void *cls,
 {
   int *done = cls;
   struct MHD_Response *response;
-  int ret;
+  enum MHD_Result ret;
   int have;
   (void) version; (void) unused;   /* Unused. Silent compiler warning. */
 
diff --git a/src/testcurl/test_quiesce.c b/src/testcurl/test_quiesce.c
index 8a79a3c4..ac0ade30 100644
--- a/src/testcurl/test_quiesce.c
+++ b/src/testcurl/test_quiesce.c
@@ -70,7 +70,7 @@ copyBuffer (void *ptr, size_t size, size_t nmemb, void *ctx)
 }
 
 
-static int
+static enum MHD_Result
 ahc_echo (void *cls,
           struct MHD_Connection *connection,
           const char *url,
@@ -82,7 +82,7 @@ ahc_echo (void *cls,
   static int ptr;
   const char *me = cls;
   struct MHD_Response *response;
-  int ret;
+  enum MHD_Result ret;
   (void) version; (void) upload_data; (void) upload_data_size;       /* 
Unused. Silent compiler warning. */
 
   if (0 != strcmp (me, method))
diff --git a/src/testcurl/test_quiesce_stream.c 
b/src/testcurl/test_quiesce_stream.c
index cb1e71cb..5a3e601e 100644
--- a/src/testcurl/test_quiesce_stream.c
+++ b/src/testcurl/test_quiesce_stream.c
@@ -132,7 +132,7 @@ free_crc_data (void *crc_data)
 }
 
 
-static int
+static enum MHD_Result
 http_AccessHandlerCallback (void *cls,
                             struct MHD_Connection *connection,
                             const char *url,
@@ -142,7 +142,7 @@ http_AccessHandlerCallback (void *cls,
                             size_t *upload_data_size,
                             void **con_cls)
 {
-  int ret;
+  enum MHD_Result ret;
   (void) cls; (void) url;                          /* Unused. Silent compiler 
warning. */
   (void) method; (void) version; (void) upload_data; /* Unused. Silent 
compiler warning. */
   (void) upload_data_size;                       /* Unused. Silent compiler 
warning. */
diff --git a/src/testcurl/test_termination.c b/src/testcurl/test_termination.c
index 17940020..5541ae30 100644
--- a/src/testcurl/test_termination.c
+++ b/src/testcurl/test_termination.c
@@ -47,7 +47,7 @@
 #include <windows.h>
 #endif
 
-static int
+static enum MHD_Result
 connection_handler (void *cls,
                     struct MHD_Connection *connection,
                     const char *url,
@@ -76,7 +76,7 @@ connection_handler (void *cls,
   struct MHD_Response *response =
     MHD_create_response_from_buffer (strlen ("Response"), "Response",
                                      MHD_RESPMEM_PERSISTENT);
-  int ret = MHD_queue_response (connection, MHD_HTTP_OK, response);
+  enum MHD_Result ret = MHD_queue_response (connection, MHD_HTTP_OK, response);
   MHD_destroy_response (response);
 
   return ret;
diff --git a/src/testcurl/test_timeout.c b/src/testcurl/test_timeout.c
index db1c1e6a..018195f4 100644
--- a/src/testcurl/test_timeout.c
+++ b/src/testcurl/test_timeout.c
@@ -121,7 +121,7 @@ copyBuffer (void *ptr, size_t size, size_t nmemb, void *ctx)
 }
 
 
-static int
+static enum MHD_Result
 ahc_echo (void *cls,
           struct MHD_Connection *connection,
           const char *url,
@@ -132,7 +132,7 @@ ahc_echo (void *cls,
 {
   int *done = cls;
   struct MHD_Response *response;
-  int ret;
+  enum MHD_Result ret;
   (void) version; (void) unused;   /* Unused. Silent compiler warning. */
 
   if (0 != strcmp ("PUT", method))
diff --git a/src/testcurl/test_urlparse.c b/src/testcurl/test_urlparse.c
index e8770330..d089ab22 100644
--- a/src/testcurl/test_urlparse.c
+++ b/src/testcurl/test_urlparse.c
@@ -69,7 +69,7 @@ copyBuffer (void *ptr, size_t size, size_t nmemb, void *ctx)
 }
 
 
-static int
+static enum MHD_Result
 test_values (void *cls,
              enum MHD_ValueKind kind,
              const char *key,
@@ -89,7 +89,7 @@ test_values (void *cls,
 }
 
 
-static int
+static enum MHD_Result
 ahc_echo (void *cls,
           struct MHD_Connection *connection,
           const char *url,
@@ -101,7 +101,7 @@ ahc_echo (void *cls,
   static int ptr;
   const char *me = cls;
   struct MHD_Response *response;
-  int ret;
+  enum MHD_Result ret;
   (void) version; (void) upload_data; (void) upload_data_size;       /* 
Unused. Silent compiler warning. */
 
   if (0 != strcmp (me, method))
diff --git a/src/testzzuf/test_get.c b/src/testzzuf/test_get.c
index 83d92ab3..9ef0d4f7 100644
--- a/src/testzzuf/test_get.c
+++ b/src/testzzuf/test_get.c
@@ -60,7 +60,7 @@ copyBuffer (void *ptr, size_t size, size_t nmemb, void *ctx)
 }
 
 
-static int
+static enum MHD_Result
 ahc_echo (void *cls,
           struct MHD_Connection *connection,
           const char *url,
@@ -72,7 +72,7 @@ ahc_echo (void *cls,
   static int ptr;
   const char *me = cls;
   struct MHD_Response *response;
-  int ret;
+  enum MHD_Result ret;
   (void) version; (void) upload_data; (void) upload_data_size;       /* 
Unused. Silent compiler warning. */
 
   if (0 != strcmp (me, method))
diff --git a/src/testzzuf/test_get_chunked.c b/src/testzzuf/test_get_chunked.c
index 8ad7dd6b..9a6536c0 100644
--- a/src/testzzuf/test_get_chunked.c
+++ b/src/testzzuf/test_get_chunked.c
@@ -89,7 +89,7 @@ crcf (void *ptr)
 }
 
 
-static int
+static enum MHD_Result
 ahc_echo (void *cls,
           struct MHD_Connection *connection,
           const char *url,
@@ -101,7 +101,7 @@ ahc_echo (void *cls,
   const char *me = cls;
   struct MHD_Response *response;
   struct MHD_Response **responseptr;
-  int ret;
+  enum MHD_Result ret;
 
   (void) url;
   (void) version;                      /* Unused. Silent compiler warning. */
diff --git a/src/testzzuf/test_long_header.c b/src/testzzuf/test_long_header.c
index 6595ad4e..add99234 100644
--- a/src/testzzuf/test_long_header.c
+++ b/src/testzzuf/test_long_header.c
@@ -47,7 +47,7 @@
 
 static int oneone;
 
-static int
+static enum MHD_Result
 apc_all (void *cls, const struct sockaddr *addr, socklen_t addrlen)
 {
   (void) cls; (void) addr; (void) addrlen;   /* Unused. Silent compiler 
warning. */
@@ -70,7 +70,7 @@ copyBuffer (void *ptr, size_t size, size_t nmemb, void *ctx)
 }
 
 
-static int
+static enum MHD_Result
 ahc_echo (void *cls,
           struct MHD_Connection *connection,
           const char *url,
@@ -81,7 +81,7 @@ ahc_echo (void *cls,
 {
   const char *me = cls;
   struct MHD_Response *response;
-  int ret;
+  enum MHD_Result ret;
   (void) version; (void) upload_data;      /* Unused. Silent compiler warning. 
*/
   (void) upload_data_size; (void) unused;  /* Unused. Silent compiler warning. 
*/
 
@@ -128,6 +128,11 @@ testLongUrlGet ()
 
     c = curl_easy_init ();
     url = malloc (VERY_LONG);
+    if (NULL == url)
+    {
+      zzuf_socat_stop ();
+      return 1;
+    }
     memset (url, 'a', VERY_LONG);
     url[VERY_LONG - 1] = '\0';
     memcpy (url, "http://127.0.0.1:11081/";,
@@ -189,6 +194,12 @@ testLongHeaderGet ()
     fprintf (stderr, ".");
     c = curl_easy_init ();
     url = malloc (VERY_LONG);
+    if (NULL == url)
+    {
+      zzuf_socat_stop ();
+      curl_easy_cleanup (c);
+      return 16;
+    }
     memset (url, 'a', VERY_LONG);
     url[VERY_LONG - 1] = '\0';
     url[VERY_LONG / 2] = ':';
diff --git a/src/testzzuf/test_post.c b/src/testzzuf/test_post.c
index 637423c8..e3d8512c 100644
--- a/src/testzzuf/test_post.c
+++ b/src/testzzuf/test_post.c
@@ -84,7 +84,7 @@ copyBuffer (void *ptr, size_t size, size_t nmemb, void *ctx)
  * in that it fails to support incremental processing.
  * (to be fixed in the future)
  */
-static int
+static enum MHD_Result
 post_iterator (void *cls,
                enum MHD_ValueKind kind,
                const char *key,
@@ -107,7 +107,7 @@ post_iterator (void *cls,
 }
 
 
-static int
+static enum MHD_Result
 ahc_echo (void *cls,
           struct MHD_Connection *connection,
           const char *url,
@@ -119,7 +119,7 @@ ahc_echo (void *cls,
   static int eok;
   struct MHD_Response *response;
   struct MHD_PostProcessor *pp;
-  int ret;
+  enum MHD_Result ret;
   (void) cls; (void) version;      /* Unused. Silent compiler warning. */
 
   if (0 != strcmp ("POST", method))
diff --git a/src/testzzuf/test_post_form.c b/src/testzzuf/test_post_form.c
index a253b96d..f994ab24 100644
--- a/src/testzzuf/test_post_form.c
+++ b/src/testzzuf/test_post_form.c
@@ -82,7 +82,7 @@ copyBuffer (void *ptr, size_t size, size_t nmemb, void *ctx)
  * in that it fails to support incremental processing.
  * (to be fixed in the future)
  */
-static int
+static enum MHD_Result
 post_iterator (void *cls,
                enum MHD_ValueKind kind,
                const char *key,
@@ -110,7 +110,7 @@ post_iterator (void *cls,
 }
 
 
-static int
+static enum MHD_Result
 ahc_echo (void *cls,
           struct MHD_Connection *connection,
           const char *url,
@@ -122,7 +122,7 @@ ahc_echo (void *cls,
   static int eok;
   struct MHD_Response *response;
   struct MHD_PostProcessor *pp;
-  int ret;
+  enum MHD_Result ret;
   (void) cls; (void) version;      /* Unused. Silent compiler warning. */
 
   if (0 != strcmp ("POST", method))
diff --git a/src/testzzuf/test_put.c b/src/testzzuf/test_put.c
index 2c79c759..4658d0d4 100644
--- a/src/testzzuf/test_put.c
+++ b/src/testzzuf/test_put.c
@@ -76,7 +76,7 @@ copyBuffer (void *ptr, size_t size, size_t nmemb, void *ctx)
 }
 
 
-static int
+static enum MHD_Result
 ahc_echo (void *cls,
           struct MHD_Connection *connection,
           const char *url,
@@ -87,7 +87,7 @@ ahc_echo (void *cls,
 {
   int *done = cls;
   struct MHD_Response *response;
-  int ret;
+  enum MHD_Result ret;
   (void) version; (void) unused;   /* Unused. Silent compiler warning. */
 
   if (0 != strcmp ("PUT", method))
diff --git a/src/testzzuf/test_put_chunked.c b/src/testzzuf/test_put_chunked.c
index 29108008..35196843 100644
--- a/src/testzzuf/test_put_chunked.c
+++ b/src/testzzuf/test_put_chunked.c
@@ -76,7 +76,7 @@ copyBuffer (void *ptr, size_t size, size_t nmemb, void *ctx)
 }
 
 
-static int
+static enum MHD_Result
 ahc_echo (void *cls,
           struct MHD_Connection *connection,
           const char *url,
@@ -87,7 +87,7 @@ ahc_echo (void *cls,
 {
   int *done = cls;
   struct MHD_Response *response;
-  int ret;
+  enum MHD_Result ret;
   int have;
   (void) version; (void) unused;   /* Unused. Silent compiler warning. */
 
diff --git a/src/testzzuf/test_put_large.c b/src/testzzuf/test_put_large.c
index 56b076c5..abda22cb 100644
--- a/src/testzzuf/test_put_large.c
+++ b/src/testzzuf/test_put_large.c
@@ -84,7 +84,7 @@ copyBuffer (void *ptr, size_t size, size_t nmemb, void *ctx)
 }
 
 
-static int
+static enum MHD_Result
 ahc_echo (void *cls,
           struct MHD_Connection *connection,
           const char *url,
@@ -95,7 +95,7 @@ ahc_echo (void *cls,
 {
   int *done = cls;
   struct MHD_Response *response;
-  int ret;
+  enum MHD_Result ret;
   (void) version; (void) unused; /* Unused. Silent compiler warning. */
 
   if (0 != strcmp ("PUT", method))
@@ -376,6 +376,8 @@ main (int argc, char *const *argv)
   if (0 != curl_global_init (CURL_GLOBAL_WIN32))
     return 2;
   put_buffer = malloc (PUT_SIZE);
+  if (0 == put_buffer)
+    return 77;
   memset (put_buffer, 1, PUT_SIZE);
   if (MHD_YES == MHD_is_feature_supported (MHD_FEATURE_THREADS))
   {

-- 
To stop receiving notification emails like this one, please contact
address@hidden.



reply via email to

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