Commit Graph

12 Commits

Author SHA1 Message Date
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
Akira Matsuda 5ce5c98339 "warning: instance variable @delegate not initialized" 2015-07-21 16:41:50 +09:00
James Coglan 7128d1b030 Standardise the words used to refer to chunks of parser input. 2015-07-10 09:37:03 +01: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
Asmod4n c04bfc4c19 fail_request didn't accept a required argument 2014-09-21 00:57:24 +02:00
James Coglan 129a238613 Fix ping/pong issue where Server#ping fails to pass the callback on to the Hybi driver. 2014-07-19 16:48:32 +01:00
James Coglan 4b4d69e946 Delegate the protocol and version methods correctly in the TCP driver. 2014-07-04 09:42:26 +01:00
James Coglan 1b3f32bbc7 Trailing blank lines are bad. 2014-05-17 00:34:48 +01:00
James Coglan ac3bb51cbd Adjust encoding operations so that encoding is explicit at the call site, and all strings written to I/O are ASCII-8BIT. 2013-07-02 09:46:29 +01:00
James Coglan cfd2806683 Remove an unneeded instance variable. 2013-05-12 12:41:51 +01:00
James Coglan 5a7fadbcbe Add API for setting custom handshake headers. 2013-05-11 20:28:36 +01:00
James Coglan 020c094e96 Add a driver for handling TCP servers, where we don't want to make the user parse the HTTP request. 2013-05-11 19:28:59 +01:00