From: Martin Schanzenbach Date: Mon, 26 Mar 2012 12:00:26 +0000 (+0000) Subject: -add leho to proxy X-Git-Tag: initial-import-from-subversion-38251~14084 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=117335dc011ddbfb08bc71391c2dadf6ba28c4bf;p=oweals%2Fgnunet.git -add leho to proxy --- diff --git a/src/gns/proxy/proxy.py b/src/gns/proxy/proxy.py index 468256a11..eca2e43d2 100644 --- a/src/gns/proxy/proxy.py +++ b/src/gns/proxy/proxy.py @@ -109,6 +109,16 @@ class ProxyHandler (BaseHTTPServer.BaseHTTPRequestHandler): self.command, urlparse.urlunparse(('', '', path, params, query, '')), self.request_version)) + 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!" + elif (len(leho) == 1): + print "Legacy hostname not present!" + else: + newhost = leho[1].split(" ")[-1].rstrip() + print "Changing Host: "+self.headers['Host']+" to "+newhost + self.headers['Host'] = newhost self.headers['Connection'] = 'close' del self.headers['Proxy-Connection'] for key_val in self.headers.items():