mirror of
https://github.com/servo/servo.git
synced 2025-08-04 13:10:20 +01:00
Commit HSTS preload list to source control
* No longer download the HSTS list as a bootstrap step * Check the current revision of the HSTS list into source
This commit is contained in:
parent
a068a80619
commit
8086034e0b
4 changed files with 11706 additions and 15 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -26,4 +26,3 @@ Servo.app
|
||||||
.config.mk.last
|
.config.mk.last
|
||||||
parser.out
|
parser.out
|
||||||
/glfw
|
/glfw
|
||||||
hsts_preload.json
|
|
||||||
|
|
|
@ -54,8 +54,6 @@ def download(desc, src, writer):
|
||||||
if fsize is not None:
|
if fsize is not None:
|
||||||
pct = recved * 100.0 / fsize
|
pct = recved * 100.0 / fsize
|
||||||
print("\rDownloading %s: %5.1f%%" % (desc, pct), end="")
|
print("\rDownloading %s: %5.1f%%" % (desc, pct), end="")
|
||||||
else:
|
|
||||||
print("\rDownloading %s" % desc, end="")
|
|
||||||
|
|
||||||
sys.stdout.flush()
|
sys.stdout.flush()
|
||||||
writer.write(chunk)
|
writer.write(chunk)
|
||||||
|
@ -207,27 +205,19 @@ class MachCommands(CommandBase):
|
||||||
extract(tgz_file, cargo_dir, movedir=nightly_dir)
|
extract(tgz_file, cargo_dir, movedir=nightly_dir)
|
||||||
print("Cargo ready.")
|
print("Cargo ready.")
|
||||||
|
|
||||||
@Command('bootstrap-hsts-preload',
|
@Command('update-hsts-preload',
|
||||||
description='Download the HSTS preload list',
|
description='Download the HSTS preload list',
|
||||||
category='bootstrap')
|
category='bootstrap')
|
||||||
@CommandArgument('--force', '-f',
|
|
||||||
action='store_true',
|
|
||||||
help='Force download even if HSTS list already exist')
|
|
||||||
def bootstrap_hsts_preload(self, force=False):
|
def bootstrap_hsts_preload(self, force=False):
|
||||||
preload_filename = "hsts_preload.json"
|
preload_filename = "hsts_preload.json"
|
||||||
preload_path = path.join(self.context.topdir, "resources")
|
preload_path = path.join(self.context.topdir, "resources")
|
||||||
|
|
||||||
if not force and path.exists(path.join(preload_path, preload_filename)):
|
|
||||||
print("HSTS preload list already downloaded.", end=" ")
|
|
||||||
print("Use |bootstrap-hsts-preload --force| to download again.")
|
|
||||||
return
|
|
||||||
|
|
||||||
chromium_hsts_url = "https://chromium.googlesource.com/chromium/src" + \
|
chromium_hsts_url = "https://chromium.googlesource.com/chromium/src" + \
|
||||||
"/net/+/master/http/transport_security_state_static.json?format=TEXT"
|
"/net/+/master/http/transport_security_state_static.json?format=TEXT"
|
||||||
|
|
||||||
try:
|
try:
|
||||||
content_base64 = download_bytes("Chromium HSTS preload list", chromium_hsts_url)
|
content_base64 = download_bytes("Chromium HSTS preload list", chromium_hsts_url)
|
||||||
except URLError, e:
|
except urllib2.URLError, e:
|
||||||
print("Unable to download chromium HSTS preload list, are you connected to the internet?")
|
print("Unable to download chromium HSTS preload list, are you connected to the internet?")
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
||||||
|
|
|
@ -324,7 +324,5 @@ class CommandBase(object):
|
||||||
not path.exists(path.join(
|
not path.exists(path.join(
|
||||||
self.config["tools"]["cargo-root"], "cargo", "bin", "cargo")):
|
self.config["tools"]["cargo-root"], "cargo", "bin", "cargo")):
|
||||||
Registrar.dispatch("bootstrap-cargo", context=self.context)
|
Registrar.dispatch("bootstrap-cargo", context=self.context)
|
||||||
if not path.exists(path.join("resources", "hsts_preload.json")):
|
|
||||||
Registrar.dispatch("bootstrap-hsts-preload", context=self.context)
|
|
||||||
|
|
||||||
self.context.bootstrapped = True
|
self.context.bootstrapped = True
|
||||||
|
|
11704
resources/hsts_preload.json
Normal file
11704
resources/hsts_preload.json
Normal file
File diff suppressed because it is too large
Load diff
Loading…
Add table
Add a link
Reference in a new issue