Socket
Socket
Sign inDemoInstall

chromedriver

Package Overview
Dependencies
Maintainers
1
Versions
216
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

chromedriver - npm Package Compare versions

Comparing version 2.29.0 to 2.29.1

101

install.js

@@ -6,4 +6,3 @@ 'use strict';

var helper = require('./lib/chromedriver');
var http = require('http');
var https = require('https');
var request = require('request');
var kew = require('kew');

@@ -13,3 +12,2 @@ var mkdirp = require('mkdirp');

var rimraf = require('rimraf').sync;
var url = require('url');
var util = require('util');

@@ -121,3 +119,3 @@

function getRequestOptions(downloadPath) {
var options = url.parse(downloadUrl);
var options = {uri: downloadPath};
var proxyUrl = options.protocol === 'https:'

@@ -127,15 +125,6 @@ ? process.env.npm_config_https_proxy

if (proxyUrl) {
options = url.parse(proxyUrl);
options.path = downloadPath;
options.headers = { Host: url.parse(downloadPath).host };
// Turn basic authorization into proxy-authorization.
if (options.auth) {
options.headers['Proxy-Authorization'] = 'Basic ' + new Buffer(options.auth).toString('base64');
delete options.auth;
}
} else {
options = url.parse(downloadPath);
options.proxy = proxyUrl;
}
options.rejectUnauthorized = !!process.env.npm_config_strict_ssl;
options.strictSSL = !!process.env.npm_config_strict_ssl;

@@ -146,3 +135,3 @@ // Use certificate authority settings from npm

try {
ca = fs.readFileSync(process.env.npm_config_cafile, { encoding: 'utf8' })
ca = fs.readFileSync(process.env.npm_config_cafile, {encoding: 'utf8'})
.split(/\n(?=-----BEGIN CERTIFICATE-----)/g);

@@ -175,19 +164,12 @@

var deferred = kew.defer();
var client = get(requestOptions, function (response) {
var body = '';
if (response.statusCode === 200) {
response.addListener('data', function (data) {
body += data;
});
response.addListener('end', function () {
try {
chromedriver_version = JSON.parse(body);
} catch (err) {
deferred.reject('Unable to parse response as JSON', err);
}
deferred.resolve(true);
});
request.get(requestOptions, function (err, response, data) {
if (err) {
deferred.reject('Error with ' + requestOptions.protocol + ' request: ' + err);
} else {
client.abort();
deferred.reject('Error with ' + requestOptions.protocol + ' request: ' + util.inspect(response.headers));
try {
chromedriver_version = JSON.parse(data);
} catch (jsonErr) {
deferred.reject('Unable to parse response as JSON', jsonErr);
}
deferred.resolve(true);
}

@@ -205,48 +187,26 @@ });

var client = get(requestOptions, function (response) {
var status = response.statusCode;
console.log('Receiving...');
var client = request.get(requestOptions);
if (status === 200) {
response.addListener('data', function (data) {
fs.writeSync(outFile, data, 0, data.length, null);
count += data.length;
if ((count - notifiedCount) > 800000) {
console.log('Received ' + Math.floor(count / 1024) + 'K...');
notifiedCount = count;
}
});
client.on('error', function (err) {
deferred.reject('Error with http request: ' + err);
});
response.addListener('end', function () {
console.log('Received ' + Math.floor(count / 1024) + 'K total.');
fs.closeSync(outFile);
deferred.resolve(true);
});
} else {
client.abort();
deferred.reject('Error with http request: ' + util.inspect(response.headers));
client.on('data', function (data) {
fs.writeSync(outFile, data, 0, data.length, null);
count += data.length;
if ((count - notifiedCount) > 800000) {
console.log('Received ' + Math.floor(count / 1024) + 'K...');
notifiedCount = count;
}
});
client.on('end', function () {
console.log('Received ' + Math.floor(count / 1024) + 'K total.');
fs.closeSync(outFile);
deferred.resolve(true);
});
return deferred.promise;
}
function get(requestOptions, callback, redirects) {
redirects = redirects || 0;
var protocol = requestOptions.protocol === 'https:' ? https : http;
var client = protocol.get(requestOptions, function (response) {
var status = response.statusCode;
if ((status === 302 || status === 301 || status === 307) && redirects < 5) {
console.log('Redirect to %s', response.headers.location);
redirects++;
return get(getRequestOptions(response.headers.location), callback, redirects);
}
callback(response);
});
return client;
}
function extractDownload(filePath, tmpPath) {

@@ -294,3 +254,2 @@ var deferred = kew.defer();

function fixFilePermissions() {

@@ -297,0 +256,0 @@ // Check that the binary is user-executable and fix it if it isn't (problems with unzip library)

{
"name": "chromedriver",
"version": "2.29.0",
"version": "2.29.1",
"keywords": [

@@ -36,4 +36,5 @@ "chromedriver",

"mkdirp": "^0.5.1",
"request": "^2.81.0",
"rimraf": "^2.5.4"
}
}

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc