diff options
author | Magnus Ahltorp <map@kth.se> | 2015-06-10 16:15:18 +0200 |
---|---|---|
committer | Magnus Ahltorp <map@kth.se> | 2015-06-10 16:15:18 +0200 |
commit | d6d4cc1239b0f91abfd706857b90ff25d6a87622 (patch) | |
tree | 1da50c5877d3b713c54d3ac298c7022ecdfa282f | |
parent | 75153300f3427f6fbcc7da3f64738ff4f57b2055 (diff) |
Removed python 2.6 SSL workaroundsslworkaroundremove
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.
-rw-r--r-- | tools/certtools.py | 24 |
1 files 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) |