25 Commits

Author SHA1 Message Date
James Coglan e3aa5246d6 Avoid errors caused by extension names or parameters having names that clash with things in Object.prototype. 2017-11-11 00:45:16 +00:00
James Coglan 1e58c148cb Header parser should accept uppercase letters. 2017-11-11 00:44:44 +00:00
James Coglan d8d38e54e6 Catch synchronous errors thrown by extensions. 2017-09-08 21:18:07 +01:00
James Coglan fb84d36546 Fix a couple of race conditions in Pipeline.
While improving error handling, I found two situations where Pipeline
fails to close() correctly because it believes there are more messages
to emit.

The first is fixed by the change to `Cell.pending()`. If another message
is pushed into the pipeline after one of the cells has stopped, all the
cells get their pending count bumped. However, this new message will
never enter the queue inside the stopped cell, so its pending count will
never reach zero. So, we only increment the pending count for cells that
are not stopped.

The second is fixed by the change to `Functor._flushQueue()`. Say a cell
processes two messages in turn, M1 and M2. Both begin being processed
before either returns a result. M1 generates an error, while processing
of M2 never completes. In this situation, the error should indicate the
end of the stream but because M2 never completes, the pending count
never reaches zero. So, if we see a record with an error, we should
truncate the queue and this point and set pending=0 so the functor is
considered complete.
2017-09-08 20:59:13 +01:00
James Coglan 7319766a5e Remove non-breaking spaces from README. 2016-10-08 03:09:55 +01:00
James Coglan 2792339b4d Add a missing semicolon. 2015-11-06 22:10:26 +00:00
James Coglan c8f31cc1c7 Reversing the previous commit; generateResponse() should throw on invalid heders (as should activate()), because the server should fail the connection in this event. 2015-03-26 08:30:23 +00:00
James Coglan 62ac506b80 If the header from the client is invalid, just ignore it and build a pipeline with no sessions. 2015-03-14 12:56:41 +00:00
James Coglan eb6718f6c8 Fix some alignment from where I renamed a variable. 2015-02-16 19:50:40 +00:00
James Coglan a04471aecc If Extensions.close() is called before the handshake is done, don't throw an error, just callback immediately. 2015-02-16 08:53:42 +00:00
James Coglan 6a9e862c07 Correct typos pointed out by @glasser in https://github.com/faye/websocket-extensions-node/commit/1b77290e8279f654089eac963942309fb19b9312#commitcomment-9753067 2015-02-16 08:10:12 +00:00
James Coglan 1b77290e82 Put a structure in place to preserve ordering of messages and errors, and defer closing of sessions while messages are still in the pipeline.
This is designed to address these issues:

* https://github.com/faye/permessage-deflate-node/issues/1
* https://github.com/faye/permessage-deflate-node/pull/3
* https://github.com/faye/websocket-driver-node/issues/11
2015-02-15 13:14:22 +00:00
James Coglan ea98426dc1 Don't delegate validFrameRsv() to extensions; it's a weird interface and we can figure it out from the extension metadata. 2014-12-12 00:54:39 +00:00
James Coglan 007cc0ac22 Prefix extension error messages with the name of the extension. 2014-12-08 00:54:03 +00:00
James Coglan a28cdfdb1a Make sure every session processes messages in both directions in the same order the messages arrive at the driver. 2014-12-01 22:03:49 +00:00
James Coglan 2b45d787e7 Some fixes discovered while porting to Ruby. 2014-12-01 21:02:08 +00:00
James Coglan 80a7c2211a Add a close() method to sessions. 2014-11-29 00:43:41 +00:00
James Coglan c1adebdb04 Document the API protocols in the README. 2014-11-29 00:36:09 +00:00
James Coglan 9d1a70d845 Wrap an abstraction around the data returned by the parser to facilitate access by name and in order. 2014-11-28 23:11:23 +00:00
James Coglan 71bb6b3274 Flesh out the specs for client and server negotation, and fix the resulting bugs. 2014-11-28 00:14:05 +00:00
James Coglan e2c7cc4d00 Sessions should use Node-style callbacks rather than emitting error events. 2014-11-27 09:31:27 +00:00
James Coglan afaeaa7087 Delegate the decision about which RSV bits are allowed to sessions on a per-frame basis. 2014-11-26 09:58:46 +00:00
James Coglan 123ae175a1 Begin writing tests for the Extensions class. 2014-11-25 23:13:19 +00:00
James Coglan 9332e0eaa3 Add tests for the Parser module. 2014-11-25 22:09:30 +00:00
James Coglan 86dd78c2e3 Extract the Extensions class from websocket-driver. 2014-11-25 21:15:00 +00:00