gnunet-svn
[Top][All Lists]
Advanced

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

[GNUnet-SVN] r20878 - in gnunet/src/gns: . proxy


From: gnunet
Subject: [GNUnet-SVN] r20878 - in gnunet/src/gns: . proxy
Date: Tue, 3 Apr 2012 15:08:07 +0200

Author: schanzen
Date: 2012-04-03 15:08:07 +0200 (Tue, 03 Apr 2012)
New Revision: 20878

Added:
   gnunet/src/gns/test_gns_defaults.conf
Modified:
   gnunet/src/gns/proxy/gnunet-gns-proxy.py
Log:
-fix


Modified: gnunet/src/gns/proxy/gnunet-gns-proxy.py
===================================================================
--- gnunet/src/gns/proxy/gnunet-gns-proxy.py    2012-04-03 13:06:59 UTC (rev 
20877)
+++ gnunet/src/gns/proxy/gnunet-gns-proxy.py    2012-04-03 13:08:07 UTC (rev 
20878)
@@ -47,15 +47,21 @@
             print 'calling gnunet-gns -a '+netloc[:i]
             auth = os.popen("gnunet-gns -a "+netloc[:i])
             lines = auth.readlines()
-            print 'result: '+lines[0].split(" ")[-1].rstrip()
-            to_replace = lines[0].split(" ")[-1].rstrip()
+            if (len(lines) > 0):
+              print 'result: '+lines[0].split(" ")[-1].rstrip()
+              to_replace = lines[0].split(" ")[-1].rstrip()
+            else:
+              to_replace = "+"
             self.host_port = netloc[:i], int(netloc[i+1:])
         else:
             print 'calling gnunet-gns -a '+netloc
             auth = os.popen("gnunet-gns -a "+netloc)
             lines = auth.readlines()
-            print 'result: '+lines[0].split(" ")[-1].rstrip()
-            to_replace = lines[0].split(" ")[-1].rstrip()
+            if (len(lines) > 0):
+              print 'result: '+lines[0].split(" ")[-1].rstrip()
+              to_replace = lines[0].split(" ")[-1].rstrip()
+            else:
+              to_replace = "+"
             self.host_port = netloc, 80
         print "\t" "connect to %s:%d" % self.host_port
         try: soc.connect(self.host_port)
@@ -84,9 +90,20 @@
 
     def shorten_zkey(self):
       return lambda mo: 'a href="http://'+os.popen("gnunet-gns 
-s"+string.replace(mo.group(1), 'a href="http://', "")).readlines()[0].split(" 
")[-1].rstrip()
+    
+    def test_re(self, to_repl, mo):
+      short = os.popen("gnunet-gns -s "+string.replace(mo.group(1)+to_repl, 'a 
href="http://', ""))
+      lines = short.readlines()
+      if (len(lines) < 1):
+        return to_repl
+      elif (len(lines.split(" ")) > 0):
+        return 'a href="http://'+lines.split(" ")[-1].rstrip()
+      else:
+        return to_repl
 
     def replace_and_shorten(self, to_repl):
-      return lambda mo: 'a href="http://'+os.popen("gnunet-gns -s 
"+string.replace(mo.group(1)+to_repl, 'a href="http://', 
"")).readlines()[0].split(" ")[-1].rstrip()
+      return lambda mo: test_re(self, to_repl, mo)
+    #  return lambda mo: 'a href="http://'+os.popen("gnunet-gns -s 
"+string.replace(mo.group(1)+to_repl, 'a href="http://', 
"")).readlines()[0].split(" ")[-1].rstrip()
     #full = string.replace(mo.group(1)+to_repl, 'a href="http://', "")
         #print 'calling gnunet-gns -s '+full
         #s = os.popen("gnunet-gns -s "+full)

Added: gnunet/src/gns/test_gns_defaults.conf
===================================================================
--- gnunet/src/gns/test_gns_defaults.conf                               (rev 0)
+++ gnunet/src/gns/test_gns_defaults.conf       2012-04-03 13:08:07 UTC (rev 
20878)
@@ -0,0 +1,75 @@
+[PATHS]
+SERVICEHOME = /tmp/test-gnunet-testing/
+DEFAULTCONFIG = test_testing_defaults.conf
+
+[resolver]
+PORT = 2564
+
+[transport]
+PORT = 2565
+PLUGINS = tcp
+
+[arm]
+PORT = 2566
+DEFAULTSERVICES = 
+
+[statistics]
+PORT = 2567
+
+[transport-tcp]
+PORT = 2568
+BINDTO = 127.0.0.1
+
+[peerinfo]
+PORT = 2569
+
+[core]
+PORT = 2570
+
+[testing]
+NUM_PEERS = 5
+WEAKRANDOM = YES
+F2F = YES
+HOSTKEYSFILE = ../../contrib/testing_hostkeys.dat
+
+[dht]
+AUTOSTART = NO
+
+[nat]
+DISABLEV6 = YES
+ENABLE_UPNP = NO
+BEHIND_NAT = NO
+ALLOW_NAT = NO
+INTERNAL_ADDRESS = 127.0.0.1
+EXTERNAL_ADDRESS = 127.0.0.1
+USE_LOCALADDR = NO
+
+[dns]
+AUTOSTART = NO
+
+[nse]
+AUTOSTART = NO
+
+[mesh]
+AUTOSTART = NO
+
+[datastore]
+AUTOSTART = NO
+
+[fs]
+AUTOSTART = NO
+
+[dv]
+AUTOSTART = NO
+
+[chat]
+AUTOSTART = NO
+
+[vpn]
+AUTOSTART = NO
+
+[gns]
+AUTOSTART = NO
+
+[namestore]
+AUTOSTART = NO
\ No newline at end of file




reply via email to

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