From 3bfdf879cad33b73fa141281112849f0a0b778e6 Mon Sep 17 00:00:00 2001 From: Christian Grothoff Date: Fri, 3 Jun 2011 15:31:09 +0000 Subject: [PATCH] new MHD_CONNECTION_INFO_DAEMON --- ChangeLog | 4 ++++ doc/microhttpd.texi | 4 ++++ src/daemon/connection.c | 2 ++ src/include/microhttpd.h | 21 ++++++++++++++++----- 4 files changed, 26 insertions(+), 5 deletions(-) diff --git a/ChangeLog b/ChangeLog index d9cf2709..e3aefc6e 100644 --- a/ChangeLog +++ b/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 diff --git a/doc/microhttpd.texi b/doc/microhttpd.texi index e498b9b3..1b1b4031 100644 --- a/doc/microhttpd.texi +++ b/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 diff --git a/src/daemon/connection.c b/src/daemon/connection.c index c3f0999f..1bc8001c 100644 --- a/src/daemon/connection.c +++ b/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; }; diff --git a/src/include/microhttpd.h b/src/include/microhttpd.h index 378dfadd..de3ffb90 100644 --- a/src/include/microhttpd.h +++ b/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; }; /**