efb46fb455
Merge remote-tracking branch 'funtaps/regex_fix'
James Coglan2019-05-29 00:07:17 +01:00
5723676b7b
Make the HTTP parser load correctly if process.version is not set, and remove some code that's supporting Node from before v0.6.
James Coglan2019-05-24 17:45:47 +01:00
f27aa59fd8
Use Buffer.write() instead of Buffer.copy() to write strings into buffers.
James Coglan2019-05-24 17:22:51 +01:00
47c5e4d9ee
Handle errors in the draft76 handshake by throwing an error that Base.start() will catch, triggering a 400 response.
James Coglan2017-11-23 08:51:35 +00:00
ae30f9952f
Bake the isWebSocket() check into the start() method so that if somebody constructs a driver without making that check, the driver will send a 400 response.
James Coglan2017-11-23 08:29:57 +00:00
e260d4d788
If the request headers contain any of the necessary values for Hybi, then use it. i.e. if Sec-WebSocket-Key is present but not Sec-WebSocket-Version, we should still interpret it as a Hybi connection.
James Coglan2017-11-19 20:03:38 +00:00
287bbe8a7a
If any driver fails to generate a handshake response, then send a 400. This means the initial http() method to select a driver doesn't need to contain all the validation logic for all the details of each protocol version, but protocol errors still result in a failed connection.
James Coglan2017-11-19 19:47:30 +00:00
cad92a6e4e
Remove redundant request method check from isWebSocket().
James Coglan2017-11-19 19:40:22 +00:00
569ec1d62e
Perform more stringent checks on request headers so that it should not be possible to get a driver for requests with invalid headers.
request-validation
James Coglan2017-10-30 22:53:34 +00:00
9a16e7aa27
Drop Node 0.6 support; it's no longer possible to make it work on Travis because installing a working version of npm is impossible since it depends on osenv, which doesn't work on 0.6.
James Coglan2017-07-30 20:02:37 +01:00
ed1ce79915
Install a ^-compatible npm on Node 0.8.
James Coglan2017-07-30 19:40:09 +01:00
751c77aa1d
Replace the built-in Node HTTP parser with the http-parser-js package.
James Coglan2017-07-30 19:34:41 +01:00
b76f4e27d0
Correct the HTTP parser magic numbers. The numbers we had were correct for Node 0.12 but not for releases since then.
James Coglan2017-07-30 19:26:45 +01:00
6a92cacf62
Apply masking to messages once the payload has been placed in the frame buffer rather than mutating the original message.
James Coglan2016-04-27 22:28:58 +01:00
b0b0d69ce4
Throw a more helpful error if a client driver is created with an invalid URL.
James Coglan2015-10-17 21:44:36 +01:00
3461e0187b
Run tests on major versions of iojs and node 4.
James Coglan2015-10-17 12:57:58 +01:00
5b59d0fcd8
Use the modulo operator rather than Math.floor() to check whether the draft-76 keys are legit.
James Coglan2015-10-02 21:35:22 +01:00
68990a260b
Close the connection if a draft-76 client sends a Sec-WebSocket-Key header where the numeric value is a non-integer multiple of the number of spaces.
James Coglan2015-10-01 23:47:15 +01:00
eb5e39e7e3
Standardise the words used to refer to chunks of parser input.
James Coglan2015-07-10 22:37:54 +01:00
a95f68080e
Use the buffer.{read,write}UInt{16,32}BE functions to parse and write numbers rather than implementing such things ourselves.
James Coglan2015-07-10 19:57:12 +01:00
14937dd365
Emit an error event *after* setting the ready state to 3.
James Coglan2015-07-08 20:14:14 +01:00
780dd331fe
The 'connect' event should emit a ConnectEvent object.
James Coglan2015-07-07 21:33:15 +01:00
4a3d51cc5b
Incorporate StreamReader into Draft75 so that it retains input and recovers safely from exceptions in event listeners.
James Coglan2015-07-07 21:30:06 +01:00
ed17186354
In the Hybi driver, perform parser state changes before validating and emitting events. This protects the parser against errors thrown by event listeners.
James Coglan2015-07-07 20:30:45 +01:00
1df1293456
Change stage in the Base.shutdown() method to that all parsers stop processing input.
James Coglan2015-07-04 21:07:34 +01:00
d901d3e48d
If an event listener emits an error, close the connection with code 1011.
James Coglan2015-07-04 20:54:22 +01:00
a49cd60cb7
Document that on() *adds* a callback, rather than *setting* one, i.e. it does not remove any prior callbacks.
James Coglan2015-07-04 19:31:36 +01:00
4dd872f0ef
Add the pong() command to the documentation.
James Coglan2015-07-04 18:50:55 +01:00
ebe4ce1382
Because Driver.frame() will now admit input when in readyState 2 (to allow for async extension shutdown), the Messages stream should use the text() and binary() methods that will block messages in that state.
James Coglan2015-02-16 09:51:40 +00:00
daa37974c6
Don't emit further error/close events if the driver is already closing.
James Coglan2015-02-16 09:08:10 +00:00
cc5e5c245e
Use Extensions.close(callback) to make sure close follows all pending messages.
James Coglan2015-02-15 13:18:21 +00:00
bdc081ab57
Adapt to the changes to the HTTPParser API introduced in iojs.
James Coglan2015-02-02 21:06:51 +00:00
23675e08ee
Don't expose the internal frame structure of messages to extensions; they should not be able to depend on seeing the actual frame boundaries off the wire because that requires all extensions to leave them intact.
James Coglan2014-12-06 22:08:37 +00:00
7376f48d6a
Catch errors raised by Extensions.activate().
James Coglan2014-12-02 22:53:16 +00:00
330fa2073d
Don't assume that messages coming out of extensions have anything but the standard websocket-extensions API.
James Coglan2014-11-29 01:54:20 +00:00