commit 2c53619affc880f653c23b6f861d100d43b6d4af
parent 61c710742061ba6d176198d5e0b7dd8720f5fe56
Author: Christian Grothoff <christian@grothoff.org>
Date: Tue, 17 Feb 2009 04:12:49 +0000
always define connection_info
Diffstat:
3 files changed, 44 insertions(+), 34 deletions(-)
diff --git a/ChangeLog b/ChangeLog
@@ -1,3 +1,7 @@
+Mon Feb 16 21:12:21 MST 2009
+ Moved MHD_get_connection_info so that it is always defined,
+ even if HTTPS support is not enabled. -CG
+
Sun Feb 8 21:15:30 MST 2009
Releasing libmicrohttpd 0.4.0. -CG
diff --git a/src/daemon/connection.c b/src/daemon/connection.c
@@ -2112,4 +2112,44 @@ MHD_set_http_calbacks (struct MHD_Connection *connection)
connection->idle_handler = &MHD_connection_handle_idle;
}
+#if HTTPS_SUPPORT
+#include "gnutls_int.h"
+#include "gnutls_record.h"
+#endif
+
+/**
+ * Obtain information about the given connection.
+ *
+ * @param connection what connection to get information about
+ * @param infoType what information is desired?
+ * @param ... depends on infoType
+ * @return NULL if this information is not available
+ * (or if the infoType is unknown)
+ */
+const union MHD_ConnectionInfo *
+MHD_get_connection_info (struct MHD_Connection *connection,
+ enum MHD_ConnectionInfoType infoType, ...)
+{
+ switch (infoType)
+ {
+#if HTTPS_SUPPORT
+ case MHD_CONNECTION_INFO_CIPHER_ALGO:
+ if (connection->tls_session == NULL)
+ return NULL;
+ return (const union MHD_ConnectionInfo *) &connection->
+ tls_session->security_parameters.read_bulk_cipher_algorithm;
+ case MHD_CONNECTION_INFO_PROTOCOL:
+ if (connection->tls_session == NULL)
+ return NULL;
+ return (const union MHD_ConnectionInfo *) &connection->
+ tls_session->security_parameters.version;
+#endif
+ case MHD_CONNECTION_INFO_CLIENT_ADDRESS:
+ return (const union MHD_ConnectionInfo *) &connection->addr;
+ default:
+ return NULL;
+ };
+}
+
+
/* end of connection.c */
diff --git a/src/daemon/connection_https.c b/src/daemon/connection_https.c
@@ -40,40 +40,6 @@
#include "gnutls_errors.h"
/**
- * Obtain information about the given connection.
- *
- * @param connection what connection to get information about
- * @param infoType what information is desired?
- * @param ... depends on infoType
- * @return NULL if this information is not available
- * (or if the infoType is unknown)
- */
-const union MHD_ConnectionInfo *
-MHD_get_connection_info (struct MHD_Connection *connection,
- enum MHD_ConnectionInfoType infoType, ...)
-{
- switch (infoType)
- {
-#if HTTPS_SUPPORT
- case MHD_CONNECTION_INFO_CIPHER_ALGO:
- if (connection->tls_session == NULL)
- return NULL;
- return (const union MHD_ConnectionInfo *) &connection->
- tls_session->security_parameters.read_bulk_cipher_algorithm;
- case MHD_CONNECTION_INFO_PROTOCOL:
- if (connection->tls_session == NULL)
- return NULL;
- return (const union MHD_ConnectionInfo *) &connection->
- tls_session->security_parameters.version;
-#endif
- case MHD_CONNECTION_INFO_CLIENT_ADDRESS:
- return (const union MHD_ConnectionInfo *) &connection->addr;
- default:
- return NULL;
- };
-}
-
-/**
* This function is called once a secure connection has been marked
* for closure.
*