Use plain http connections to wrapdb when ssl is not working (i.e. on OSX).

pull/319/head
Jussi Pakkanen 9 years ago
parent 16fa657304
commit 4522a3a9a5
  1. 4
      wrap.py
  2. 4
      wraptool.py

@ -17,7 +17,7 @@ import urllib.request, os, hashlib, shutil
import subprocess import subprocess
import sys import sys
from wraptool import build_ssl_context import wraptool
class PackageDefinition: class PackageDefinition:
def __init__(self, fname): def __init__(self, fname):
@ -94,7 +94,7 @@ class Resolver:
def get_data(self, url): def get_data(self, url):
blocksize = 10*1024 blocksize = 10*1024
if url.startswith('https://wrapdb.mesonbuild.com'): if url.startswith('https://wrapdb.mesonbuild.com'):
resp = urllib.request.urlopen(url, context=build_ssl_context()) resp = wraptool.open_wrapdburl(url)
else: else:
resp = urllib.request.urlopen(url) resp = urllib.request.urlopen(url)
dlsize = int(resp.info()['Content-Length']) dlsize = int(resp.info()['Content-Length'])

@ -112,6 +112,10 @@ def open_wrapdburl(urlstring):
print('Warning: ssl not available, traffic not authenticated.', print('Warning: ssl not available, traffic not authenticated.',
file=sys.stderr) file=sys.stderr)
ssl_warning_printed = True ssl_warning_printed = True
# Trying to open SSL connection to wrapdb fails because the
# certificate is not known. Use plain http. For some
# reason OSX fails here again.
urlstring = 'http' + urlstring[5:]
return urllib.request.urlopen(urlstring) return urllib.request.urlopen(urlstring)
def get_result(urlstring): def get_result(urlstring):

Loading…
Cancel
Save