gnunet-svn
[Top][All Lists]
Advanced

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

[GNUnet-SVN] r37818 - libmicrohttpd/src/microhttpd


From: gnunet
Subject: [GNUnet-SVN] r37818 - libmicrohttpd/src/microhttpd
Date: Sun, 28 Aug 2016 11:21:39 +0200

Author: grothoff
Date: 2016-08-28 11:21:39 +0200 (Sun, 28 Aug 2016)
New Revision: 37818

Modified:
   libmicrohttpd/src/microhttpd/daemon.c
   libmicrohttpd/src/microhttpd/internal.h
   libmicrohttpd/src/microhttpd/response.c
Log:
-define HTTPS-structures for upgrade only when we have upgrade

Modified: libmicrohttpd/src/microhttpd/daemon.c
===================================================================
--- libmicrohttpd/src/microhttpd/daemon.c       2016-08-28 09:05:57 UTC (rev 
37817)
+++ libmicrohttpd/src/microhttpd/daemon.c       2016-08-28 09:21:39 UTC (rev 
37818)
@@ -2185,6 +2185,7 @@
   MHD_socket ds;
   struct MHD_Connection *pos;
   struct MHD_Connection *next;
+  struct MHD_UpgradeResponseHandle *urh;
   unsigned int mask = MHD_USE_SUSPEND_RESUME | MHD_USE_EPOLL_INTERNALLY |
     MHD_USE_SELECT_INTERNALLY | MHD_USE_POLL_INTERNALLY | 
MHD_USE_THREAD_PER_CONNECTION;
 
@@ -2204,7 +2205,7 @@
     {
       /* we're in epoll mode, the epoll FD stands for
         the entire event set! */
-      if (!MHD_SCKT_FD_FITS_FDSET_(daemon->epoll_fd, NULL))
+      if (! MHD_SCKT_FD_FITS_FDSET_(daemon->epoll_fd, NULL))
        return MHD_NO; /* poll fd too big, fail hard */
       if (FD_ISSET (daemon->epoll_fd, read_fd_set))
        return MHD_run (daemon);
@@ -2233,6 +2234,15 @@
                          MHD_NO);
         }
     }
+
+  /* handle upgraded HTTPS connections */
+#if HTTPS_SUPPORT
+  for (urh = daemon->urh_head; NULL != urh; urh = urh->next)
+    {
+      // if ( (0 != (MHD_EPOLL_STATE_READ_READY & urh->celi_mhd)) &&
+      // (0 != (MHD_EPOLL_STATE_WRITE_READY & urh->celi_client)) )
+    }
+#endif
   MHD_cleanup_connections (daemon);
   return MHD_YES;
 }

Modified: libmicrohttpd/src/microhttpd/internal.h
===================================================================
--- libmicrohttpd/src/microhttpd/internal.h     2016-08-28 09:05:57 UTC (rev 
37817)
+++ libmicrohttpd/src/microhttpd/internal.h     2016-08-28 09:21:39 UTC (rev 
37818)
@@ -894,7 +894,14 @@
  */
 struct MHD_UpgradeResponseHandle
 {
+  /**
+   * The connection for which this is an upgrade handle.  Note that
+   * because a response may be shared over many connections, this may
+   * not be the only upgrade handle for the response of this connection.
+   */
+  struct MHD_Connection *connection;
 
+#if HTTPS_SUPPORT
   /**
    * Kept in a DLL per daemon.
    */
@@ -906,13 +913,6 @@
   struct MHD_UpgradeResponseHandle *prev;
 
   /**
-   * The connection for which this is an upgrade handle.  Note that
-   * because a response may be shared over many connections, this may
-   * not be the only upgrade handle for the response of this connection.
-   */
-  struct MHD_Connection *connection;
-
-  /**
    * The socket we gave to the application (r/w).
    */
   MHD_socket app_socket;
@@ -932,8 +932,8 @@
    * IO-state of the @e connection's socket.
    */
   enum MHD_EpollState celi_client;
+#endif
 
-
 };
 
 
