Compare commits

...

13 Commits

Author SHA1 Message Date
James Coglan 2e82d3464d Test on recent versions of Node 2023-09-07 19:21:01 +01:00
James Coglan e4962db994 Switch from Travis CI to GitHub Actions 2021-05-18 22:10:14 +01:00
James Coglan 3f2f9b70a8 Travis update: cache npm modules, remove sudo, run on Node 15 2021-03-12 21:36:32 +00:00
James Coglan 5f711f0892 Bump version to 0.7.4 2020-05-22 16:00:26 +01:00
James Coglan 17cf70f15d Pin http-parser-js to version that fixes https://github.com/creationix/http-parser-js/issues/63 2020-05-22 15:58:03 +01:00
James Coglan 5c2a1849a1 Add Node versions 13 and 14 on Travis 2020-05-14 23:51:46 +01:00
James Coglan d892d3bad5 Emit ping and pong events from the Server driver 2020-02-14 14:42:15 +01:00
Erick Aguiar 43656559b0 handling match in empty string
The previous fix (#26) wasn't handling the return of the match function,
witch is null when the string is empty.
2020-02-14 14:37:47 +01:00
James Coglan 03aebd19fb Fix syntax of dependency versions and bump version to 0.7.3 2019-06-13 16:41:26 +01:00
James Coglan 90c8eb4626 Mention license change in the changelog 2019-06-13 11:38:57 +01:00
James Coglan 3f8e7acd39 Bump version to 0.7.2 2019-06-13 07:47:20 +01:00
James Coglan 85709bb915 Cap http-parser-js at version 0.4.10 until https://github.com/creationix/http-parser-js/issues/63 is fixed 2019-06-13 07:37:27 +01:00
James Coglan 998a1725ea Formatting change: {...} should have spaces inside the braces 2019-06-11 15:56:58 +01:00
15 changed files with 77 additions and 38 deletions
+41
View File
@@ -0,0 +1,41 @@
on:
- push
- pull_request
jobs:
test:
strategy:
fail-fast: false
matrix:
node:
- '0.8'
- '0.10'
- '0.12'
- '4'
- '6'
- '8'
- '10'
- '12'
- '14'
- '16'
- '18'
- '20'
name: node.js v${{ matrix.node }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
with:
node-version: ${{ matrix.node }}
- if: matrix.node == '0.8'
run: npm conf set strict-ssl false
- run: node --version
- run: npm install
- run: npm install 'nopt@5'
- run: rm -rf node_modules/jstest/node_modules/nopt
- run: npm test
-19
View File
@@ -1,19 +0,0 @@
sudo: false
language: node_js
node_js:
- "0.8"
- "0.10"
- "0.12"
- "4"
- "5"
- "6"
- "7"
- "8"
- "9"
- "10"
- "11"
- "12"
before_install:
- '[ "${TRAVIS_NODE_VERSION}" = "0.8" ] && npm install -g npm@~1.4.0 || true'
+17
View File
@@ -1,3 +1,19 @@
### 0.7.4 / 2020-05-22
- Avoid crashing if `process.version` does not contain any digits
- Emit `ping` and `pong` events from the `Server` driver
- Require http-parser-js >=0.5.1 which fixes the bug we addressed in 0.7.3
### 0.7.3 / 2019-06-13
- Cap version of http-parser-js below 0.4.11, which introduced a bug that
prevents us from handling messages that are part of the same input buffer as
the handshake response if chunked encoding is specified
### 0.7.2 / 2019-06-13
(This version was pulled due to an error when publishing)
### 0.7.1 / 2019-06-10
- Catch any exceptions produced while generating a handshake response and send a
@@ -7,6 +23,7 @@
- Use the `Buffer.alloc()` and `Buffer.from()` functions instead of the unsafe
`Buffer()` constructor
- Handle errors encountered while handling malformed draft-76 requests
- Change license from MIT to Apache 2.0
### 0.7.0 / 2017-09-11
+1 -1
View File
@@ -1,4 +1,4 @@
Copyright 2010-2019 James Coglan
Copyright 2010-2020 James Coglan
Licensed under the Apache License, Version 2.0 (the "License"); you may not use
this file except in compliance with the License. You may obtain a copy of the
+2 -2
View File
@@ -1,4 +1,4 @@
# websocket-driver [![Build Status](https://travis-ci.org/faye/websocket-driver-node.svg)](https://travis-ci.org/faye/websocket-driver-node)
# websocket-driver
This module provides a complete implementation of the WebSocket protocols that
can be hooked up to any I/O stream. It aims to simplify things by decoupling the
@@ -177,7 +177,7 @@ var driver = websocket.client('ws://www.example.com/socket'),
proxy = driver.proxy('http://username:password@proxy.example.com'),
tcp = net.connect(80, 'proxy.example.com');
tcp.pipe(proxy).pipe(tcp, {end: false});
tcp.pipe(proxy).pipe(tcp, { end: false });
tcp.on('connect', function() {
proxy.start();
+2 -2
View File
@@ -5,11 +5,11 @@ var net = require('net'),
websocket = require('..'),
deflate = require('permessage-deflate');
var DEFAULT_PORTS = {'ws:': 80, 'wss:': 443};
var DEFAULT_PORTS = { 'ws:': 80, 'wss:': 443 };
var uri = url.parse(process.argv[2]),
port = uri.port || DEFAULT_PORTS[uri.protocol],
conn = net.connect({host: uri.hostname, port: port});
conn = net.connect({ host: uri.hostname, port: port });
var driver = websocket.client(uri.href);
driver.addExtension(deflate);
+1 -1
View File
@@ -1,7 +1,7 @@
'use strict';
// Protocol references:
//
//
// * http://tools.ietf.org/html/draft-hixie-thewebsocketprotocol-75
// * http://tools.ietf.org/html/draft-hixie-thewebsocketprotocol-76
// * http://tools.ietf.org/html/draft-ietf-hybi-thewebsocketprotocol-17
+1 -1
View File
@@ -8,7 +8,7 @@ var Buffer = require('safe-buffer').Buffer,
Headers = require('./headers'),
HttpParser = require('../http_parser');
var PORTS = {'ws:': 80, 'wss:': 443};
var PORTS = { 'ws:': 80, 'wss:': 443 };
var Proxy = function(client, origin, options) {
this._client = client;
+1 -1
View File
@@ -14,7 +14,7 @@ var Server = function(options) {
util.inherits(Server, Base);
var instance = {
EVENTS: ['open', 'message', 'error', 'close'],
EVENTS: ['open', 'message', 'error', 'close', 'ping', 'pong'],
_bindEventListeners: function() {
this.messages.on('error', function() {});
+3 -3
View File
@@ -96,9 +96,9 @@ HttpParser.METHODS = {
32: 'UNLINK'
};
var VERSION = (process.version || '')
.match(/[0-9]+/g)
.map(function(n) { return parseInt(n, 10) });
var VERSION = process.version
? process.version.match(/[0-9]+/g).map(function(n) { return parseInt(n, 10) })
: [];
if (VERSION[0] === 0 && VERSION[1] === 12) {
HttpParser.METHODS[16] = 'REPORT';
+3 -3
View File
@@ -7,7 +7,7 @@
"websocket"
],
"license": "Apache-2.0",
"version": "0.7.1",
"version": "0.7.4",
"engines": {
"node": ">=0.8.0"
},
@@ -16,8 +16,8 @@
],
"main": "./lib/websocket/driver",
"dependencies": {
"http-parser-js": ">=0.4.0",
"safe-buffer": ">=5.1.1",
"http-parser-js": ">=0.5.1",
"safe-buffer": ">=5.1.0",
"websocket-extensions": ">=0.1.1"
},
"devDependencies": {
+2 -2
View File
@@ -4,7 +4,7 @@ var Client = require("../../../lib/websocket/driver/client"),
test.describe("Client", function() { with(this) {
define("options", function() {
return this._options = this._options || {protocols: this.protocols()}
return this._options = this._options || { protocols: this.protocols() }
})
define("protocols", function() {
@@ -202,7 +202,7 @@ test.describe("Client", function() { with(this) {
}})
it("emits an 'error' event if the proxy does not connect", function() { with(this) {
expect(proxy, "emit").given("error", objectIncluding({message: "Can't establish a connection to the server at ws://www.example.com/socket"}))
expect(proxy, "emit").given("error", objectIncluding({ message: "Can't establish a connection to the server at ws://www.example.com/socket" }))
expect(proxy, "emit").given("close")
expect(proxy, "emit").given("end")
proxy.write(Buffer.from("HTTP/1.1 403 Forbidden\r\n\r\n"))
+1 -1
View File
@@ -14,7 +14,7 @@ test.describe("Draft75", function() { with(this) {
})
define("options", function() {
return this._options = this._options || {masking: false}
return this._options = this._options || { masking: false }
})
define("driver", function() {
+1 -1
View File
@@ -27,7 +27,7 @@ test.describe("Draft76", function() { with(this) {
})
define("options", function() {
return this._options = this._options || {masking: false}
return this._options = this._options || { masking: false }
})
define("driver", function() {
+1 -1
View File
@@ -17,7 +17,7 @@ test.describe("Hybi", function() { with(this) {
})
define("options", function() {
return this._options = this._options || {masking: false}
return this._options = this._options || { masking: false }
})
define("driver", function() {