gnunet-svn
[Top][All Lists]
Advanced

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

[GNUnet-SVN] r20886 - gnunet/src/gns/proxy


From: gnunet
Subject: [GNUnet-SVN] r20886 - gnunet/src/gns/proxy
Date: Tue, 3 Apr 2012 15:59:59 +0200

Author: schanzen
Date: 2012-04-03 15:59:59 +0200 (Tue, 03 Apr 2012)
New Revision: 20886

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:59:25 UTC (rev 
20885)
+++ gnunet/src/gns/proxy/gnunet-gns-proxy.py    2012-04-03 13:59:59 UTC (rev 
20886)
@@ -44,6 +44,8 @@
         i = netloc.find(':')
         to_replace = ""
         if i >= 0:
+          self.host_port = netloc[:i], int(netloc[i+1:])
+          if (re.match("(\w+\.)*gnunet$", self.host_port[0])):
             print 'calling gnunet-gns -a '+netloc[:i]
             auth = os.popen("gnunet-gns -a "+netloc[:i])
             lines = auth.readlines()
@@ -52,8 +54,9 @@
               to_replace = lines[0].split(" ")[-1].rstrip()
             else:
               to_replace = "+"
-            self.host_port = netloc[:i], int(netloc[i+1:])
         else:
+          self.host_port = netloc, 80
+          if (re.match("(\w+\.)*gnunet$", self.host_port[0])):
             print 'calling gnunet-gns -a '+netloc
             auth = os.popen("gnunet-gns -a "+netloc)
             lines = auth.readlines()
@@ -62,7 +65,7 @@
               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)
         except socket.error, arg:
@@ -137,7 +140,7 @@
                     self.command,
                     urlparse.urlunparse(('', '', path, params, query, '')),
                     self.request_version))
-                if (re.match("(\w+\.)*gnunet", self.headers['Host'])):
+                if (re.match("(\w+\.)*gnunet$", self.headers['Host'])):
                   leho = os.popen("gnunet-gns -t LEHO -u 
"+self.headers['Host']).readlines()
                   if (len(leho) < 2):
                     print "Legacy hostname lookup failed!"
@@ -181,12 +184,13 @@
                           data = re.sub(r'\nAccept-Ranges: \w+', r'', data)
                           data = re.sub('(a href="http://(\w+\.)*zkey)',
                               self.shorten_zkey(), data)
-                          if (re.match("(\w+\.)*gnunet", self.host_port[0])):
+                          if (re.match("(\w+\.)*gnunet$", self.host_port[0])):
                               arr = self.host_port[0].split('.')
                               arr.pop(0)
                               data = re.sub('(a href="http://(\w+\.)*)(\+)',
                                   self.replace_and_shorten(to_repl), data)
                           out.send(data)
+                          print data
                           count = 0
                         #except:
                         #  print "GNS exception:", sys.exc_info()[0]




reply via email to

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