web3-providers-http
Advanced tools
Comparing version 1.1.0 to 1.2.0
{ | ||
"name": "web3-providers-http", | ||
"version": "1.1.0", | ||
"description": "Module to handle web3 RPC connections over HTTP.", | ||
"repository": "https://github.com/ethereum/web3.js/tree/master/packages/web3-providers-http", | ||
"license": "LGPL-3.0", | ||
"main": "src/index.js", | ||
"dependencies": { | ||
"web3-core-helpers": "^1.1.0", | ||
"xmlhttprequest": "*", | ||
"xhr2": "*" | ||
} | ||
"name": "web3-providers-http", | ||
"version": "1.2.0", | ||
"description": "Module to handle web3 RPC connections over HTTP.", | ||
"repository": "https://github.com/ethereum/web3.js/tree/1.x/packages/web3-providers-http", | ||
"license": "LGPL-3.0", | ||
"engines": { | ||
"node": ">=8.0.0 <=11.15.0" | ||
}, | ||
"main": "src/index.js", | ||
"dependencies": { | ||
"web3-core-helpers": "1.2.0", | ||
"xhr2-cookies": "1.1.0" | ||
} | ||
} |
@@ -19,5 +19,5 @@ /* | ||
* @authors: | ||
* Marek Kotewicz <marek@ethdev.com> | ||
* Marian Oancea <marian@ethdev.com> | ||
* Fabian Vogelsteller <fabian@ethdev.com> | ||
* Marek Kotewicz <marek@parity.io> | ||
* Marian Oancea | ||
* Fabian Vogelsteller <fabian@ethereum.org> | ||
* @date 2015 | ||
@@ -27,14 +27,49 @@ */ | ||
var errors = require('web3-core-helpers').errors; | ||
var XHR2 = require('xhr2'); // jshint ignore: line | ||
var XHR2 = require('xhr2-cookies').XMLHttpRequest // jshint ignore: line | ||
var http = require('http'); | ||
var https = require('https'); | ||
/** | ||
* HttpProvider should be used to send rpc calls over http | ||
*/ | ||
var HttpProvider = function HttpProvider(host, timeout) { | ||
var HttpProvider = function HttpProvider(host, options) { | ||
options = options || {}; | ||
var keepAlive = | ||
(options.keepAlive === true || options.keepAlive !== false) ? | ||
true : | ||
false; | ||
this.host = host || 'http://localhost:8545'; | ||
this.timeout = timeout || 0; | ||
if (this.host.substring(0,5) === "https") { | ||
this.httpsAgent = new https.Agent({ keepAlive: keepAlive }); | ||
}else{ | ||
this.httpAgent = new http.Agent({ keepAlive: keepAlive }); | ||
} | ||
this.timeout = options.timeout || 0; | ||
this.headers = options.headers; | ||
this.connected = false; | ||
}; | ||
HttpProvider.prototype._prepareRequest = function(){ | ||
var request = new XHR2(); | ||
request.nodejsSet({ | ||
httpsAgent:this.httpsAgent, | ||
httpAgent:this.httpAgent | ||
}); | ||
request.open('POST', this.host, true); | ||
request.setRequestHeader('Content-Type','application/json'); | ||
request.timeout = this.timeout && this.timeout !== 1 ? this.timeout : 0; | ||
request.withCredentials = true; | ||
if(this.headers) { | ||
this.headers.forEach(function(header) { | ||
request.setRequestHeader(header.name, header.value); | ||
}); | ||
} | ||
return request; | ||
}; | ||
/** | ||
@@ -49,7 +84,4 @@ * Should be used to make async request | ||
var _this = this; | ||
var request = new XHR2(); | ||
var request = this._prepareRequest(); | ||
request.open('POST', this.host, true); | ||
request.setRequestHeader('Content-Type','application/json'); | ||
request.onreadystatechange = function() { | ||
@@ -84,3 +116,7 @@ if (request.readyState === 4 && request.timeout !== 1) { | ||
HttpProvider.prototype.disconnect = function () { | ||
//NO OP | ||
}; | ||
module.exports = HttpProvider; |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Network access
Supply chain riskThis module accesses the network.
Found 2 instances in 1 package
No repository
Supply chain riskPackage does not have a linked source code repository. Without this field, a package will have no reference to the location of the source code use to generate the package.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Wildcard dependency
QualityPackage has a dependency with a floating version range. This can cause issues if the dependency publishes a new major version.
Found 2 instances in 1 package
No README
QualityPackage does not have a README. This may indicate a failed publish or a low quality package.
Found 1 instance in 1 package
No repository
Supply chain riskPackage does not have a linked source code repository. Without this field, a package will have no reference to the location of the source code use to generate the package.
Found 1 instance in 1 package
4733
2
3
98
0
46
2
+ Addedxhr2-cookies@1.1.0
+ Addedbn.js@4.11.84.12.0(transitive)
+ Addedbrorand@1.1.0(transitive)
+ Addedbuffer-to-arraybuffer@0.0.5(transitive)
+ Addedcookiejar@2.1.4(transitive)
+ Addeddecode-uri-component@0.2.2(transitive)
+ Addeddecompress-response@3.3.0(transitive)
+ Addeddom-walk@0.1.2(transitive)
+ Addedelliptic@6.6.0(transitive)
+ Addedeth-lib@0.2.7(transitive)
+ Addedglobal@4.4.0(transitive)
+ Addedhash.js@1.1.7(transitive)
+ Addedhmac-drbg@1.0.1(transitive)
+ Addedinherits@2.0.4(transitive)
+ Addedis-function@1.0.2(transitive)
+ Addedmimic-response@1.0.1(transitive)
+ Addedmin-document@2.19.0(transitive)
+ Addedminimalistic-assert@1.0.1(transitive)
+ Addedminimalistic-crypto-utils@1.0.1(transitive)
+ Addedobject-assign@4.1.1(transitive)
+ Addedonce@1.4.0(transitive)
+ Addedparse-headers@2.0.5(transitive)
+ Addedprocess@0.11.10(transitive)
+ Addedquery-string@5.1.1(transitive)
+ Addedrandomhex@0.1.5(transitive)
+ Addedsimple-concat@1.0.1(transitive)
+ Addedsimple-get@2.8.2(transitive)
+ Addedstrict-uri-encode@1.1.0(transitive)
+ Addedtimed-out@4.0.1(transitive)
+ Addedunderscore@1.9.1(transitive)
+ Addedurl-set-query@1.0.0(transitive)
+ Addedweb3-core-helpers@1.2.0(transitive)
+ Addedweb3-eth-iban@1.2.0(transitive)
+ Addedweb3-utils@1.2.0(transitive)
+ Addedwrappy@1.0.2(transitive)
+ Addedxhr@2.6.0(transitive)
+ Addedxhr-request@1.1.0(transitive)
+ Addedxhr-request-promise@0.1.3(transitive)
+ Addedxhr2-cookies@1.1.0(transitive)
+ Addedxtend@4.0.2(transitive)
- Removedxhr2@*
- Removedxmlhttprequest@*
- Removed@ethereumjs/rlp@4.0.1(transitive)
- Removed@ethereumjs/util@8.1.0(transitive)
- Removed@noble/curves@1.4.2(transitive)
- Removed@noble/hashes@1.4.01.5.0(transitive)
- Removed@scure/base@1.1.9(transitive)
- Removed@scure/bip32@1.4.0(transitive)
- Removed@scure/bip39@1.3.0(transitive)
- Removedbn.js@5.2.1(transitive)
- Removedethereum-bloom-filters@1.2.0(transitive)
- Removedethereum-cryptography@2.2.1(transitive)
- Removedmicro-ftch@0.3.1(transitive)
- Removedrandombytes@2.1.0(transitive)
- Removedsafe-buffer@5.2.1(transitive)
- Removedweb3-core-helpers@1.10.4(transitive)
- Removedweb3-eth-iban@1.10.4(transitive)
- Removedweb3-utils@1.10.4(transitive)
- Removedxhr2@0.2.1(transitive)
- Removedxmlhttprequest@1.8.0(transitive)
Updatedweb3-core-helpers@1.2.0