Comparing version 0.11.0 to 0.12.0
@@ -40,2 +40,3 @@ /* | ||
this.strictWrite = (strictWrite !== undefined ? strictWrite : true); | ||
this._seqid = null; | ||
}; | ||
@@ -58,3 +59,3 @@ | ||
// Record client seqid to find callback again | ||
if (this._seqid) { | ||
if (this._seqid !== null) { | ||
log.warning('SeqId already set', { 'name': name }); | ||
@@ -68,3 +69,3 @@ } else { | ||
TBinaryProtocol.prototype.writeMessageEnd = function() { | ||
if (this._seqid) { | ||
if (this._seqid !== null) { | ||
this._seqid = null; | ||
@@ -71,0 +72,0 @@ } else { |
@@ -35,1 +35,3 @@ /* | ||
exports.TCompactProtocol = require('./compact_protocol'); | ||
exports.Int64 = require('node-int64'); |
@@ -36,2 +36,10 @@ /* | ||
TBufferedTransport.prototype.reset = function() { | ||
this.inBuf = new Buffer(this.defaultReadBufferSize); | ||
this.readCursor = 0; | ||
this.writeCursor = 0; | ||
this.outBuffers = []; | ||
this.outCount = 0; | ||
} | ||
TBufferedTransport.receiver = function(callback, seqid) { | ||
@@ -38,0 +46,0 @@ var reader = new TBufferedTransport(); |
@@ -235,3 +235,7 @@ /* | ||
self.connection.connect(self.port, self.host); | ||
if (self.path !== undefined) { | ||
self.connection.connect(self.path); | ||
} else { | ||
self.connection.connect(self.port, self.host); | ||
} | ||
self.retry_timer = null; | ||
@@ -250,2 +254,10 @@ }, this.retry_delay); | ||
exports.createUDSConnection = function(path, options) { | ||
var stream = net.createConnection(path); | ||
var connection = new Connection(stream, options); | ||
connection.path = path; | ||
return connection; | ||
}; | ||
exports.createSSLConnection = function(host, port, options) { | ||
@@ -252,0 +264,0 @@ if (!('secureProtocol' in options) && !('secureOptions' in options)) { |
@@ -62,4 +62,2 @@ /* | ||
* @constructor | ||
* @param {string} host - The host name or IP to connect to. | ||
* @param {number} port - The TCP port to connect to. | ||
* @param {ConnectOptions} options - The configuration options to use. | ||
@@ -75,3 +73,3 @@ * @throws {error} Exceptions other than InputBufferUnderrunError are rethrown | ||
*/ | ||
var HttpConnection = exports.HttpConnection = function(host, port, options) { | ||
var HttpConnection = exports.HttpConnection = function(options) { | ||
//Initialize the emitter base object | ||
@@ -83,4 +81,5 @@ EventEmitter.call(this); | ||
this.options = options || {}; | ||
this.host = host; | ||
this.port = port; | ||
this.host = this.options.host; | ||
this.port = this.options.port; | ||
this.socketPath = this.options.socketPath; | ||
this.https = this.options.https || false; | ||
@@ -93,3 +92,4 @@ this.transport = this.options.transport || TBufferedTransport; | ||
host: this.host, | ||
port: this.port || 80, | ||
port: this.port, | ||
socketPath: this.socketPath, | ||
path: this.options.path || '/', | ||
@@ -177,3 +177,3 @@ method: 'POST', | ||
if (response.statusCode !== 200) { | ||
this.emit("error", new THTTPException(statusCode, response)); | ||
this.emit("error", new THTTPException(response)); | ||
} | ||
@@ -246,13 +246,20 @@ | ||
exports.createHttpConnection = function(host, port, options) { | ||
return new HttpConnection(host, port, options); | ||
options.host = host; | ||
options.port = port || 80; | ||
return new HttpConnection(options); | ||
}; | ||
exports.createHttpUDSConnection = function(path, options) { | ||
options.socketPath = path; | ||
return new HttpConnection(options); | ||
}; | ||
exports.createHttpClient = createClient | ||
function THTTPException(statusCode, response) { | ||
function THTTPException(response) { | ||
thrift.TApplicationException.call(this); | ||
Error.captureStackTrace(this, this.constructor); | ||
this.name = this.constructor.name; | ||
this.statusCode = statusCode; | ||
this.statusCode = response.statusCode; | ||
this.response = response; | ||
@@ -262,2 +269,2 @@ this.type = thrift.TApplicationExceptionType.PROTOCOL_ERROR; | ||
} | ||
util.inherits(THTTPException, thrift.TApplicationException); | ||
util.inherits(THTTPException, thrift.TApplicationException); |
@@ -30,2 +30,3 @@ /* | ||
exports.createConnection = connection.createConnection; | ||
exports.createUDSConnection = connection.createUDSConnection; | ||
exports.createSSLConnection = connection.createSSLConnection; | ||
@@ -38,2 +39,3 @@ exports.createStdIOClient = connection.createStdIOClient; | ||
exports.createHttpConnection = httpConnection.createHttpConnection; | ||
exports.createHttpUDSConnection = httpConnection.createHttpUDSConnection; | ||
exports.createHttpClient = httpConnection.createHttpClient; | ||
@@ -40,0 +42,0 @@ |
@@ -21,3 +21,2 @@ /* | ||
var Int64 = require('node-int64'); | ||
var InputBufferUnderrunError = require('./transport').InputBufferUnderrunError; | ||
var Thrift = require('./thrift'); | ||
@@ -742,3 +741,63 @@ var Type = Thrift.Type; | ||
TJSONProtocol.prototype.skip = function(type) { | ||
throw new Error('skip not supported yet'); | ||
switch (type) { | ||
case Type.STOP: | ||
return; | ||
case Type.BOOL: | ||
this.readBool(); | ||
break; | ||
case Type.BYTE: | ||
this.readByte(); | ||
break; | ||
case Type.I16: | ||
this.readI16(); | ||
break; | ||
case Type.I32: | ||
this.readI32(); | ||
break; | ||
case Type.I64: | ||
this.readI64(); | ||
break; | ||
case Type.DOUBLE: | ||
this.readDouble(); | ||
break; | ||
case Type.STRING: | ||
this.readString(); | ||
break; | ||
case Type.STRUCT: | ||
this.readStructBegin(); | ||
while (true) { | ||
var r = this.readFieldBegin(); | ||
if (r.ftype === Type.STOP) { | ||
break; | ||
} | ||
this.skip(r.ftype); | ||
this.readFieldEnd(); | ||
} | ||
this.readStructEnd(); | ||
break; | ||
case Type.MAP: | ||
var mapBegin = this.readMapBegin(); | ||
for (var i = 0; i < mapBegin.size; ++i) { | ||
this.skip(mapBegin.ktype); | ||
this.skip(mapBegin.vtype); | ||
} | ||
this.readMapEnd(); | ||
break; | ||
case Type.SET: | ||
var setBegin = this.readSetBegin(); | ||
for (var i2 = 0; i2 < setBegin.size; ++i2) { | ||
this.skip(setBegin.etype); | ||
} | ||
this.readSetEnd(); | ||
break; | ||
case Type.LIST: | ||
var listBegin = this.readListBegin(); | ||
for (var i3 = 0; i3 < listBegin.size; ++i3) { | ||
this.skip(listBegin.etype); | ||
} | ||
this.readListEnd(); | ||
break; | ||
default: | ||
throw new Error("Invalid type: " + type); | ||
} | ||
}; |
@@ -418,3 +418,11 @@ /* | ||
var uri = url.parse(request.url).pathname; | ||
var filename = path.join(baseDir, uri); | ||
var filename = path.resolve(path.join(baseDir, uri)); | ||
//Ensure the basedir path is not able to be escaped | ||
if (filename.indexOf(baseDir) != 0) { | ||
response.writeHead(400, "Invalid request path", {}); | ||
response.end(); | ||
return; | ||
} | ||
fs.exists(filename, function(exists) { | ||
@@ -421,0 +429,0 @@ if(!exists) { |
@@ -25,3 +25,3 @@ Thrift Node.js Library | ||
node version 4 or later is required | ||
node version 6 or later is required | ||
@@ -42,21 +42,23 @@ ## Install | ||
var thrift = require('thrift'), | ||
Cassandra = require('./gen-nodejs/Cassandra') | ||
ttypes = require('./gen-nodejs/cassandra_types'); | ||
```js | ||
var thrift = require('thrift'), | ||
Cassandra = require('./gen-nodejs/Cassandra') | ||
ttypes = require('./gen-nodejs/cassandra_types'); | ||
var connection = thrift.createConnection("localhost", 9160), | ||
client = thrift.createClient(Cassandra, connection); | ||
var connection = thrift.createConnection("localhost", 9160), | ||
client = thrift.createClient(Cassandra, connection); | ||
connection.on('error', function(err) { | ||
console.error(err); | ||
}); | ||
connection.on('error', function(err) { | ||
console.error(err); | ||
}); | ||
client.get_slice("Keyspace", "key", new ttypes.ColumnParent({column_family: "ExampleCF"}), new ttypes.SlicePredicate({slice_range: new ttypes.SliceRange({start: '', finish: ''})}), ttypes.ConsistencyLevel.ONE, function(err, data) { | ||
if (err) { | ||
// handle err | ||
} else { | ||
// data == [ttypes.ColumnOrSuperColumn, ...] | ||
} | ||
connection.end(); | ||
}); | ||
client.get_slice("Keyspace", "key", new ttypes.ColumnParent({column_family: "ExampleCF"}), new ttypes.SlicePredicate({slice_range: new ttypes.SliceRange({start: '', finish: ''})}), ttypes.ConsistencyLevel.ONE, function(err, data) { | ||
if (err) { | ||
// handle err | ||
} else { | ||
// data == [ttypes.ColumnOrSuperColumn, ...] | ||
} | ||
connection.end(); | ||
}); | ||
``` | ||
@@ -63,0 +65,0 @@ <a name="int64"></a> |
@@ -7,5 +7,5 @@ { | ||
"type": "git", | ||
"url": "https://git-wip-us.apache.org/repos/asf/thrift.git" | ||
"url": "https://github.com/apache/thrift.git" | ||
}, | ||
"version": "0.11.0", | ||
"version": "0.12.0", | ||
"author": { | ||
@@ -41,20 +41,28 @@ "name": "Apache Thrift Developers", | ||
"q": "^1.5.0", | ||
"ws": ">= 2.2.3" | ||
"ws": "^5.0.0" | ||
}, | ||
"devDependencies": { | ||
"buffer-equals": "^1.0.4", | ||
"commander": "^2.11.0", | ||
"connect": "^3.6.4", | ||
"commander": "^2.14.1", | ||
"connect": "^3.6.6", | ||
"eslint": "^5.7.0", | ||
"eslint-config-prettier": "^3.1.0", | ||
"eslint-plugin-prettier": "^3.0.0", | ||
"istanbul": "^0.4.5", | ||
"jsdoc": ">=3.5.5", | ||
"minimatch": "^3.0.4", | ||
"phantomjs-prebuilt": "^2.1.7", | ||
"run-browser": "^2.0.2", | ||
"tape": "^4.8.0", | ||
"utf-8-validate": "^3.0.0" | ||
"jsdoc": "^3.5.5", | ||
"prettier": "^1.14.3", | ||
"tape": "^4.9.0", | ||
"utf-8-validate": "^4.0.0", | ||
"typescript": "^3.1.6", | ||
"@types/node": "^10.12.6", | ||
"@types/q": "^1.5.1" | ||
}, | ||
"scripts": { | ||
"cover": "lib/nodejs/test/testAll.sh COVER", | ||
"test": "lib/nodejs/test/testAll.sh" | ||
"test": "lib/nodejs/test/testAll.sh", | ||
"test-ts": "lib/nodets/test/testAll.sh", | ||
"prettier": "prettier --write '**/*.js'", | ||
"lint": "eslint lib/nodejs/. --ext .js", | ||
"lint-tests": "eslint lib/nodejs/test/. --ext .js" | ||
} | ||
} |
Apache Thrift | ||
============= | ||
Last Modified: 2017-11-10 | ||
Introduction | ||
============ | ||
Thrift is a lightweight, language-independent software stack with an | ||
associated code generation mechanism for point-to-point RPC. Thrift provides | ||
clean abstractions for data transport, data serialization, and application | ||
level processing. The code generation system takes a simple definition | ||
language as input and generates code across programming languages that | ||
uses the abstracted stack to build interoperable RPC clients and servers. | ||
![Apache Thrift Layered Architecture](doc/images/thrift-layers.png) | ||
Thrift makes it easy for programs written in different programming | ||
languages to share data and call remote procedures. With support | ||
for [25 programming languages](LANGUAGES.md), chances are Thrift | ||
supports the languages that you currently use. | ||
Thrift is specifically designed to support non-atomic version changes | ||
across client and server code. | ||
For more details on Thrift's design and implementation, see the Thrift | ||
whitepaper included in this distribution, or at the README.md file | ||
in your particular subdirectory of interest. | ||
Status | ||
====== | ||
| Branch | Travis | Appveyor | Coverity Scan | codecov.io | Website | | ||
| :----- | :----- | :------- | :------------ | :--------- | :------ | | ||
| [`master`](https://github.com/apache/thrift/tree/master) | [![Build Status](https://travis-ci.org/apache/thrift.svg?branch=master)](https://travis-ci.org/apache/thrift) | [![Build status](https://ci.appveyor.com/api/projects/status/github/apache/thrift?branch=master&svg=true)](https://ci.appveyor.com/project/ApacheSoftwareFoundation/thrift/history) | [![Coverity Scan Build Status](https://scan.coverity.com/projects/1345/badge.svg)](https://scan.coverity.com/projects/thrift) | | [![Website](https://img.shields.io/badge/official-website-brightgreen.svg)](https://thrift.apache.org/) | | ||
Releases | ||
======== | ||
Thrift does not maintain a specific release calendar at this time. | ||
We strive to release twice yearly. Download the [current release](http://thrift.apache.org/download). | ||
License | ||
@@ -26,26 +62,2 @@ ======= | ||
Introduction | ||
============ | ||
Thrift is a lightweight, language-independent software stack with an | ||
associated code generation mechanism for RPC. Thrift provides clean | ||
abstractions for data transport, data serialization, and application | ||
level processing. The code generation system takes a simple definition | ||
language as its input and generates code across programming languages that | ||
uses the abstracted stack to build interoperable RPC clients and servers. | ||
![Apache Thrift Layered Architecture](doc/images/thrift-layers.png) | ||
Thrift makes it easy for programs written in different programming | ||
languages to share data and call remote procedures. With support | ||
for [over 20 programming languages](LANGUAGES.md), chances are Thrift | ||
supports the ones that you currently use. | ||
Thrift is specifically designed to support non-atomic version changes | ||
across client and server code. | ||
For more details on Thrift's design and implementation, take a gander at | ||
the Thrift whitepaper included in this distribution or at the README.md file | ||
in your particular subdirectory of interest. | ||
Project Hierarchy | ||
@@ -83,6 +95,12 @@ ================= | ||
Development | ||
=========== | ||
To build the same way Travis CI builds the project you should use docker. | ||
We have [comprehensive building instructions for docker](build/docker/README.md). | ||
Requirements | ||
============ | ||
See http://thrift.apache.org/docs/install for an up-to-date list of build requirements. | ||
See http://thrift.apache.org/docs/install for a list of build requirements (may be stale). Alternatively see the docker build environments for a list of prerequisites. | ||
@@ -176,6 +194,2 @@ Resources | ||
Development | ||
=========== | ||
To build the same way Travis CI builds the project you should use docker. | ||
We have [comprehensive building instructions for docker](build/docker/README.md). |
Sorry, the diff of this file is not supported yet
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
Unidentified License
License(Experimental) Something that seems like a license was found, but its contents could not be matched with a known license.
Found 1 instance in 1 package
405972
31
5082
193
14
314144
1
80
10
+ Addedasync-limiter@1.0.1(transitive)
+ Addedws@5.2.4(transitive)
- Removedws@8.18.0(transitive)
Updatedws@^5.0.0