gnunet-svn
[Top][All Lists]
Advanced

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

[GNUnet-SVN] [libmicrohttpd] GNU libmicrohttpd branch master updated. 0f


From: gitolite
Subject: [GNUnet-SVN] [libmicrohttpd] GNU libmicrohttpd branch master updated. 0f46a6b98b111c0d9b7c1384d68b6d89ce0775fb
Date: Wed, 2 Nov 2016 13:54:54 +0100 (CET)

The branch, master has been updated
       via  0f46a6b98b111c0d9b7c1384d68b6d89ce0775fb (commit)
       via  82ebcd2dbfb0a836383927c64a7d525e3941924a (commit)
       via  7cad8fc50e5ad30f6d3e38b20f2cbb2d8d7a0aa0 (commit)
      from  cbd93766919531e3986e5a9c838df61e696a07f0 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit 0f46a6b98b111c0d9b7c1384d68b6d89ce0775fb
Author: Evgeny Grin (Karlson2k) <address@hidden>
Date:   Wed Nov 2 13:30:20 2016 +0300

    Fixed build without HTTPS support

commit 82ebcd2dbfb0a836383927c64a7d525e3941924a
Author: Evgeny Grin (Karlson2k) <address@hidden>
Date:   Wed Nov 2 13:15:38 2016 +0300

    MHD_start_daemon_va(): fixed 'ifdef' ordering

commit 7cad8fc50e5ad30f6d3e38b20f2cbb2d8d7a0aa0
Author: Evgeny Grin (Karlson2k) <address@hidden>
Date:   Wed Nov 2 13:03:44 2016 +0300

    Build-time configuration: undef HTTPS_SUPPORT if TLS is disabled. Improved 
code
    readability, fixed build without HTTPS.

-----------------------------------------------------------------------

Summary of changes:
 configure.ac                      |   4 +-
 src/microhttpd/connection.c       |  10 +-
 src/microhttpd/connection.h       |   4 +
 src/microhttpd/connection_https.h |   2 +-
 src/microhttpd/daemon.c           | 204 +++++++++++++++++++-------------------
 src/microhttpd/internal.h         |  18 ++--
 src/microhttpd/response.c         |  12 ++-
 src/testcurl/curl_version_check.c |  12 +--
 8 files changed, 140 insertions(+), 126 deletions(-)

