From d6d4cc1239b0f91abfd706857b90ff25d6a87622 Mon Sep 17 00:00:00 2001 From: Magnus Ahltorp Date: Wed, 10 Jun 2015 16:15:18 +0200 Subject: Removed python 2.6 SSL workaround On certain errors from the web server, the workaround was called even though 2.7 was used. The workaround doesn't parse URL:s correctly. --- tools/certtools.py | 24 +++++------------------- 1 file changed, 5 insertions(+), 19 deletions(-) diff --git a/tools/certtools.py b/tools/certtools.py index 7796a2c..ed8ab30 100644 --- a/tools/certtools.py +++ b/tools/certtools.py @@ -136,22 +136,15 @@ def pyopenssl_https_get(url): return response_lines[len(response_lines) - 1] def get_sth(baseurl): - try: - result = urlopen(baseurl + "ct/v1/get-sth").read() - except urllib2.URLError: - result = pyopenssl_https_get(baseurl + "ct/v1/get-sth") + result = urlopen(baseurl + "ct/v1/get-sth").read() return json.loads(result) def get_proof_by_hash(baseurl, hash, tree_size): try: params = urllib.urlencode({"hash":base64.b64encode(hash), "tree_size":tree_size}) - try: - result = \ - urlopen(baseurl + "ct/v1/get-proof-by-hash?" + params).read() - except urllib2.URLError: - result = \ - pyopenssl_https_get(baseurl + "ct/v1/get-proof-by-hash?" + params) + result = \ + urlopen(baseurl + "ct/v1/get-proof-by-hash?" + params).read() return json.loads(result) except urllib2.HTTPError, e: print "ERROR:", e.read() @@ -161,12 +154,8 @@ def get_consistency_proof(baseurl, tree_size1, tree_size2): try: params = urllib.urlencode({"first":tree_size1, "second":tree_size2}) - try: - result = \ - urlopen(baseurl + "ct/v1/get-sth-consistency?" + params).read() - except urllib2.URLError: - result = \ - pyopenssl_https_get(baseurl + "ct/v1/get-sth-consistency?" + params) + result = \ + urlopen(baseurl + "ct/v1/get-sth-consistency?" + params).read() return json.loads(result)["consistency"] except urllib2.HTTPError, e: print "ERROR:", e.read() @@ -227,9 +216,6 @@ def get_entries(baseurl, start, end): try: result = urlopen(baseurl + "ct/v1/get-entries?" + params).read() return json.loads(result) - except urllib2.URLError: - result = pyopenssl_https_get(baseurl + "ct/v1/get-entries?" + params) - return json.loads(result) except urllib2.HTTPError, e: print "ERROR:", e.read() sys.exit(1) -- cgit v1.1