Przeglądaj źródła

Added MHD_DAEMON_INFO_FLAGS to get daemon's flags by MHD_get_daemon_info()

Evgeny Grin (Karlson2k) 9 lat temu
rodzic
commit
77bc810355
2 zmienionych plików z 19 dodań i 1 usunięć
  1. 17 1
      src/include/microhttpd.h
  2. 2 0
      src/microhttpd/daemon.c

+ 17 - 1
src/include/microhttpd.h

@@ -1796,7 +1796,15 @@ enum MHD_DaemonInfoType
    * Request the number of current connections handled by the daemon.
    * No extra arguments should be passed.
    */
-  MHD_DAEMON_INFO_CURRENT_CONNECTIONS
+  MHD_DAEMON_INFO_CURRENT_CONNECTIONS,
+
+  /**
+   * Request the daemon flags.
+   * No extra arguments should be passed.
+   * Note: flags may differ from original 'flags' specified for
+   * daemon, especially if #MHD_USE_AUTO was set.
+   */
+  MHD_DAEMON_INFO_FLAGS
 };
 
 
@@ -3184,6 +3192,14 @@ union MHD_DaemonInfo
    * Number of active connections, for #MHD_DAEMON_INFO_CURRENT_CONNECTIONS.
    */
   unsigned int num_connections;
+
+  /**
+   * Combination of #MHD_FLAG values, for #MHD_DAEMON_INFO_FLAGS.
+   * This value is actually a bitfield.
+   * Note: flags may differ from original 'flags' specified for
+   * daemon, especially if #MHD_USE_AUTO was set.
+   */
+  enum MHD_FLAG flags;
 };
 
 

+ 2 - 0
src/microhttpd/daemon.c

@@ -6259,6 +6259,8 @@ MHD_get_daemon_info (struct MHD_Daemon *daemon,
             }
         }
       return (const union MHD_DaemonInfo *) &daemon->connections;
+    case MHD_DAEMON_INFO_FLAGS:
+      return (const union MHD_DaemonInfo *) &daemon->options;
     default:
       return NULL;
     };