Next: , Previous: , Up: microhttpd-info   [Contents][Index]

12.2 Obtaining state information about a connection

Function: const union MHD_ConnectionInfo * MHD_get_connection_info (struct MHD_Connection *daemon, enum MHD_ConnectionInfoType infoType, ...)

Obtain information about the given connection.


the connection about which information is desired;


type of information that is desired


additional arguments about the desired information (depending on infoType)

Returns a union with the respective member (depending on infoType) set to the desired information), or NULL in case the desired information is not available or applicable.

Enumeration: MHD_ConnectionInfoType

Values of this enum are used to specify what information about a connection is desired.


What cipher algorithm is being used (HTTPS connections only). Takes no extra arguments. NULL is returned for non-HTTPS connections.


Takes no extra arguments. Allows finding out the TLS/SSL protocol used (HTTPS connections only). NULL is returned for non-HTTPS connections.


Returns information about the address of the client. Returns essentially a struct sockaddr ** (since the API returns a union MHD_ConnectionInfo * and that union contains a struct sockaddr *).


Takes no extra arguments. Allows access to the underlying GNUtls session, including access to the underlying GNUtls client certificate (HTTPS connections only). Takes no extra arguments. NULL is returned for non-HTTPS connections.


Dysfunctional (never implemented, deprecated). Use MHD_CONNECTION_INFO_GNUTLS_SESSION to get the gnutls_session_t and then call gnutls_certificate_get_peers().


Returns information about struct MHD_Daemon which manages this connection.


Returns the file descriptor (usually a TCP socket) associated with this connection (in the “connect-fd” member of the returned struct). Note that manipulating the descriptor directly can have problematic consequences (as in, break HTTP). Applications might use this access to manipulate TCP options, for example to set the “TCP-NODELAY” option for COMET-like applications. Note that MHD will set TCP-CORK after sending the HTTP header and clear it after finishing the footers automatically (if the platform supports it). As the connection callbacks are invoked in between, those might be used to set different values for TCP-CORK and TCP-NODELAY in the meantime.


Returns the client-specific pointer to a void * that was (possibly) set during a MHD_NotifyConnectionCallback when the socket was first accepted. Note that this is NOT the same as the con_cls argument of the MHD_AccessHandlerCallback. The con_cls is fresh for each HTTP request, while the socket_context is fresh for each socket.

Next: , Previous: , Up: microhttpd-info   [Contents][Index]