remove output
[oweals/gnunet.git] / src / transport / plugin_transport_http_server.c
index 0d072c9e943ce390b054cf8a8b4a464ca874b627..19833521a06342c00b48d6f30f5f636cdc1d1327 100644 (file)
@@ -654,17 +654,23 @@ static int
 http_server_plugin_address_suggested (void *cls, const void *addr,
                size_t addrlen)
 {
-  struct HTTP_Server_Plugin *plugin = cls;
   struct HttpAddressWrapper *next;
   struct HttpAddressWrapper *pos;
+       struct HttpAddress *h_addr;
+       h_addr = (struct HttpAddress *) addr;
 
-
-  if ((NULL != plugin->ext_addr) &&
+  if ((NULL != p->ext_addr) &&
           GNUNET_YES == (http_common_cmp_addresses (addr, addrlen,
-                                          plugin->ext_addr, plugin->ext_addr_len)))
-    return GNUNET_OK;
+                                          p->ext_addr, p->ext_addr_len)))
+  {
+       /* Checking HTTP_OPTIONS_VERIFY_CERTIFICATE option for external hostname */
+       if ((ntohl(h_addr->options) & HTTP_OPTIONS_VERIFY_CERTIFICATE) !=
+                       (p->options & HTTP_OPTIONS_VERIFY_CERTIFICATE))
+                       return GNUNET_NO; /* VERIFY option not set as required! */
+       return GNUNET_OK;
+  }
 
-  next  = plugin->addr_head;
+  next  = p->addr_head;
   while (NULL != (pos = next))
   {
     next = pos->next;
@@ -3006,9 +3012,15 @@ const char *http_plugin_address_to_string (void *cls,
                                            const void *addr,
                                            size_t addrlen)
 {
-       return http_common_plugin_address_to_string (cls, p->protocol, addr, addrlen);
+#if BUILD_HTTPS
+       return http_common_plugin_address_to_string (cls, PLUGIN_NAME, addr, addrlen);
+#else
+       return http_common_plugin_address_to_string (cls, PLUGIN_NAME, addr, addrlen);
+#endif
+
 }
 
+
 /**
  * Function obtain the network type for a session
  *
@@ -3017,13 +3029,14 @@ const char *http_plugin_address_to_string (void *cls,
  * @return the network type in HBO or GNUNET_SYSERR
  */
 static enum GNUNET_ATS_Network_Type
-http_server_get_network (void *cls, void *session)
+http_server_get_network (void *cls,
+                        struct Session *session)
 {
-       struct Session *s = (struct Session *) session;
-       GNUNET_assert (NULL != s);
-       return ntohl(s->ats_address_network_type);
+  GNUNET_assert (NULL != session);
+  return ntohl (session->ats_address_network_type);
 }
 
+
 /**
  * Entry point for the plugin.
  *