diff --git a/configure.ac b/configure.ac
index a18f0b1..71e6800 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1080,7 +1080,7 @@ AC_ARG_ENABLE([https],
 if test "x$enable_https" != "xno"
 then
   AS_IF([test "x$have_gnutls" = "xyes" && test "x$have_gcrypt" = "xyes"], [
-          AC_DEFINE([HTTPS_SUPPORT],[1],[include HTTPS support])
+          AC_DEFINE([[HTTPS_SUPPORT]],[[1]],[Define to 1 if libmicrohttpd is 
compiled with HTTPS support.])
           enable_https=yes
           MSG_HTTPS="yes (using libgnutls and libgcrypt)"
           MHD_LIB_CPPFLAGS="$MHD_LIB_CPPFLAGS $LIBGCRYPT_CFLAGS 
$GNUTLS_CPPFLAGS"
@@ -1101,12 +1101,10 @@ then
                 [test "x$have_gcrypt" = "xyes"], [crypt_missing="libgnutls"],
                                                  [crypt_missing="libgrypt and 
libgnutls"])
           AS_IF([[test "x$enable_https" = "xyes" ]], [AC_MSG_ERROR([[HTTPS 
support cannot be enabled without $crypt_missing.]])])
-          AC_DEFINE([HTTPS_SUPPORT],[0],[no libgcrypt or libgnutls])
           enable_https=no
           MSG_HTTPS="no (lacking $crypt_missing)"
         ])
 else
-  AC_DEFINE([HTTPS_SUPPORT],[0],[disable HTTPS support])
   MSG_HTTPS="no (disabled)"
 fi
 AC_MSG_RESULT([$MSG_HTTPS])
diff --git a/src/microhttpd/connection.c b/src/microhttpd/connection.c
index 95b60f1..01780f9 100644
--- a/src/microhttpd/connection.c
+++ b/src/microhttpd/connection.c
@@ -561,6 +561,7 @@ MHD_connection_close_ (struct MHD_Connection *connection,
 }
 
 
+#ifdef HTTPS_SUPPORT
 /**
  * Stop TLS forwarding on upgraded connection and
  * reflect remote disconnect state to socketpair.
@@ -616,6 +617,7 @@ MHD_connection_finish_forward_ (struct MHD_Connection 
*connection)
    * connection's final cleanup.
    */
 }
+#endif /* HTTPS_SUPPORT */
 
 
 /**
@@ -1364,14 +1366,14 @@ MHD_connection_update_event_loop_info (struct 
MHD_Connection *connection)
 #endif
       switch (connection->state)
         {
-#if HTTPS_SUPPORT
+#ifdef HTTPS_SUPPORT
        case MHD_TLS_CONNECTION_INIT:
          if (0 == gnutls_record_get_direction (connection->tls_session))
             connection->event_loop_info = MHD_EVENT_LOOP_INFO_READ;
          else
             connection->event_loop_info = MHD_EVENT_LOOP_INFO_WRITE;
          break;
-#endif
+#endif /* HTTPS_SUPPORT */
         case MHD_CONNECTION_INIT:
         case MHD_CONNECTION_URL_RECEIVED:
         case MHD_CONNECTION_HEADER_PART_RECEIVED:
@@ -3324,7 +3326,7 @@ MHD_get_connection_info (struct MHD_Connection 
*connection,
 {
   switch (info_type)
     {
-#if HTTPS_SUPPORT
+#ifdef HTTPS_SUPPORT
     case MHD_CONNECTION_INFO_CIPHER_ALGO:
       if (NULL == connection->tls_session)
        return NULL;
@@ -3339,7 +3341,7 @@ MHD_get_connection_info (struct MHD_Connection 
*connection,
       if (NULL == connection->tls_session)
        return NULL;
       return (const union MHD_ConnectionInfo *) &connection->tls_session;
-#endif
+#endif /* HTTPS_SUPPORT */
     case MHD_CONNECTION_INFO_CLIENT_ADDRESS:
       return (const union MHD_ConnectionInfo *) &connection->addr;
     case MHD_CONNECTION_INFO_DAEMON:
diff --git a/src/microhttpd/connection.h b/src/microhttpd/connection.h
index ecbe237..ffbc5b8 100644
--- a/src/microhttpd/connection.h
+++ b/src/microhttpd/connection.h
@@ -108,6 +108,7 @@ MHD_connection_close_ (struct MHD_Connection *connection,
                        enum MHD_RequestTerminationCode termination_code);
 
 
+#ifdef HTTPS_SUPPORT
 /**
  * Stop TLS forwarding on upgraded connection and
  * reflect remote disconnect state to socketpair.
@@ -115,6 +116,9 @@ MHD_connection_close_ (struct MHD_Connection *connection,
  */
 void
 MHD_connection_finish_forward_ (struct MHD_Connection *connection);
+#else  /* ! HTTPS_SUPPORT */
+#define MHD_connection_finish_forward_(conn) (void)conn
+#endif /* ! HTTPS_SUPPORT */
 
 
 #ifdef EPOLL_SUPPORT
diff --git a/src/microhttpd/connection_https.h 
b/src/microhttpd/connection_https.h
index 23ae685..6bb218b 100644
--- a/src/microhttpd/connection_https.h
+++ b/src/microhttpd/connection_https.h
@@ -28,7 +28,7 @@
 
 #include "internal.h"
 
-#if HTTPS_SUPPORT
+#ifdef HTTPS_SUPPORT
 /**
  * Set connection callback function to be used through out
  * the processing of this secure connection.
diff --git a/src/microhttpd/daemon.c b/src/microhttpd/daemon.c
index c388e6a..beddac8 100644
--- a/src/microhttpd/daemon.c
+++ b/src/microhttpd/daemon.c
@@ -49,10 +49,10 @@
 #include "tsearch.h"
 #endif
 
-#if HTTPS_SUPPORT
+#ifdef HTTPS_SUPPORT
 #include "connection_https.h"
 #include <gcrypt.h>
-#endif
+#endif /* HTTPS_SUPPORT */
 
 #ifdef LINUX
 #include <sys/sendfile.h>
@@ -415,7 +415,7 @@ MHD_ip_limit_del (struct MHD_Daemon *daemon,
 }
 
 
-#if HTTPS_SUPPORT
+#ifdef HTTPS_SUPPORT
 /**
  * Callback for receiving data from the socket.
  *
@@ -622,7 +622,7 @@ MHD_TLS_init (struct MHD_Daemon *daemon)
       return -1;
     }
 }
-#endif
+#endif /* HTTPS_SUPPORT */
 
 
 #undef MHD_get_fdset
@@ -662,7 +662,7 @@ MHD_get_fdset (struct MHD_Daemon *daemon,
 }
 
 
-#if HTTPS_SUPPORT
+#ifdef HTTPS_SUPPORT
 /**
  * Obtain the select() file descriptor sets for the
  * given @a urh.
@@ -743,7 +743,7 @@ urh_from_fdset (struct MHD_UpgradeResponseHandle *urh,
       FD_ISSET (mhd_sckt, ws))
     urh->mhd.celi |= MHD_EPOLL_STATE_WRITE_READY;
 }
-#endif
+#endif /* HTTPS_SUPPORT */
 
 
 /**
@@ -844,7 +844,7 @@ MHD_get_fdset2 (struct MHD_Daemon *daemon,
          break;
        }
     }
-#if HTTPS_SUPPORT
+#ifdef HTTPS_SUPPORT
   {
     struct MHD_UpgradeResponseHandle *urh;
 
@@ -867,7 +867,7 @@ MHD_get_fdset2 (struct MHD_Daemon *daemon,
               _("Maximum socket in select set: %d\n"),
               *max_fd);
 #endif
-#endif
+#endif /* HTTPS_SUPPORT */
   return result;
 }
 
@@ -895,10 +895,10 @@ call_handlers (struct MHD_Connection *con,
   int had_response_before_idle;
   int ret;
 
-#if HTTPS_SUPPORT
+#ifdef HTTPS_SUPPORT
   if (MHD_YES == con->tls_read_ready)
     read_ready = MHD_YES;
-#endif
+#endif /* HTTPS_SUPPORT */
   if (read_ready)
     con->read_handler (con);
   if (write_ready)
@@ -939,6 +939,7 @@ MHD_cleanup_upgraded_connection_ (struct MHD_Connection 
*connection)
 {
   struct MHD_UpgradeResponseHandle *urh = connection->urh;
 
+#ifdef HTTPS_SUPPORT
   /* Signal remote client the end of TLS connection by
    * gracefully closing TLS session. */
   if (0 != (connection->daemon->options & MHD_USE_TLS))
@@ -950,6 +951,7 @@ MHD_cleanup_upgraded_connection_ (struct MHD_Connection 
*connection)
 
   if (MHD_INVALID_SOCKET != urh->app.socket)
     MHD_socket_close_chk_ (urh->app.socket);
+#endif /* HTTPS_SUPPORT */
 
   connection->urh = NULL;
   if (NULL != urh)
@@ -957,7 +959,7 @@ MHD_cleanup_upgraded_connection_ (struct MHD_Connection 
*connection)
 }
 
 
-#if HTTPS_SUPPORT
+#ifdef HTTPS_SUPPORT
 /**
  * Performs bi-directional forwarding on upgraded HTTPS connections
  * based on the readyness state stored in the @a urh handle.
@@ -1216,7 +1218,7 @@ process_urh (struct MHD_UpgradeResponseHandle *urh)
       urh->mhd.celi &= ~MHD_EPOLL_STATE_READ_READY;
     }
 }
-#endif
+#endif /* HTTPS_SUPPORT */
 
 
 /**
@@ -1230,8 +1232,8 @@ process_urh (struct MHD_UpgradeResponseHandle *urh)
 static void
 thread_main_connection_upgrade (struct MHD_Connection *con)
 {
+#ifdef HTTPS_SUPPORT
   struct MHD_UpgradeResponseHandle *urh = con->urh;
-#if HTTPS_SUPPORT
   struct MHD_Daemon *daemon = con->daemon;
 
   /* Here, we need to bi-directionally forward
@@ -1359,7 +1361,7 @@ thread_main_connection_upgrade (struct MHD_Connection 
*con)
   /* end POLL */
 #endif
   /* end HTTPS */
-#endif
+#endif /* HTTPS_SUPPORT */
   /* TLS forwarding was finished. Cleanup socketpair. */
   MHD_connection_finish_forward_ (con);
   /* Do not set 'urh->clean_ready' yet as 'urh' will be used
@@ -1474,7 +1476,7 @@ thread_main_handle_connection (void *data)
         }
 
       tvp = NULL;
-#if HTTPS_SUPPORT
+#ifdef HTTPS_SUPPORT
       if (MHD_YES == con->tls_read_ready)
        {
          /* do not block (more data may be inside of TLS buffers waiting for 
us) */
@@ -1482,7 +1484,7 @@ thread_main_handle_connection (void *data)
          tv.tv_usec = 0;
          tvp = &tv;
        }
-#endif
+#endif /* HTTPS_SUPPORT */
       if ( (NULL == tvp) &&
            (timeout > 0) )
        {
@@ -2128,7 +2130,7 @@ internal_add_connection (struct MHD_Daemon *daemon,
         }
     }
 
-#if HTTPS_SUPPORT
+#ifdef HTTPS_SUPPORT
   if (0 != (daemon->options & MHD_USE_TLS))
     {
       connection->recv_cls = &recv_tls_adapter;
@@ -2176,7 +2178,7 @@ internal_add_connection (struct MHD_Daemon *daemon,
          gnutls_certificate_server_set_request (connection->tls_session,
                                                 GNUTLS_CERT_REQUEST);
     }
-#endif
+#endif /* HTTPS_SUPPORT */
 
   if (0 != (daemon->options & MHD_USE_THREAD_PER_CONNECTION))
   {
@@ -2742,10 +2744,10 @@ MHD_cleanup_connections (struct MHD_Daemon *daemon)
       if (NULL != pos->urh)
         MHD_cleanup_upgraded_connection_ (pos);
       MHD_pool_destroy (pos->pool);
-#if HTTPS_SUPPORT
+#ifdef HTTPS_SUPPORT
       if (NULL != pos->tls_session)
        gnutls_deinit (pos->tls_session);
-#endif
+#endif /* HTTPS_SUPPORT */
       daemon->connections--;
       daemon->at_limit = MHD_NO;
 
@@ -2839,7 +2841,7 @@ MHD_get_timeout (struct MHD_Daemon *daemon,
       return MHD_NO;
     }
 
-#if HTTPS_SUPPORT
+#ifdef HTTPS_SUPPORT
   if (0 != daemon->num_tls_read_ready)
     {
       /* if there is any TLS connection with data ready for
@@ -2847,7 +2849,7 @@ MHD_get_timeout (struct MHD_Daemon *daemon,
       *timeout = 0;
       return MHD_YES;
     }
-#endif
+#endif /* HTTPS_SUPPORT */
 
   have_timeout = MHD_NO;
   earliest_deadline = 0; /* avoid compiler warnings */
@@ -2858,11 +2860,11 @@ MHD_get_timeout (struct MHD_Daemon *daemon,
          if ( (! have_timeout) ||
               (earliest_deadline > pos->last_activity + 
pos->connection_timeout) )
            earliest_deadline = pos->last_activity + pos->connection_timeout;
-#if HTTPS_SUPPORT
+#ifdef HTTPS_SUPPORT
          if (  (0 != (daemon->options & MHD_USE_TLS)) &&
                (0 != gnutls_record_check_pending (pos->tls_session)) )
            earliest_deadline = 0;
-#endif
+#endif /* HTTPS_SUPPORT */
          have_timeout = MHD_YES;
        }
     }
@@ -2874,11 +2876,11 @@ MHD_get_timeout (struct MHD_Daemon *daemon,
       if ( (! have_timeout) ||
           (earliest_deadline > pos->last_activity + pos->connection_timeout) )
        earliest_deadline = pos->last_activity + pos->connection_timeout;
-#if HTTPS_SUPPORT
+#ifdef HTTPS_SUPPORT
       if (  (0 != (daemon->options & MHD_USE_TLS)) &&
            (0 != gnutls_record_check_pending (pos->tls_session)) )
        earliest_deadline = 0;
-#endif
+#endif /* HTTPS_SUPPORT */
       have_timeout = MHD_YES;
     }
 
@@ -2927,10 +2929,10 @@ MHD_run_from_select (struct MHD_Daemon *daemon,
   MHD_socket ds;
   struct MHD_Connection *pos;
   struct MHD_Connection *next;
-#if HTTPS_SUPPORT
+#ifdef HTTPS_SUPPORT
   struct MHD_UpgradeResponseHandle *urh;
   struct MHD_UpgradeResponseHandle *urhn;
-#endif
+#endif /* HTTPS_SUPPORT */
   unsigned int mask = MHD_USE_SUSPEND_RESUME | MHD_USE_EPOLL_INTERNALLY |
     MHD_USE_SELECT_INTERNALLY | MHD_USE_POLL_INTERNALLY | 
MHD_USE_THREAD_PER_CONNECTION;
 
@@ -2987,7 +2989,7 @@ MHD_run_from_select (struct MHD_Daemon *daemon,
     }
 
   /* handle upgraded HTTPS connections */
-#if HTTPS_SUPPORT
+#ifdef HTTPS_SUPPORT
   for (urh = daemon->urh_head; NULL != urh; urh = urhn)
     {
       urhn = urh->next;
@@ -3009,7 +3011,7 @@ MHD_run_from_select (struct MHD_Daemon *daemon,
           MHD_resume_connection(urh->connection);
         }
     }
-#endif
+#endif /* HTTPS_SUPPORT */
   MHD_cleanup_connections (daemon);
   return MHD_YES;
 }
@@ -3193,10 +3195,10 @@ MHD_poll_all (struct MHD_Daemon *daemon,
   unsigned int num_connections;
   struct MHD_Connection *pos;
   struct MHD_Connection *next;
-#if HTTPS_SUPPORT
+#ifdef HTTPS_SUPPORT
   struct MHD_UpgradeResponseHandle *urh;
   struct MHD_UpgradeResponseHandle *urhn;
-#endif
+#endif /* HTTPS_SUPPORT */
 
   if ( (MHD_USE_SUSPEND_RESUME == (daemon->options & MHD_USE_SUSPEND_RESUME)) 
&&
        (MHD_YES == resume_suspended_connections (daemon)) )
@@ -3206,10 +3208,10 @@ MHD_poll_all (struct MHD_Daemon *daemon,
   num_connections = 0;
   for (pos = daemon->connections_head; NULL != pos; pos = pos->next)
     num_connections++;
-#if HTTPS_SUPPORT
+#ifdef HTTPS_SUPPORT
   for (urh = daemon->urh_head; NULL != urh; urh = urh->next)
     num_connections += 2;
-#endif
+#endif /* HTTPS_SUPPORT */
   {
     MHD_UNSIGNED_LONG_LONG ltimeout;
     unsigned int i;
@@ -3287,7 +3289,7 @@ MHD_poll_all (struct MHD_Daemon *daemon,
          }
        i++;
       }
-#if HTTPS_SUPPORT
+#ifdef HTTPS_SUPPORT
     for (urh = daemon->urh_head; NULL != urh; urh = urh->next)
       {
         p[poll_server+i].fd = urh->connection->socket_fd;
@@ -3303,7 +3305,7 @@ MHD_poll_all (struct MHD_Daemon *daemon,
           p[poll_server+i].events |= POLLOUT;
         i++;
       }
-#endif
+#endif /* HTTPS_SUPPORT */
     if (0 == poll_server + num_connections)
       {
         free(p);
@@ -3356,7 +3358,7 @@ MHD_poll_all (struct MHD_Daemon *daemon,
                        MHD_NO);
         i++;
       }
-#if HTTPS_SUPPORT
+#ifdef HTTPS_SUPPORT
     for (urh = daemon->urh_head; NULL != urh; urh = urhn)
       {
         if (i >= num_connections)
@@ -3401,7 +3403,7 @@ MHD_poll_all (struct MHD_Daemon *daemon,
             MHD_resume_connection(urh->connection);
           }
       }
-#endif
+#endif /* HTTPS_SUPPORT */
     /* handle 'listen' FD */
     if ( (-1 != poll_listen) &&
         (0 != (p[poll_listen].revents & POLLIN)) )
@@ -3526,7 +3528,7 @@ MHD_poll (struct MHD_Daemon *daemon,
 #define MAX_EVENTS 128
 
 
-#if HTTPS_SUPPORT
+#ifdef HTTPS_SUPPORT
 
 /**
  * Do epoll()-based processing for TLS connections that have been
@@ -3600,7 +3602,7 @@ run_epoll_for_upgrade (struct MHD_Daemon *daemon)
     }
   return MHD_YES;
 }
-#endif
+#endif /* HTTPS_SUPPORT */
 
 
 /**
@@ -3615,9 +3617,9 @@ static int
 MHD_epoll (struct MHD_Daemon *daemon,
           int may_block)
 {
-#if HTTPS_SUPPORT
+#ifdef HTTPS_SUPPORT
   static const char *upgrade_marker = "upgrade_ptr";
-#endif
+#endif /* HTTPS_SUPPORT */
   struct MHD_Connection *pos;
   struct MHD_Connection *next;
   struct epoll_event events[MAX_EVENTS];
@@ -3627,9 +3629,9 @@ MHD_epoll (struct MHD_Daemon *daemon,
   int num_events;
   unsigned int i;
   unsigned int series_length;
-#if HTTPS_SUPPORT
+#ifdef HTTPS_SUPPORT
    _MHD_bool run_upgraded = 0;
-#endif
+#endif /* HTTPS_SUPPORT */
 
   if (-1 == daemon->epoll_fd)
     return MHD_NO; /* we're down! */
@@ -3656,7 +3658,7 @@ MHD_epoll (struct MHD_Daemon *daemon,
        }
       daemon->listen_socket_in_epoll = MHD_YES;
     }
-#if HTTPS_SUPPORT
+#ifdef HTTPS_SUPPORT
   if ( (MHD_NO == daemon->upgrade_fd_in_epoll) &&
        (-1 != daemon->epoll_upgrade_fd) )
     {
@@ -3676,7 +3678,7 @@ MHD_epoll (struct MHD_Daemon *daemon,
        }
       daemon->upgrade_fd_in_epoll = MHD_YES;
     }
-#endif
+#endif /* HTTPS_SUPPORT */
   if ( ( (MHD_YES == daemon->listen_socket_in_epoll) &&
          (daemon->connections == daemon->connection_limit) ) ||
        (MHD_YES == daemon->at_limit) )
@@ -3736,7 +3738,7 @@ MHD_epoll (struct MHD_Daemon *daemon,
              that this event is not about a normal connection. */
          if (NULL == events[i].data.ptr)
            continue; /* shutdown signal! */
-#if HTTPS_SUPPORT
+#ifdef HTTPS_SUPPORT
           if (upgrade_marker == events[i].data.ptr)
             {
               /* activity on an upgraded connection, we process
@@ -3744,7 +3746,7 @@ MHD_epoll (struct MHD_Daemon *daemon,
               run_upgraded = !0;
               continue;
             }
-#endif
+#endif /* HTTPS_SUPPORT */
           /* UGH: we're storing pointers and fds in the same union
              here; incredibly ugly and somewhat risky, even though a
              pointer with the same numeric value as the itc.fd[0] can
@@ -3803,8 +3805,10 @@ MHD_epoll (struct MHD_Daemon *daemon,
         }
     }
 
+#ifdef HTTPS_SUPPORT
   if (run_upgraded)
     run_epoll_for_upgrade (daemon);
+#endif /* HTTPS_SUPPORT */
 
   /* we handle resumes here because we may have ready connections
      that will not be placed into the epoll list immediately. */
@@ -4190,10 +4194,10 @@ parse_options_va (struct MHD_Daemon *daemon,
   enum MHD_OPTION opt;
   struct MHD_OptionItem *oa;
   unsigned int i;
-#if HTTPS_SUPPORT
+#ifdef HTTPS_SUPPORT
   int ret;
   const char *pstr;
-#endif
+#endif /* HTTPS_SUPPORT */
 
   while (MHD_OPTION_END != (opt = (enum MHD_OPTION) va_arg (ap, int)))
     {
@@ -4254,7 +4258,7 @@ parse_options_va (struct MHD_Daemon *daemon,
              return MHD_NO;
            }
           break;
-#if HTTPS_SUPPORT
+#ifdef HTTPS_SUPPORT
         case MHD_OPTION_HTTPS_MEM_KEY:
          if (0 != (daemon->options & MHD_USE_TLS))
            daemon->https_mem_key = va_arg (ap,
@@ -4376,7 +4380,7 @@ parse_options_va (struct MHD_Daemon *daemon,
                                             
gnutls_certificate_retrieve_function2 *);
           break;
 #endif
-#endif
+#endif /* HTTPS_SUPPORT */
 #ifdef DAUTH_SUPPORT
        case MHD_OPTION_DIGEST_AUTH_RANDOM:
          daemon->digest_auth_rand_size = va_arg (ap,
@@ -4603,14 +4607,14 @@ setup_epoll_to_listen (struct MHD_Daemon *daemon)
   daemon->epoll_fd = setup_epoll_fd (daemon);
   if (-1 == daemon->epoll_fd)
     return MHD_NO;
-#if HTTPS_SUPPORT
+#ifdef HTTPS_SUPPORT
   if (0 != (MHD_ALLOW_UPGRADE & daemon->options))
     {
        daemon->epoll_upgrade_fd = setup_epoll_fd (daemon);
        if (MHD_INVALID_SOCKET == daemon->epoll_upgrade_fd)
          return MHD_NO;
     }
-#endif
+#endif /* HTTPS_SUPPORT */
   if (MHD_INVALID_SOCKET == daemon->socket_fd)
     return MHD_YES; /* non-listening daemon */
   event.events = EPOLLIN;
@@ -4697,10 +4701,10 @@ MHD_start_daemon_va (unsigned int flags,
   if (0 != (flags & MHD_USE_POLL))
     return NULL;
 #endif
-#if ! HTTPS_SUPPORT
+#ifndef HTTPS_SUPPORT
   if (0 != (flags & MHD_USE_TLS))
     return NULL;
-#endif
+#endif /* ! HTTPS_SUPPORT */
 #ifndef TCP_FASTOPEN
   if (0 != (flags & MHD_USE_TCP_FASTOPEN))
     return NULL;
@@ -4714,19 +4718,19 @@ MHD_start_daemon_va (unsigned int flags,
           sizeof (struct MHD_Daemon));
 #ifdef EPOLL_SUPPORT
   daemon->epoll_fd = -1;
-#if HTTPS_SUPPORT
+#ifdef HTTPS_SUPPORT
   daemon->epoll_upgrade_fd = -1;
-#endif
+#endif /* HTTPS_SUPPORT */
 #endif
   /* try to open listen socket */
-#if HTTPS_SUPPORT
+#ifdef HTTPS_SUPPORT
   if (0 != (flags & MHD_USE_TLS))
     {
       gnutls_priority_init (&daemon->priority_cache,
                            "NORMAL",
                            NULL);
     }
-#endif
+#endif /* HTTPS_SUPPORT */
   daemon->socket_fd = MHD_INVALID_SOCKET;
   daemon->listening_address_reuse = 0;
   daemon->options = flags;
@@ -4794,23 +4798,23 @@ MHD_start_daemon_va (unsigned int flags,
   daemon->digest_auth_random = NULL;
   daemon->nonce_nc_size = 4; /* tiny */
 #endif
-#if HTTPS_SUPPORT
+#ifdef HTTPS_SUPPORT
   if (0 != (flags & MHD_USE_TLS))
     {
       daemon->cred_type = GNUTLS_CRD_CERTIFICATE;
     }
-#endif
+#endif /* HTTPS_SUPPORT */
 
 
   if (MHD_YES != parse_options_va (daemon,
                                    &servaddr,
                                    ap))
     {
-#if HTTPS_SUPPORT
+#ifdef HTTPS_SUPPORT
       if ( (0 != (flags & MHD_USE_TLS)) &&
           (NULL != daemon->priority_cache) )
        gnutls_priority_deinit (daemon->priority_cache);
-#endif
+#endif /* HTTPS_SUPPORT */
       free (daemon);
       return NULL;
     }
@@ -4824,10 +4828,10 @@ MHD_start_daemon_va (unsigned int flags,
          MHD_DLOG (daemon,
                    _("Specified value for NC_SIZE too large\n"));
 #endif
-#if HTTPS_SUPPORT
+#ifdef HTTPS_SUPPORT
          if (0 != (flags & MHD_USE_TLS))
            gnutls_priority_deinit (daemon->priority_cache);
-#endif
+#endif /* HTTPS_SUPPORT */
          free (daemon);
          return NULL;
        }
@@ -4839,10 +4843,10 @@ MHD_start_daemon_va (unsigned int flags,
                    _("Failed to allocate memory for nonce-nc map: %s\n"),
                    MHD_strerror_ (errno));
 #endif
-#if HTTPS_SUPPORT
+#ifdef HTTPS_SUPPORT
          if (0 != (flags & MHD_USE_TLS))
            gnutls_priority_deinit (daemon->priority_cache);
-#endif
+#endif /* HTTPS_SUPPORT */
          free (daemon);
          return NULL;
        }
@@ -4854,10 +4858,10 @@ MHD_start_daemon_va (unsigned int flags,
       MHD_DLOG (daemon,
                _("MHD failed to initialize nonce-nc mutex\n"));
 #endif
-#if HTTPS_SUPPORT
+#ifdef HTTPS_SUPPORT
       if (0 != (flags & MHD_USE_TLS))
        gnutls_priority_deinit (daemon->priority_cache);
-#endif
+#endif /* HTTPS_SUPPORT */
       free (daemon->nnc);
       free (daemon);
       return NULL;
@@ -5192,7 +5196,7 @@ MHD_start_daemon_va (unsigned int flags,
       goto free_and_fail;
     }
 
-#if HTTPS_SUPPORT
+#ifdef HTTPS_SUPPORT
   /* initialize HTTPS daemon certificate aspects & send / recv functions */
   if ( (0 != (flags & MHD_USE_TLS)) &&
        (0 != MHD_TLS_init (daemon)) )
@@ -5207,7 +5211,7 @@ MHD_start_daemon_va (unsigned int flags,
       MHD_mutex_destroy_chk_ (&daemon->per_ip_connection_mutex);
       goto free_and_fail;
     }
-#endif
+#endif /* HTTPS_SUPPORT */
   if ( ( (0 != (flags & MHD_USE_THREAD_PER_CONNECTION)) ||
         ( (0 != (flags & MHD_USE_SELECT_INTERNALLY)) &&
           (0 == daemon->worker_pool_size)) ) &&
@@ -5328,7 +5332,7 @@ MHD_start_daemon_va (unsigned int flags,
             }
         }
     }
-#if HTTPS_SUPPORT
+#ifdef HTTPS_SUPPORT
   /* API promises to never use the password after initialization,
      so we additionally NULL it here to not deref a dangling pointer. */
   daemon->https_key_password = NULL;
@@ -5363,8 +5367,8 @@ thread_failed:
  free_and_fail:
   /* clean up basic memory state in 'daemon' and return NULL to
      indicate failure */
-#if HTTPS_SUPPORT
 #ifdef EPOLL_SUPPORT
+#ifdef HTTPS_SUPPORT
   if (MHD_YES == daemon->upgrade_fd_in_epoll)
     {
       if (0 != epoll_ctl (daemon->epoll_fd,
@@ -5374,22 +5378,22 @@ thread_failed:
        MHD_PANIC (_("Failed to remove FD from epoll set\n"));
       daemon->upgrade_fd_in_epoll = MHD_NO;
     }
+#endif /* HTTPS_SUPPORT */
   if (-1 != daemon->epoll_fd)
     close (daemon->epoll_fd);
-#if HTTPS_SUPPORT
+#ifdef HTTPS_SUPPORT
   if (-1 != daemon->epoll_upgrade_fd)
     close (daemon->epoll_upgrade_fd);
-#endif
-#endif
-#endif
+#endif /* HTTPS_SUPPORT */
+#endif /* EPOLL_SUPPORT */
 #ifdef DAUTH_SUPPORT
   free (daemon->nnc);
   MHD_mutex_destroy_chk_ (&daemon->nnc_lock);
 #endif
-#if HTTPS_SUPPORT
+#ifdef HTTPS_SUPPORT
   if (0 != (flags & MHD_USE_TLS))
     gnutls_priority_deinit (daemon->priority_cache);
-#endif
+#endif /* HTTPS_SUPPORT */
   if (MHD_ITC_IS_VALID_(daemon->itc))
     MHD_itc_destroy_chk_ (daemon->itc);
   free (daemon);
@@ -5602,10 +5606,10 @@ MHD_stop_daemon (struct MHD_Daemon *daemon)
 #ifdef EPOLL_SUPPORT
               if (-1 != daemon->worker_pool[i].epoll_fd)
                 MHD_fd_close_chk_ (daemon->worker_pool[i].epoll_fd);
-#if HTTPS_SUPPORT
+#ifdef HTTPS_SUPPORT
               if (-1 != daemon->worker_pool[i].epoll_upgrade_fd)
                 MHD_fd_close_chk_ (daemon->worker_pool[i].epoll_upgrade_fd);
-#endif
+#endif /* HTTPS_SUPPORT */
 #endif
               if (MHD_ITC_IS_VALID_ (daemon->worker_pool[i].itc) )
                 MHD_itc_destroy_chk_ (daemon->worker_pool[i].itc);
@@ -5651,15 +5655,15 @@ MHD_stop_daemon (struct MHD_Daemon *daemon)
   if ( (0 != (daemon->options & MHD_USE_EPOLL)) &&
        (-1 != daemon->epoll_fd) )
     MHD_socket_close_chk_ (daemon->epoll_fd);
-#if HTTPS_SUPPORT
+#ifdef HTTPS_SUPPORT
   if ( (0 != (daemon->options & MHD_USE_EPOLL)) &&
        (-1 != daemon->epoll_upgrade_fd) )
     MHD_socket_close_chk_ (daemon->epoll_upgrade_fd);
-#endif
+#endif /* HTTPS_SUPPORT */
 #endif
 
   /* TLS clean up */
-#if HTTPS_SUPPORT
+#ifdef HTTPS_SUPPORT
   if (MHD_YES == daemon->have_dhparams)
     {
       gnutls_dh_params_deinit (daemon->https_mem_dhparams);
@@ -5671,7 +5675,7 @@ MHD_stop_daemon (struct MHD_Daemon *daemon)
       if (daemon->x509_cred)
         gnutls_certificate_free_credentials (daemon->x509_cred);
     }
-#endif
+#endif /* HTTPS_SUPPORT */
 
 #ifdef DAUTH_SUPPORT
   free (daemon->nnc);
@@ -5810,17 +5814,17 @@ MHD_is_feature_supported(enum MHD_FEATURE feature)
       return MHD_NO;
 #endif
     case MHD_FEATURE_SSL:
-#if HTTPS_SUPPORT
+#ifdef HTTPS_SUPPORT
       return MHD_YES;
-#else
+#else  /* ! HTTPS_SUPPORT */
       return MHD_NO;
-#endif
+#endif  /* ! HTTPS_SUPPORT */
     case MHD_FEATURE_HTTPS_CERT_CALLBACK:
-#if HTTPS_SUPPORT && GNUTLS_VERSION_MAJOR >= 3
+#if defined(HTTPS_SUPPORT) && GNUTLS_VERSION_MAJOR >= 3
       return MHD_YES;
-#else
+#else  /* !HTTPS_SUPPORT || GNUTLS_VERSION_MAJOR < 3 */
       return MHD_NO;
-#endif
+#endif /* !HTTPS_SUPPORT || GNUTLS_VERSION_MAJOR < 3 */
     case MHD_FEATURE_IPv6:
 #ifdef HAVE_INET6
       return MHD_YES;
@@ -5882,11 +5886,11 @@ MHD_is_feature_supported(enum MHD_FEATURE feature)
       return MHD_NO;
 #endif
     case MHD_FEATURE_HTTPS_KEY_PASSWORD:
-#if HTTPS_SUPPORT && GNUTLS_VERSION_NUMBER >= 0x030111
+#if defined(HTTPS_SUPPORT) && GNUTLS_VERSION_NUMBER >= 0x030111
       return MHD_YES;
-#else
+#else  /* !HTTPS_SUPPORT || GNUTLS_VERSION_NUMBER < 0x030111 */
       return MHD_NO;
-#endif
+#endif /* !HTTPS_SUPPORT || GNUTLS_VERSION_NUMBER < 0x030111 */
     case MHD_FEATURE_LARGE_FILE:
 #if defined(HAVE___LSEEKI64) || defined(HAVE_LSEEK64)
       return MHD_YES;
@@ -5904,7 +5908,7 @@ MHD_is_feature_supported(enum MHD_FEATURE feature)
 }
 
 
-#if HTTPS_SUPPORT && GCRYPT_VERSION_NUMBER < 0x010600
+#if defined(HTTPS_SUPPORT) && GCRYPT_VERSION_NUMBER < 0x010600
 #if defined(MHD_USE_POSIX_THREADS)
 GCRY_THREAD_OPTION_PTHREAD_IMPL;
 #elif defined(MHD_W32_MUTEX_)
@@ -5981,7 +5985,7 @@ MHD_init(void)
   if (2 != LOBYTE(wsd.wVersion) && 2 != HIBYTE(wsd.wVersion))
     MHD_PANIC (_("Winsock version 2.2 is not available\n"));
 #endif
-#if HTTPS_SUPPORT
+#ifdef HTTPS_SUPPORT
 #if GCRYPT_VERSION_NUMBER < 0x010600
 #if defined(MHD_USE_POSIX_THREADS)
   if (0 != gcry_control (GCRYCTL_SET_THREAD_CBS,
@@ -5998,7 +6002,7 @@ MHD_init(void)
     MHD_PANIC (_("libgcrypt is too old. MHD was compiled for libgcrypt 1.6.0 
or newer\n"));
 #endif
   gnutls_global_init ();
-#endif
+#endif /* HTTPS_SUPPORT */
   MHD_monotonic_sec_counter_init();
 }
 
@@ -6006,9 +6010,9 @@ MHD_init(void)
 void
 MHD_fini(void)
 {
-#if HTTPS_SUPPORT
+#ifdef HTTPS_SUPPORT
   gnutls_global_deinit ();
-#endif
+#endif /* HTTPS_SUPPORT */
 #ifdef _WIN32
   if (mhd_winsock_inited_)
     WSACleanup();
diff --git a/src/microhttpd/internal.h b/src/microhttpd/internal.h
index 95314d5..451520f 100644
--- a/src/microhttpd/internal.h
+++ b/src/microhttpd/internal.h
@@ -29,12 +29,12 @@
 
 #include "platform.h"
 #include "microhttpd.h"
-#if HTTPS_SUPPORT
+#ifdef HTTPS_SUPPORT
 #include <gnutls/gnutls.h>
 #if GNUTLS_VERSION_MAJOR >= 3
 #include <gnutls/abstract.h>
 #endif
-#endif
+#endif /* HTTPS_SUPPORT */
 #include "mhd_options.h"
 
 
@@ -889,7 +889,7 @@ struct MHD_Connection
    */
   struct MHD_UpgradeResponseHandle *urh;
 
-#if HTTPS_SUPPORT
+#ifdef HTTPS_SUPPORT
 
   /**
    * State required for HTTPS/SSL/TLS support.
@@ -916,7 +916,7 @@ struct MHD_Connection
    * TLS layer was shut down?
    */
   int tls_closed;
-#endif
+#endif /* HTTPS_SUPPORT */
 
   /**
    * Is the connection suspended?
@@ -994,7 +994,7 @@ struct MHD_UpgradeResponseHandle
    */
   struct MHD_Connection *connection;
 
-#if HTTPS_SUPPORT
+#ifdef HTTPS_SUPPORT
   /**
    * Kept in a DLL per daemon.
    */
@@ -1369,7 +1369,7 @@ struct MHD_Daemon
    */
   int listen_socket_in_epoll;
 
-#if HTTPS_SUPPORT
+#ifdef HTTPS_SUPPORT
   /**
    * File descriptor associated with the #run_epoll_for_upgrade() loop.
    * Only available if #MHD_USE_HTTPS_EPOLL_UPGRADE is set.
@@ -1381,7 +1381,7 @@ struct MHD_Daemon
    * #MHD_NO if not.
    */
   int upgrade_fd_in_epoll;
-#endif
+#endif /* HTTPS_SUPPORT */
 
 #endif
 
@@ -1441,7 +1441,7 @@ struct MHD_Daemon
    */
   uint16_t port;
 
-#if HTTPS_SUPPORT
+#ifdef HTTPS_SUPPORT
   /**
    * Head of DLL of upgrade response handles we are processing.
    * Used for upgraded TLS connections when thread-per-connection
@@ -1523,7 +1523,7 @@ struct MHD_Daemon
    */
   unsigned int num_tls_read_ready;
 
-#endif
+#endif /* HTTPS_SUPPORT */
 
 #ifdef DAUTH_SUPPORT
 
diff --git a/src/microhttpd/response.c b/src/microhttpd/response.c
index 364acc1..da2f538 100644
--- a/src/microhttpd/response.c
+++ b/src/microhttpd/response.c
@@ -653,7 +653,7 @@ MHD_upgrade_action (struct MHD_UpgradeResponseHandle *urh,
      * 'urh->was_closed' AND 'urh->clean_ready', it will
      * be moved to cleanup list by MHD_resume_connection(). */
     MHD_resume_connection (connection);
-#if HTTPS_SUPPORT
+#ifdef HTTPS_SUPPORT
     if (0 != (daemon->options & MHD_USE_TLS) )
       {
         /* signal that app is done by shutdown() of 'app' socket */
@@ -714,7 +714,7 @@ MHD_response_execute_upgrade_ (struct MHD_Response 
*response,
   urh->connection = connection;
   rbo = connection->read_buffer_offset;
   connection->read_buffer_offset = 0;
-#if HTTPS_SUPPORT
+#ifdef HTTPS_SUPPORT
   if (0 != (daemon->options & MHD_USE_TLS) )
   {
     struct MemoryPool *pool;
@@ -896,7 +896,9 @@ MHD_response_execute_upgrade_ (struct MHD_Response 
*response,
       /* Non-TLS connection do not hold any additional resources. */
       urh->clean_ready = MHD_YES;
     }
-#endif
+#else  /* ! HTTPS_SUPPORT */
+  urh->clean_ready = MHD_YES;
+#endif /* ! HTTPS_SUPPORT */
   connection->urh = urh;
   /* As far as MHD's event loops are concerned, this connection is
      suspended; it will be resumed once application is done by the
@@ -909,8 +911,12 @@ MHD_response_execute_upgrade_ (struct MHD_Response 
*response,
                              connection->client_context,
                              connection->read_buffer,
                              rbo,
+#ifdef HTTPS_SUPPORT
                              (0 == (daemon->options & MHD_USE_TLS) ) ?
                              connection->socket_fd : urh->app.socket,
+#else  /* ! HTTPS_SUPPORT */
+                             connection->socket_fd,
+#endif /* ! HTTPS_SUPPORT */
                              urh);
   return MHD_YES;
 }
diff --git a/src/testcurl/curl_version_check.c 
b/src/testcurl/curl_version_check.c
index 37bb536..dff143f 100644
--- a/src/testcurl/curl_version_check.c
+++ b/src/testcurl/curl_version_check.c
@@ -67,13 +67,13 @@ parse_version_string (const char *s, int *major, int 
*minor, int *micro)
   return s;
 }
 
-#if HTTPS_SUPPORT
+#ifdef HTTPS_SUPPORT
 int
 curl_uses_nss_ssl()
 {
   return (strstr(curl_version(), " NSS/") != NULL) ? 0 : -1;
 }
-#endif
+#endif /* HTTPS_SUPPORT */
 
 /*
  * check local libcurl version matches required version
@@ -83,10 +83,10 @@ curl_check_version (const char *req_version)
 {
   const char *ver;
   const char *curl_ver;
-#if HTTPS_SUPPORT
+#ifdef HTTPS_SUPPORT
   const char *ssl_ver;
   const char *req_ssl_ver;
-#endif
+#endif /* HTTPS_SUPPORT */
 
   int loc_major, loc_minor, loc_micro;
   int rq_major, rq_minor, rq_micro;
@@ -127,7 +127,7 @@ curl_check_version (const char *req_version)
    * enforce required gnutls/openssl version.
    * TODO use curl version string to assert use of gnutls
    */
-#if HTTPS_SUPPORT
+#ifdef HTTPS_SUPPORT
   ssl_ver = strchr (curl_ver, ' ');
   if (ssl_ver == NULL)
     return -1;
@@ -171,6 +171,6 @@ curl_check_version (const char *req_version)
                req_ssl_ver);
       return -1;
     }
-#endif
+#endif /* HTTPS_SUPPORT */
   return 0;
 }


hooks/post-receive
-- 
GNU libmicrohttpd



reply via email to

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