Przeglądaj źródła

new MHD_CONNECTION_INFO_DAEMON

Christian Grothoff 14 lat temu
rodzic
commit
3bfdf879ca
4 zmienionych plików z 26 dodań i 5 usunięć
  1. 4 0
      ChangeLog
  2. 4 0
      doc/microhttpd.texi
  3. 2 0
      src/daemon/connection.c
  4. 16 5
      src/include/microhttpd.h

+ 4 - 0
ChangeLog

@@ -1,3 +1,7 @@
+Fri Jun  3 15:26:42 CEST 2011
+	Adding MHD_CONNECTION_INFO_DAEMON to obtain MHD_Daemon
+	responsible for a given connection. -CG
+
 Wed May 25 14:23:20 CEST 2011
 	Trying to fix stutter problem on timeout described by
 	David Myers on the mailinglist (5/10/2011). -CG

+ 4 - 0
doc/microhttpd.texi

@@ -733,6 +733,10 @@ Takes no extra arguments.  Allows access to the client certificate
 including access to the underlying GNUtls client certificate
 (HTTPS connections only).  Takes no extra arguments.
 
+@item MHD_CONNECTION_INFO_DAEMON
+Returns information about @code{struct MHD_Daemon} which manages
+this connection.
+
 @end table
 @end deftp
 

+ 2 - 0
src/daemon/connection.c

@@ -2332,6 +2332,8 @@ MHD_get_connection_info (struct MHD_Connection *connection,
 #endif
     case MHD_CONNECTION_INFO_CLIENT_ADDRESS:
       return (const union MHD_ConnectionInfo *) &connection->addr;
+    case MHD_CONNECTION_INFO_DAEMON:
+      return (const union MHD_ConnectionInfo *) &connection->daemon;
     default:
       return NULL;
     };

+ 16 - 5
src/include/microhttpd.h

@@ -714,10 +714,10 @@ enum MHD_ConnectionInfoType
   MHD_CONNECTION_INFO_PROTOCOL,
 
   /**
-   * Obtain IP address of the client.
-   * Takes no extra arguments.  Returns a
-   * 'struct sockaddr_in **' by accident; obsolete,
-   * use MHD_CONNECTION_INFO_CLIENT_SOCK_ADDR.
+   * Obtain IP address of the client.  Takes no extra arguments.
+   * Returns essentially a "struct sockaddr **" (since the API returns
+   * a "union MHD_ConnectionInfo *" and that union contains a "struct
+   * sockaddr *").
    */
   MHD_CONNECTION_INFO_CLIENT_ADDRESS,
 
@@ -729,7 +729,12 @@ enum MHD_ConnectionInfoType
   /**
    * Get the GNUTLS client certificate handle.
    */
-  MHD_CONNECTION_INFO_GNUTLS_CLIENT_CERT
+  MHD_CONNECTION_INFO_GNUTLS_CLIENT_CERT,
+
+  /**
+   * Get the 'struct MHD_Daemon' responsible for managing this connection.
+   */
+  MHD_CONNECTION_INFO_DAEMON
 
 };
 
@@ -1577,6 +1582,12 @@ union MHD_ConnectionInfo
    * Address information for the client.
    */
   struct sockaddr *client_addr;
+
+  /**
+   * Which daemon manages this connection (useful in case there are many
+   * daemons running).
+   */
+  struct MHD_Daemon *daemon;
 };
 
 /**