[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[tor-commits] [ooni-probe/master] Add meek test default inputs



commit 46ea4280cc97eba726650d08b73c1edb18074d59
Author: anadahz <kojgelo@xxxxxxxxx>
Date:   Fri Apr 17 01:40:23 2015 +0200

    Add meek test default inputs
    
    The default inputs (domain name and host header) combinations needed to
    reach the meek servers. Without any parameters the test will use these
    default inputs.
---
 ooni/nettests/blocking/meek_fronted_requests.py |   15 ++++++++++-----
 1 file changed, 10 insertions(+), 5 deletions(-)

diff --git a/ooni/nettests/blocking/meek_fronted_requests.py b/ooni/nettests/blocking/meek_fronted_requests.py
index 6e3cb7a..762e27e 100644
--- a/ooni/nettests/blocking/meek_fronted_requests.py
+++ b/ooni/nettests/blocking/meek_fronted_requests.py
@@ -23,11 +23,10 @@ class meekTest(httpt.HTTPTest):
     and response with: "Iâ??m just a happy little web server.\n".
     The input file should be formatted as (one per line):
     "DomainName:HostHeader"
-
-    Some default meek DomainName and HostHeader combinations:
     www.google.com:meek-reflect.appspot.com
     ajax.aspnetcdn.com:az668014.vo.msecnd.net
     a0.awsstatic.com:d2zfqthxsdq309.cloudfront.net
+
     """
     name = "meek fronted requests test"
     version = "0.0.1"
@@ -36,6 +35,9 @@ class meekTest(httpt.HTTPTest):
     inputFile = ['file', 'f', None,
                   "File containing the DomainName:HostHeader combinations to\
                   be tested, one per line."]
+    inputs = [('www.google.com', 'meek-reflect.appspot.com'),
+               ('ajax.aspnetcdn.com', 'az668014.vo.msecnd.net'),
+               ('a0.awsstatic.com', 'd2zfqthxsdq309.cloudfront.net')]
 
     requiresRoot = False
     requiresTor = False
@@ -44,14 +46,16 @@ class meekTest(httpt.HTTPTest):
         """
         Check for inputs.
         """
+
         if self.input:
-            self.DomainName, self.header = self.input.split(':')
+           if (isinstance(self.input, tuple) or isinstace(self.input, list)):
+               self.DomainName, self.header = self.input
+           else:
+               self.DomainName, self.header = self.input.split(':')
         elif (self.localOptions['DomainName'] and
               self.localOptions['HostHeader']):
                self.DomainName = self.localOptions['DomainName']
                self.header = self.localOptions['HostHeader']
-        else:
-            raise Exception("No input specified")
 
         self.ExpectedBody = self.localOptions['ExpectedBody']
         self.DomainName = 'https://' + self.DomainName
@@ -72,3 +76,4 @@ class meekTest(httpt.HTTPTest):
         headers['Host'] = [self.header]
         return self.doRequest(self.DomainName, method="GET", headers=headers,
                               body_processor=process_body)
+



_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits