12 Commits

Author SHA1 Message Date
James Coglan 3a2931751c Fix handling of default ports on Ruby 3.1 2022-09-10 15:37:55 +01:00
James Coglan e568366f82 Formatting change: {...} should have spaces inside the braces 2019-06-11 16:12:52 +01: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
James Coglan be2e5ed9ce A few stylistic tweaks. 2015-07-11 14:24:19 +01: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 585eded63d Remove unnecessary code to remove whitespace from Base64 output. 2015-07-04 21:13:06 +01:00
James Coglan d69cdaba97 Allow event listeners to be passed as normal rather than block arguments.
This discourages the inappropriate use of 'return' inside event
listeners. Also, we return the listener, so that the caller has a
reference to it in case they do pass a block.
2015-07-04 19:28:49 +01:00
James Coglan 6720cb2b4a The client should use secure random numbers for Sec-WebSocket-Key, and we should use the Base64.strict_encode function everywhere. 2015-06-02 22:01:22 +01: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 1a9f2af571 Use the Headers class to build the default headers for handshakes rather than using loads of ugly string operations. 2014-11-08 17:44:34 +00:00
James Coglan ec6803e19c Remove the start_tls protocol and replace it by the proxy emitting a 'connect' event. 2014-11-08 16:45:06 +00:00
James Coglan 0a200bbdef Refactor proxy support into a separate class that represents the proxy connection as a real object. 2014-11-06 23:37:13 +00:00