[or-cvs] r18786: {check} Fix a corner case where a user hits us from a server that ex (check/trunk/cgi-bin)

ioerror at seul.org ioerror at seul.org
Fri Mar 6 09:40:11 UTC 2009


Author: ioerror
Date: 2009-03-06 04:40:11 -0500 (Fri, 06 Mar 2009)
New Revision: 18786

Modified:
   check/trunk/cgi-bin/TorCheck.py
Log:
Fix a corner case where a user hits us from a server that exits via 443 (false negative) but their exit policy doesn't allow 80 (bug).


Modified: check/trunk/cgi-bin/TorCheck.py
===================================================================
--- check/trunk/cgi-bin/TorCheck.py	2009-03-06 09:23:08 UTC (rev 18785)
+++ check/trunk/cgi-bin/TorCheck.py	2009-03-06 09:40:11 UTC (rev 18786)
@@ -43,7 +43,7 @@
 # This is not as good as using a cache for obvious reasons
 DNS.DiscoverNameServers()
 
-def isUsingTor(clientIp):
+def isUsingTor(clientIp, ELPort):
     # This is the exit node ip address
     # This is where we want to dynamically recieve this from Apache
     splitIp = clientIp.split('.')
@@ -51,7 +51,7 @@
     ELExitNode = ".".join(splitIp)
 
     # We'll attempt to reach this port on the Target host
-    ELPort = "80"
+    # ELPort is now set by the caller
 
     # We'll try to reach this host
     ElTarget = "217.247.237.209"
@@ -162,7 +162,10 @@
 def handler(req):
 
     # Make a DNS request to the EL and decide what to tell the user
-    UsingTor = isUsingTor(req.connection.remote_ip)
+    UsingTor = isUsingTor(req.connection.remote_ip, 80)
+    # Try to hit a cornercase where the user can exit to 443 but not 80
+    if UsingTor == 0:
+        UsingTor = isUsingTor(req.connection.remote_ip, 443)
 
     req.send_http_header()
     req.content_type = 'text/html; charset=utf-8'



More information about the tor-commits mailing list