presto-client
Advanced tools
Comparing version 0.1.3 to 0.2.0
@@ -1,3 +0,12 @@ | ||
var http = require('http'); | ||
var adapterFor = (function() { | ||
adapters = { | ||
'http:': require('http'), | ||
'https:': require('https'), | ||
}; | ||
return function(protocol) { | ||
return adapters[protocol]; | ||
} | ||
}()); | ||
var Headers = require('./headers').Headers; | ||
@@ -18,2 +27,3 @@ | ||
this.user = args.user || process.env.USER; | ||
this.protocol = 'http:'; | ||
@@ -26,2 +36,7 @@ this.catalog = args.catalog; | ||
this.jsonParser = args.jsonParser || JSON; | ||
if (args.ssl) { | ||
this.protocol = 'https:'; | ||
this.ssl = args.ssl; | ||
} | ||
}; | ||
@@ -31,7 +46,10 @@ | ||
var client = this; | ||
var adapter = adapterFor(client.protocol); | ||
var contentBody = null; | ||
var contentBody = null; | ||
if (opts instanceof Object) { | ||
opts.host = client.host; | ||
opts.port = client.port; | ||
opts.protocol = client.protocol; | ||
opts = Object.assign({}, opts, client.ssl); | ||
@@ -48,2 +66,4 @@ if (! opts.headers) | ||
contentBody = opts.body; | ||
opts.agent = new adapter.Agent(opts); // Otherwise SSL params are ignored. | ||
} | ||
@@ -53,3 +73,3 @@ | ||
var req = http.request(opts, function(res){ | ||
var req = adapter.request(opts, function(res){ | ||
var response_code = res.statusCode; | ||
@@ -56,0 +76,0 @@ var response_data = ''; |
{ | ||
"name": "presto-client", | ||
"version": "0.1.3", | ||
"version": "0.2.0", | ||
"description": "Distributed query engine Presto client library for node.js", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -48,2 +48,13 @@ # presto-client-node | ||
* presto coordinator hostname or address (default: localhost) | ||
* ssl [object] | ||
* setting a Hash object enables SSL and verify server certificate with options (default: `null`): | ||
* `ca`: An authority certificate or array of authority certificates to check the remote host against | ||
* `cert`: Public x509 certificate to use (default : `null`) | ||
* `ciphers` : Default cipher suite to use. (default: https://nodejs.org/api/tls.html#tls_modifying_the_default_tls_cipher_suite) | ||
* `key`: Private key to use for SSL (default: `null`) | ||
* `passphrase`: A string of passphrase for the private key or pfx (default: `null`) | ||
* `pfx`: Certificate, Private key and CA certificates to use for SSL. (default: `null`). | ||
* `rejectUnauthorized`: If not `false` the server will reject any connection which is not authorized with the list of supplied CAs. This option only has an effect if requestCert is `true` (default: `true`) | ||
* `secureProtocol`: Optional SSL method to use. The possible values are listed as SSL_METHODS, use the function names as strings. For example, "SSLv3_method" to force SSL version 3 (default: `SSLv23_method`) | ||
* `servername`: Server name for the SNI (Server Name Indication) TLS extension | ||
* port [integer] | ||
@@ -50,0 +61,0 @@ * presto coordinator port (default: 8080) |
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 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
21273
322
230
2