@@ -1028,16 +1028,6 @@
 #endif
 
   /**
-   * Head of DLL of upgrade response handles we are processing.
-   */
-  struct MHD_UpgradeResponseHandle *urh_head;
-
-  /**
-   * Tail of DLL of upgrade response handles we are processing.
-   */
-  struct MHD_UpgradeResponseHandle *urh_tail;
-
-  /**
    * Head of the XDLL of ALL connections with a default ('normal')
    * timeout, sorted by timeout (earliest at the tail, most recently
    * used connection at the head).  MHD can just look at the tail of
@@ -1284,6 +1274,16 @@
 
 #if HTTPS_SUPPORT
   /**
+   * Head of DLL of upgrade response handles we are processing.
+   */
+  struct MHD_UpgradeResponseHandle *urh_head;
+
+  /**
+   * Tail of DLL of upgrade response handles we are processing.
+   */
+  struct MHD_UpgradeResponseHandle *urh_tail;
+
+  /**
    * Desired cipher algorithms.
    */
   gnutls_priority_t priority_cache;

Modified: libmicrohttpd/src/microhttpd/response.c
===================================================================
--- libmicrohttpd/src/microhttpd/response.c     2016-08-28 09:05:57 UTC (rev 
37817)
+++ libmicrohttpd/src/microhttpd/response.c     2016-08-28 09:21:39 UTC (rev 
37818)
@@ -603,6 +603,7 @@
   {
   case MHD_UPGRADE_ACTION_CLOSE:
     /* Application is done with this connection, tear it down! */
+#if HTTPS_SUPPORT
     if (0 != (daemon->options & MHD_USE_SSL) )
       {
         DLL_remove (daemon->urh_head,
@@ -610,13 +611,14 @@
                     urh);
         /* FIXME: if running in epoll()-mode, do we have
            to remove any of the FDs from any epoll-sets here? */
+        if ( (MHD_INVALID_SOCKET != urh->app_socket) &&
+             (0 != MHD_socket_close_ (urh->app_socket)) )
+          MHD_PANIC ("close failed\n");
+        if ( (MHD_INVALID_SOCKET != urh->mhd_socket) &&
+             (0 != MHD_socket_close_ (urh->mhd_socket)) )
+          MHD_PANIC ("close failed\n");
       }
-    if ( (MHD_INVALID_SOCKET != urh->app_socket) &&
-         (0 != MHD_socket_close_ (urh->app_socket)) )
-      MHD_PANIC ("close failed\n");
-    if ( (MHD_INVALID_SOCKET != urh->mhd_socket) &&
-         (0 != MHD_socket_close_ (urh->mhd_socket)) )
-      MHD_PANIC ("close failed\n");
+#endif
     MHD_resume_connection (urh->connection);
     MHD_connection_close_ (urh->connection,
                            MHD_REQUEST_TERMINATED_COMPLETED_OK);
@@ -665,6 +667,9 @@
   urh = malloc (sizeof (struct MHD_UpgradeResponseHandle));
   if (NULL == urh)
     return MHD_NO;
+  urh->connection = connection;
+  rbo = connection->read_buffer_offset;
+  connection->read_buffer_offset = 0;
 #if HTTPS_SUPPORT
   if (0 != (daemon->options & MHD_USE_SSL) )
   {
@@ -696,9 +701,6 @@
 
     urh->app_socket = sv[0];
     urh->mhd_socket = sv[1];
-    urh->connection = connection;
-    rbo = connection->read_buffer_offset;
-    connection->read_buffer_offset = 0;
     response->upgrade_handler (response->upgrade_handler_cls,
                                connection,
                                connection->client_context,
@@ -720,12 +722,9 @@
                 urh);
     return MHD_YES;
   }
-#endif
-  urh->connection = connection;
   urh->app_socket = MHD_INVALID_SOCKET;
   urh->mhd_socket = MHD_INVALID_SOCKET;
-  rbo = connection->read_buffer_offset;
-  connection->read_buffer_offset = 0;
+#endif
   response->upgrade_handler (response->upgrade_handler_cls,
                              connection,
                              connection->client_context,




reply via email to

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