gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[GNUnet-SVN] r27670 - gnunet/src/transport


From: gnunet
Subject: [GNUnet-SVN] r27670 - gnunet/src/transport
Date: Fri, 28 Jun 2013 10:26:53 +0200

Author: wachs
Date: 2013-06-28 10:26:53 +0200 (Fri, 28 Jun 2013)
New Revision: 27670

Modified:
   gnunet/src/transport/plugin_transport_http_server.c
   gnunet/src/transport/test_transport_api_https_peer2.conf
Log:
added: port can be automatically included in external hostname
required for testing when ports are modified automatically


Modified: gnunet/src/transport/plugin_transport_http_server.c
===================================================================
--- gnunet/src/transport/plugin_transport_http_server.c 2013-06-28 08:24:35 UTC 
(rev 27669)
+++ gnunet/src/transport/plugin_transport_http_server.c 2013-06-28 08:26:53 UTC 
(rev 27670)
@@ -2612,7 +2612,7 @@
   memcpy (&plugin->ext_addr[1], url, urlen);
   GNUNET_free (url);
   GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, plugin->name,
-                   "Notifying transport about external hostname address 
`%s'\n", plugin->ext_addr);
+                   "Notifying transport about external hostname address 
`%s'\n", plugin->external_hostname);
 
 #if BUILD_HTTPS
   if (GNUNET_YES == plugin->verify_external_hostname)
@@ -2642,6 +2642,8 @@
   unsigned long long max_connections;
   char *bind4_address = NULL;
   char *bind6_address = NULL;
+  char *eh_tmp = NULL;
+  int external_hostname_use_port;
 
   /* Use IPv4? */
   if (GNUNET_CONFIGURATION_have_value
@@ -2692,7 +2694,7 @@
   }
   plugin->port = port;
 
-  GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, plugin->name,
+  GNUNET_log_from (GNUNET_ERROR_TYPE_INFO, plugin->name,
                    _("Using port %u\n"), plugin->port);
 
   if ((plugin->use_ipv4 == GNUNET_YES) &&
@@ -2765,19 +2767,42 @@
   if (GNUNET_YES == plugin->verify_external_hostname)
        plugin->options |= HTTP_OPTIONS_VERIFY_CERTIFICATE;
 #endif
+  external_hostname_use_port = GNUNET_CONFIGURATION_get_value_yesno 
(plugin->env->cfg, plugin->name,
+                                                                               
                                                                                
"EXTERNAL_HOSTNAME_USE_PORT");
+  if (GNUNET_SYSERR == external_hostname_use_port)
+       external_hostname_use_port = GNUNET_NO;
 
+
   if (GNUNET_YES == GNUNET_CONFIGURATION_get_value_string (plugin->env->cfg, 
plugin->name,
-                                              "EXTERNAL_HOSTNAME", 
&plugin->external_hostname))
+                                              "EXTERNAL_HOSTNAME", &eh_tmp))
   {
       char * tmp = NULL;
-      if (NULL != strstr(plugin->external_hostname, "://"))
+      char * pos = NULL;
+      char * pos_url = NULL;
+
+      if (NULL != strstr(eh_tmp, "://"))
       {
-          tmp = strdup(&strstr(plugin->external_hostname, "://")[3]);
-          GNUNET_free (plugin->external_hostname);
-          plugin->external_hostname = tmp;
+          tmp = &strstr(eh_tmp, "://")[3];
+      }
+      else
+               tmp = eh_tmp;
 
+      if (GNUNET_YES == external_hostname_use_port)
+      {
+        if ( (strlen (tmp) > 1) && (NULL != (pos = strchr(tmp, '/'))) )
+        {
+               pos_url = pos + 1;
+               pos[0] = '\0';
+               GNUNET_asprintf (&plugin->external_hostname, "%s:%u/%s", tmp, 
port, pos_url);
+        }
+        else
+               GNUNET_asprintf (&plugin->external_hostname, "%s:%u", tmp, 
port);
       }
-      GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, plugin->name,
+      else
+       plugin->external_hostname = GNUNET_strdup (tmp);
+      GNUNET_free (eh_tmp);
+
+      GNUNET_log_from (GNUNET_ERROR_TYPE_INFO, plugin->name,
                        _("Using external hostname `%s'\n"), 
plugin->external_hostname);
       plugin->notify_ext_task = GNUNET_SCHEDULER_add_now 
(&server_notify_external_hostname, plugin);
 

Modified: gnunet/src/transport/test_transport_api_https_peer2.conf
===================================================================
--- gnunet/src/transport/test_transport_api_https_peer2.conf    2013-06-28 
08:24:35 UTC (rev 27669)
+++ gnunet/src/transport/test_transport_api_https_peer2.conf    2013-06-28 
08:26:53 UTC (rev 27670)
@@ -3,10 +3,12 @@
 SERVICEHOME = /tmp/test-transport/api-https-p2/
 
 [transport-https_server]
-EXTERNAL_HOSTNAME = test
-#EXTERNAL_HOSTNAME_ONLY = yes
-VERIFY_EXTERNAL_HOSTNAME = YES
-PORT = 12110
+EXTERNAL_HOSTNAME = localhost/test
+EXTERNAL_HOSTNAME_ONLY = yes
+EXTERNAL_HOSTNAME_USE_PORT = YES
+#VERIFY_EXTERNAL_HOSTNAME = YES
+#PORT = 10000
+# Does the external hostname use the same port?
 USE_IPv6 = YES
 #BINDTO = 127.0.0.1
 KEY_FILE = $SERVICEHOME/https_key_p2.key




reply via email to

[Prev in Thread] Current Thread [Next in Thread]