mirror of
https://github.com/cookiengineer/audacity
synced 2025-06-15 15:49:36 +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:
|
if lower:
|
||||||
url = url.lower()
|
url = url.lower()
|
||||||
|
|
||||||
if url.startswith('http://'):
|
#if url.startswith('http://'):
|
||||||
url = url[len('http://'):]
|
# url = url[len('http://'):]
|
||||||
|
|
||||||
# if url.startswith('https://'):
|
if url.startswith('https://'):
|
||||||
# url = url[len('https://'):]
|
url = url[len('https://'):]
|
||||||
|
|
||||||
if url.startswith('www.'):
|
if url.startswith('www.'):
|
||||||
url = url[len('www.'):]
|
url = url[len('www.'):]
|
||||||
|
|
||||||
url = url.strip('/')
|
url = url.strip('/')
|
||||||
|
|
||||||
url = 'http://' + url
|
url = 'https://' + url
|
||||||
|
|
||||||
urlparse.urljoin(config.rooturl, url)
|
urlparse.urljoin(config.rooturl, url)
|
||||||
|
|
||||||
@ -293,10 +293,10 @@ def pos_html_transform(doc, url,filename):
|
|||||||
|
|
||||||
if config.special_mode:
|
if config.special_mode:
|
||||||
# Remove external link rel stylesheet
|
# 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
|
# 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.
|
# Add back relevant stylesheet.
|
||||||
@ -452,7 +452,7 @@ def monobook_hack_skin_css(doc, url):
|
|||||||
|
|
||||||
# Remove external link icons.
|
# Remove external link icons.
|
||||||
if config.remove_png:
|
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
|
return doc
|
||||||
|
|
||||||
@ -569,7 +569,7 @@ def url_open(url):
|
|||||||
conn.close()
|
conn.close()
|
||||||
if L[1] == '': return(['',''])
|
if L[1] == '': return(['',''])
|
||||||
print "connection to", domain, "closed."
|
print "connection to", domain, "closed."
|
||||||
conn = httplib.HTTPConnection(L[1])
|
conn = httplib.HTTPSConnection(L[1])
|
||||||
domain = L[1]
|
domain = L[1]
|
||||||
print "connection to", domain, "opened."
|
print "connection to", domain, "opened."
|
||||||
|
|
||||||
@ -598,13 +598,13 @@ def url_open(url):
|
|||||||
if r.status == 500:
|
if r.status == 500:
|
||||||
print " eventually this error might be recovered. let's try again."
|
print " eventually this error might be recovered. let's try again."
|
||||||
print ' reconnecting...'
|
print ' reconnecting...'
|
||||||
conn = httplib.HTTPConnection(domain)
|
conn = httplib.HTTPSConnection(domain)
|
||||||
attempts += 1
|
attempts += 1
|
||||||
continue
|
continue
|
||||||
if r.status == 403:
|
if r.status == 403:
|
||||||
print " that shouldn't happen, but let's try again anyway."
|
print " that shouldn't happen, but let's try again anyway."
|
||||||
print ' reconnecting...'
|
print ' reconnecting...'
|
||||||
conn = httplib.HTTPConnection(domain)
|
conn = httplib.HTTPSConnection(domain)
|
||||||
attempts += 1
|
attempts += 1
|
||||||
continue
|
continue
|
||||||
if attempts != 0:
|
if attempts != 0:
|
||||||
@ -619,7 +619,7 @@ def url_open(url):
|
|||||||
if e.__class__.__name__ in ['BadStatusLine', 'ImproperConnectionState', 'NotConnected', 'IncompleteRead', 'ResponseNotReady']:
|
if e.__class__.__name__ in ['BadStatusLine', 'ImproperConnectionState', 'NotConnected', 'IncompleteRead', 'ResponseNotReady']:
|
||||||
print "eventually this error might be recovered. let's try again."
|
print "eventually this error might be recovered. let's try again."
|
||||||
print 'reconnecting...'
|
print 'reconnecting...'
|
||||||
conn = httplib.HTTPConnection(domain)
|
conn = httplib.HTTPSConnection(domain)
|
||||||
attempts += 1
|
attempts += 1
|
||||||
else:
|
else:
|
||||||
print "it's not possible to recover this error."
|
print "it's not possible to recover this error."
|
||||||
@ -968,7 +968,7 @@ def run(out=sys.stdout):
|
|||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
||||||
domain = get_domain(config.rooturl)
|
domain = get_domain(config.rooturl)
|
||||||
conn = httplib.HTTPConnection(domain)
|
conn = httplib.HTTPSConnection(domain)
|
||||||
print 'connection established to:', domain
|
print 'connection established to:', domain
|
||||||
complete = set()
|
complete = set()
|
||||||
pending = set([config.rooturl])
|
pending = set([config.rooturl])
|
||||||
|
Loading…
x
Reference in New Issue
Block a user