mirror of
https://github.com/cookiengineer/audacity
synced 2025-04-30 15:49:41 +02:00
Bug 1875 - wiki2htm.sh fails with https
This commit is contained in:
parent
f0637eeb85
commit
f8da13f00a
@ -122,18 +122,18 @@ def normalize_url(url, lower=True):
|
||||
if lower:
|
||||
url = url.lower()
|
||||
|
||||
if url.startswith('http://'):
|
||||
url = url[len('http://'):]
|
||||
#if url.startswith('http://'):
|
||||
# url = url[len('http://'):]
|
||||
|
||||
# if url.startswith('https://'):
|
||||
# url = url[len('https://'):]
|
||||
if url.startswith('https://'):
|
||||
url = url[len('https://'):]
|
||||
|
||||
if url.startswith('www.'):
|
||||
url = url[len('www.'):]
|
||||
|
||||
url = url.strip('/')
|
||||
|
||||
url = 'http://' + url
|
||||
url = 'https://' + url
|
||||
|
||||
urlparse.urljoin(config.rooturl, url)
|
||||
|
||||
@ -293,10 +293,10 @@ def pos_html_transform(doc, url,filename):
|
||||
|
||||
if config.special_mode:
|
||||
# Remove external link rel stylesheet
|
||||
doc = re.sub(r'<link rel="stylesheet" href="http://[\s\S]+?/>', r'', doc)
|
||||
doc = re.sub(r'<link rel="stylesheet" href="https://[\s\S]+?/>', r'', doc)
|
||||
|
||||
# Remove external javascript
|
||||
doc = re.sub(r'<script type="text/javascript" src="http://[\s\S]+?</script>', r'', doc)
|
||||
doc = re.sub(r'<script type="text/javascript" src="https://[\s\S]+?</script>', r'', doc)
|
||||
|
||||
|
||||
# Add back relevant stylesheet.
|
||||
@ -452,7 +452,7 @@ def monobook_hack_skin_css(doc, url):
|
||||
|
||||
# Remove external link icons.
|
||||
if config.remove_png:
|
||||
doc = re.sub(r'#bodyContent a\[href \^="http://"\][\s\S]+?\}', r'', doc)
|
||||
doc = re.sub(r'#bodyContent a\[href \^="https://"\][\s\S]+?\}', r'', doc)
|
||||
|
||||
return doc
|
||||
|
||||
@ -569,7 +569,7 @@ def url_open(url):
|
||||
conn.close()
|
||||
if L[1] == '': return(['',''])
|
||||
print "connection to", domain, "closed."
|
||||
conn = httplib.HTTPConnection(L[1])
|
||||
conn = httplib.HTTPSConnection(L[1])
|
||||
domain = L[1]
|
||||
print "connection to", domain, "opened."
|
||||
|
||||
@ -598,13 +598,13 @@ def url_open(url):
|
||||
if r.status == 500:
|
||||
print " eventually this error might be recovered. let's try again."
|
||||
print ' reconnecting...'
|
||||
conn = httplib.HTTPConnection(domain)
|
||||
conn = httplib.HTTPSConnection(domain)
|
||||
attempts += 1
|
||||
continue
|
||||
if r.status == 403:
|
||||
print " that shouldn't happen, but let's try again anyway."
|
||||
print ' reconnecting...'
|
||||
conn = httplib.HTTPConnection(domain)
|
||||
conn = httplib.HTTPSConnection(domain)
|
||||
attempts += 1
|
||||
continue
|
||||
if attempts != 0:
|
||||
@ -619,7 +619,7 @@ def url_open(url):
|
||||
if e.__class__.__name__ in ['BadStatusLine', 'ImproperConnectionState', 'NotConnected', 'IncompleteRead', 'ResponseNotReady']:
|
||||
print "eventually this error might be recovered. let's try again."
|
||||
print 'reconnecting...'
|
||||
conn = httplib.HTTPConnection(domain)
|
||||
conn = httplib.HTTPSConnection(domain)
|
||||
attempts += 1
|
||||
else:
|
||||
print "it's not possible to recover this error."
|
||||
@ -968,7 +968,7 @@ def run(out=sys.stdout):
|
||||
sys.exit(1)
|
||||
|
||||
domain = get_domain(config.rooturl)
|
||||
conn = httplib.HTTPConnection(domain)
|
||||
conn = httplib.HTTPSConnection(domain)
|
||||
print 'connection established to:', domain
|
||||
complete = set()
|
||||
pending = set([config.rooturl])
|
||||
|
Loading…
x
Reference in New Issue
Block a user