Compare commits
7 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| c4494ff88a | |||
| cfb2a86838 | |||
| 6a92cacf62 | |||
| 2be829546b | |||
| 7f3bb13b5c | |||
| ffa0aa3a8f | |||
| 7c64c35c74 |
@@ -11,6 +11,7 @@ node_js:
|
||||
- "iojs-3"
|
||||
- "4"
|
||||
- "5"
|
||||
- "6"
|
||||
|
||||
before_install:
|
||||
- '[ "${TRAVIS_NODE_VERSION}" = "0.6" ] && npm conf set strict-ssl false || true'
|
||||
|
||||
@@ -1,3 +1,11 @@
|
||||
### 0.6.5 / 2016-05-20
|
||||
|
||||
* Don't mutate buffers passed in by the application when masking
|
||||
|
||||
### 0.6.4 / 2016-01-07
|
||||
|
||||
* If a number is given as input for a frame payload, send it as a string
|
||||
|
||||
### 0.6.3 / 2015-11-06
|
||||
|
||||
* Reject draft-76 handshakes if their Sec-WebSocket-Key headers are invalid
|
||||
|
||||
@@ -0,0 +1,4 @@
|
||||
# Code of Conduct
|
||||
|
||||
All projects under the [Faye](https://github.com/faye) umbrella are covered by
|
||||
the [Code of Conduct](https://github.com/faye/code-of-conduct).
|
||||
@@ -363,7 +363,7 @@ using the `Sec-WebSocket-Protocol` mechanism. This value becomes available after
|
||||
|
||||
(The MIT License)
|
||||
|
||||
Copyright (c) 2010-2015 James Coglan
|
||||
Copyright (c) 2010-2016 James Coglan
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||
this software and associated documentation files (the 'Software'), to deal in
|
||||
|
||||
@@ -83,6 +83,8 @@ var instance = {
|
||||
if (this.readyState === 0) return this._queue([buffer]);
|
||||
if (this.readyState > 1) return false;
|
||||
|
||||
if (typeof buffer !== 'string') buffer = buffer.toString();
|
||||
|
||||
var payload = new Buffer(buffer, 'utf8'),
|
||||
frame = new Buffer(payload.length + 2);
|
||||
|
||||
|
||||
@@ -192,7 +192,8 @@ var instance = {
|
||||
if (this.readyState <= 0) return this._queue([buffer, type, code]);
|
||||
if (this.readyState > 2) return false;
|
||||
|
||||
if (buffer instanceof Array) buffer = new Buffer(buffer);
|
||||
if (buffer instanceof Array) buffer = new Buffer(buffer);
|
||||
if (typeof buffer === 'number') buffer = buffer.toString();
|
||||
|
||||
var message = new Message(),
|
||||
isText = (typeof buffer === 'string'),
|
||||
@@ -263,11 +264,11 @@ var instance = {
|
||||
buffer.writeUInt32BE(length % 0x100000000, 6);
|
||||
}
|
||||
|
||||
frame.payload.copy(buffer, offset);
|
||||
|
||||
if (frame.masked) {
|
||||
frame.maskingKey.copy(buffer, header);
|
||||
Hybi.mask(frame.payload, frame.maskingKey).copy(buffer, offset);
|
||||
} else {
|
||||
frame.payload.copy(buffer, offset);
|
||||
Hybi.mask(buffer, frame.maskingKey, offset);
|
||||
}
|
||||
|
||||
this._write(buffer);
|
||||
|
||||
+3
-3
@@ -1,11 +1,11 @@
|
||||
{ "name" : "websocket-driver"
|
||||
, "description" : "WebSocket protocol handler with pluggable I/O"
|
||||
, "homepage" : "http://github.com/faye/websocket-driver-node"
|
||||
, "homepage" : "https://github.com/faye/websocket-driver-node"
|
||||
, "author" : "James Coglan <jcoglan@gmail.com> (http://jcoglan.com/)"
|
||||
, "keywords" : ["websocket"]
|
||||
, "license" : "MIT"
|
||||
|
||||
, "version" : "0.6.3"
|
||||
, "version" : "0.6.5"
|
||||
, "engines" : {"node": ">=0.6.0"}
|
||||
, "main" : "./lib/websocket/driver"
|
||||
, "dependencies" : {"websocket-extensions": ">=0.1.1"}
|
||||
@@ -17,5 +17,5 @@
|
||||
, "url" : "git://github.com/faye/websocket-driver-node.git"
|
||||
}
|
||||
|
||||
, "bugs" : "http://github.com/faye/websocket-driver-node/issues"
|
||||
, "bugs" : "https://github.com/faye/websocket-driver-node/issues"
|
||||
}
|
||||
|
||||
@@ -77,6 +77,11 @@ test.describe("draft-75", function() { with(this) {
|
||||
assertEqual( [0x00, 0x41, 0x70, 0x70, 0x6c, 0x65, 0x20, 0x3d, 0x20, 0xef, 0xa3, 0xbf, 0xff], collector().bytes )
|
||||
}})
|
||||
|
||||
it("converts numbers to strings", function() { with(this) {
|
||||
driver().frame(50)
|
||||
assertEqual( [0x00, 0x35, 0x30, 0xff], collector().bytes )
|
||||
}})
|
||||
|
||||
it("returns true", function() { with(this) {
|
||||
assertEqual( true, driver().frame("lol") )
|
||||
}})
|
||||
|
||||
@@ -420,6 +420,11 @@ test.describe("Hybi", function() { with(this) {
|
||||
assertEqual( [0x82, 0x03, 0x48, 0x65, 0x6c], collector().bytes )
|
||||
}})
|
||||
|
||||
it("converts numbers to strings", function() { with(this) {
|
||||
driver().frame(50)
|
||||
assertEqual( [0x81, 0x02, 0x35, 0x30], collector().bytes )
|
||||
}})
|
||||
|
||||
it("encodes multibyte characters correctly", function() { with(this) {
|
||||
driver().frame("Apple = ")
|
||||
assertEqual( [0x81, 0x0b, 0x41, 0x70, 0x70, 0x6c, 0x65, 0x20, 0x3d, 0x20, 0xef, 0xa3, 0xbf], collector().bytes )
|
||||
@@ -452,6 +457,11 @@ test.describe("Hybi", function() { with(this) {
|
||||
assertEqual( [0x89, 0x09, 0x6d, 0x69, 0x63, 0x20, 0x63, 0x68, 0x65, 0x63, 0x6b], collector().bytes )
|
||||
}})
|
||||
|
||||
it("converts numbers to strings", function() { with(this) {
|
||||
driver().ping(50)
|
||||
assertEqual( [0x89, 0x02, 0x35, 0x30], collector().bytes )
|
||||
}})
|
||||
|
||||
it("returns true", function() { with(this) {
|
||||
assertEqual( true, driver().ping() )
|
||||
}})
|
||||
|
||||
Reference in New Issue
Block a user