when getting the URIs from a user zone file, if there is no scheme, assume https://

This commit is contained in:
Jude Nelson
2017-06-02 13:11:37 -04:00
parent c9c77ca14e
commit 5d288cc5e1

View File

@@ -27,6 +27,7 @@ from jsonschema.exceptions import ValidationError
import re
import keylib
import copy
import urlparse
import virtualchain
from virtualchain.lib.ecdsalib import *
@@ -177,7 +178,16 @@ def user_zonefile_urls(user_zonefile):
if 'target' in urirec:
ret.append(urirec['target'].strip('"'))
return ret
# if there's no scheme, then assume https://
fixed_urls = []
for url in ret:
parts = urlparse.urlparse(url)
if len(parts.scheme) == 0:
url = 'https://' + url
fixed_urls.append(url)
return fixed_urls
def user_zonefile_txts(user_zonefile):