update JetStream URL (#3165)

This commit is contained in:
Alex Lam S.L
2018-05-31 16:23:49 +08:00
committed by GitHub
parent 5843494ee2
commit c76749084b
2 changed files with 5 additions and 2 deletions

View File

@@ -1,4 +1,5 @@
var fs = require("fs"); var fs = require("fs");
var parse = require("url").parse;
var path = require("path"); var path = require("path");
try { try {
@@ -19,7 +20,9 @@ module.exports = function(url, callback) {
var result = read(url); var result = read(url);
result.on("error", function(e) { result.on("error", function(e) {
if (e.code != "ENOENT") return callback(e); if (e.code != "ENOENT") return callback(e);
require(url.slice(0, url.indexOf(":"))).get(url, function(res) { var options = parse(url);
options.rejectUnauthorized = false;
require(options.protocol.slice(0, -1)).get(options, function(res) {
if (res.statusCode !== 200) return callback(res); if (res.statusCode !== 200) return callback(res);
res.pipe(fs.createWriteStream(local(url)).on("close", function() { res.pipe(fs.createWriteStream(local(url)).on("close", function() {
callback(null, read(url)); callback(null, read(url));

View File

@@ -3,7 +3,7 @@
"use strict"; "use strict";
var site = "http://browserbench.org/JetStream"; var site = "https://browserbench.org/JetStream";
if (typeof phantom == "undefined") { if (typeof phantom == "undefined") {
require("../tools/exit"); require("../tools/exit");
var args = process.argv.slice(2); var args = process.argv.slice(2);