26 Commits

Author SHA1 Message Date
James Coglan ae94112fe9 Formatting change: {...} should have spaces inside the braces 2019-06-11 15:50:38 +01:00
James Coglan 8d58a3363d Use the newer safe Buffer API instead of the constructor 2019-06-07 18:41:35 +01:00
James Coglan 689e37cfb7 Use windowBits:9 for deflate and inflate streams if the session is configured to use 8. 2017-09-08 22:29:37 +01:00
James Coglan cbae000ab3 Use Z_DEFAULT_COMPRESSION rather than Z_DEFAULT_LEVEL, it's more descriptive. 2017-08-18 09:32:57 +01:00
James Coglan 0215b35a21 In Node 8, the zlib API is read-only and so cannot be stubbed on the real module. Therefore we need to pass in an object to replace the zlib module in the code under test, on which we can mock/stub method calls. 2017-08-01 01:13:54 +01:00
James Coglan d22edec996 Catch errors thrown by close() on zlib streams. If they throw, we were about to discard them anyway, so there's no need to do anything. 2016-02-06 14:22:53 +00:00
James Coglan 47b3b3614b It might be dangerous to permanently set _flushFlag, so we need to reimplement more of flush() to get the patch in place. 2015-04-09 18:25:22 +01:00
James Coglan 5da6a768b0 Monkey-patch deflate on Node 0.10 to produce smaller output; see https://github.com/faye/permessage-deflate-node/issues/4 2015-04-09 18:07:24 +01:00
James Coglan f03aef1954 Pass Z_SYNC_FLUSH to deflate.flush() where supported, to ensure optimal output. 2015-04-09 08:37:45 +01:00
James Coglan 958de927aa Prevent a race condition causing malformed compression of frames; see https://github.com/faye/permessage-deflate-node/issues/4. 2015-04-08 23:59:51 +01:00
James Coglan 983c0d30c3 Fix the race conditions that happen when multiple messages attempt to use the same deflate/inflate stream at the same time, and fix the mechanism for flushing deflate streams so as not to hose the compression ratio on Node v0.10. 2014-12-15 18:59:30 +00:00
James Coglan 5ac507cddb Remove the 'flush' parameter (it defaults to Z_NO_FLUSH). 2014-12-12 03:15:25 +00:00
James Coglan 79cc1f0339 We no longer need to implement validFrameRsv(). 2014-12-12 00:55:49 +00:00
James Coglan bd462d4515 Unit tests and bug fixes for the parameter negotiation process. 2014-12-11 23:58:06 +00:00
James Coglan 9fb52811d7 Don't crash if zlib streams don't have a close() method. 2014-12-08 00:54:36 +00:00
James Coglan ffbd9bd532 Refactor most of the boilerplate out of Session. 2014-12-07 00:05:39 +00:00
James Coglan da41e96e02 Use the new Message API that doesn't expose the frame boundaries. 2014-12-06 22:09:42 +00:00
James Coglan 20df975d8e Make sure inflate/deflate streams are closed after use if not using context takeover. 2014-12-06 10:51:48 +00:00
James Coglan a4725878b3 Small tweaks to object setup. 2014-12-05 19:36:47 +00:00
James Coglan 7fb3cd8c72 Use Message.data, not Message.read(). 2014-11-29 01:13:51 +00:00
James Coglan a63cb914ec Implement the close() method on sessions. 2014-11-29 00:43:56 +00:00
James Coglan 862452a2bf Use Node callbacks on the process() methods rather than emitting error events. 2014-11-27 09:31:07 +00:00
James Coglan e5fa1b6295 Implement the validFrameRsv() method. 2014-11-26 09:58:10 +00:00
James Coglan b57c59cae2 Decouple from the Driver API. Since we only need driver to send it errors, just emit an error event instead. 2014-11-25 19:39:38 +00:00
James Coglan 3b18ada5db Add a ClientSession that passes the Autobahn tests. 2014-11-24 22:04:30 +00:00
James Coglan 968434f409 Extract permessage-deflate support into a new module. 2014-11-23 20:35:42 +00:00