فهرست منبع

always define connection_info

Christian Grothoff 17 سال پیش
والد
کامیت
2c53619aff
3فایلهای تغییر یافته به همراه44 افزوده شده و 34 حذف شده
  1. 4 0
      ChangeLog
  2. 40 0
      src/daemon/connection.c
  3. 0 34
      src/daemon/connection_https.c

+ 4 - 0
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
 

+ 40 - 0
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 */

+ 0 - 34
src/daemon/connection_https.c

@@ -39,40 +39,6 @@
 /* TODO #include rm "gnutls_errors.h" */
 #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.