9 Commits
Author SHA1 Message Date
James Coglan 60e4027c59 Extract the parsing/unparsing code from Hybi into Ruby classes that match the C API, drop the Native driver and allow Hybi to take options for which parsers to use. 2017-01-06 09:11:37 +00:00
James Coglan 9ce857b3d4 Revise uses of encoding APIs.
When originally implemented, we still supported Ruby 1.8, which
necessitated checking for encoding methods and using a regex to validate
UTF-8. These checks are now gone.

We tagged many strings as binary when not strictly necessary, either
because we were just going to iterate their bytes or because we were
going to hand them off to the caller which should just write them
directly to a socket. Strings used as buffers to accumulate streaming
input are still tagged as binary to avoid encoding
collision/conversion.

The places where we do need to tag as UTF-8 (i.e. just before emitting
to the application) remain, but copy the string if necessary. This
allows us to work with frozen strings.

Finally, strings passed in via the Driver#text method should be
*transcoded* to UTF-8 if necessary, not merely tagged. The Ruby
String#encode method produces a new string so this should also be safe
with frozen strings.
2016-05-19 21:08:22 +01:00
Samuel Williams 425e15da83 Use StreamReader for both hybi and draft75. 2015-07-06 10:29:18 +09:00
Samuel Williams 46f5ac8c6b Improve performance of StreamReader by reducing the number of buffer reallocations done. 2015-07-05 23:24:35 +09:00
James Coglan 01c1a762e0 Don't expose the frame structure of messages, only expose their opcode and RSV headers. Extensions will mess with frame boundaries so depending on frame structure won't work. 2014-12-05 23:07:47 +00:00
James Coglan eb20069011 Migrate the internal representation of buffers from arrays to ASCII-8BIT strings, since this is what we're planning on handing off to extensions. 2014-12-05 09:17:09 +00:00
James Coglan ef4fc7c57a Migrate the Hybi driver's internals to use Frame and Message objects compatible with websocket-extensions. 2014-12-02 22:51:42 +00:00
James Coglan 1b3f32bbc7 Trailing blank lines are bad. 2014-05-17 00:34:48 +01:00
James Coglan be1f1cdc35 Rename the module to websocket-driver. 2013-05-04 16:43:25 +01:00