411 Commits

Author SHA1 Message Date
James Coglan eb643f5949 Bump version to 0.7.3 0.7.3 2020-07-09 19:27:04 +01:00
James Coglan e87bfef9bc Accept HTTP responses that have an empty reason-phrase, per RFC 2616 2020-07-09 19:06:13 +01:00
James Coglan f882bc56d5 Bump version to 0.7.2 0.7.2 2020-05-22 16:06:12 +01:00
James Coglan 46aafa4e99 Set {source,target}_version to work with the current version of javac on macOS 2020-05-14 23:31:30 +01:00
James Coglan db09a1af22 Update Ruby versions 2.4 to 2.7 on Travis 2020-05-14 17:20:25 +01:00
pjaspers 202e1800e0 Allow rack.input.read to return a frozen string
We're seeing this occasionally in our error logs, where the `env`
passed into to the driver will return a frozen string when read.

The stack trace always includes ActionCable in to the mix, so
something like this:

      "/app/vendor/bundle/ruby/2.6.0/gems/websocket-driver-0.7.0/lib/websocket/driver/draft76.rb" line 11 in force_encoding
      "/app/vendor/bundle/ruby/2.6.0/gems/websocket-driver-0.7.0/lib/websocket/driver/draft76.rb" line 11 in initialize
      "/app/vendor/bundle/ruby/2.6.0/gems/websocket-driver-0.7.0/lib/websocket/driver.rb" line 162 in new
      "/app/vendor/bundle/ruby/2.6.0/gems/websocket-driver-0.7.0/lib/websocket/driver.rb" line 162 in rack
      "/app/vendor/bundle/ruby/2.6.0/gems/actioncable-5.2.3/lib/action_cable/connection/client_socket.rb" line 47 in initialize
      "/app/vendor/bundle/ruby/2.6.0/gems/actioncable-5.2.3/lib/action_cable/connection/web_socket.rb" line 10 in new
      "/app/vendor/bundle/ruby/2.6.0/gems/actioncable-5.2.3/lib/action_cable/connection/web_socket.rb" line 10 in initialize
      "/app/vendor/bundle/ruby/2.6.0/gems/actioncable-5.2.3/lib/action_cable/connection/base.rb" line 59 in new
      "/app/vendor/bundle/ruby/2.6.0/gems/actioncable-5.2.3/lib/action_cable/connection/base.rb" line 59 in initialize
      "/app/vendor/bundle/ruby/2.6.0/gems/actioncable-5.2.3/lib/action_cable/server/base.rb" line 30 in new
      "/app/vendor/bundle/ruby/2.6.0/gems/actioncable-5.2.3/lib/action_cable/server/base.rb" line 30 in call

I still don't quite know why someone is sometimes returning a frozen
string (it could also have to with any of the current rack middleware
we're using), but I do know that we can handle it here.

So this adds a spec and some behavior to fix that.
2020-05-14 16:22:20 +01:00
James Coglan b00f58701e Emit ping and pong events from the Server driver 2020-02-14 14:41:43 +01:00
James Coglan d05eb72d2d Mention license change in the changelog 2019-06-13 11:40:48 +01:00
James Coglan e568366f82 Formatting change: {...} should have spaces inside the braces 2019-06-11 16:12:52 +01:00
James Coglan 92334974c5 Bump version to 0.7.1 0.7.1 2019-06-10 12:40:06 +01:00
James Coglan a6bb6a69a9 Change markdown formatting of docs. 2019-05-29 15:34:34 +01:00
James Coglan 019ba714cd Remove a redundant statement from the Hybi setup code. 2019-05-29 00:10:46 +01:00
James Coglan 03b46b8db6 Fail a draft-76 connection of a header does not contain any digits. 2019-05-29 00:10:46 +01:00
James Coglan 6b519eecc3 Depend on Rake < 12.3 if we're running on Ruby < 2.0. 2019-05-28 22:23:36 +01:00
James Coglan 77ae543784 Reformat the C and Java native extension modules. 2019-05-28 22:23:36 +01:00
James Coglan 8a6f9ef737 Fix an uninitialised variable warning. 2019-05-24 14:59:01 +01:00
James Coglan 5b957c6660 Update Travis target versions. 2019-05-24 14:43:05 +01:00
James Coglan 2c19210a69 Switch license to Apache 2.0. 2019-05-24 14:38:29 +01:00
James Coglan ee39af83d0 Test on Ruby 2.5.0. 2018-02-19 21:02:43 +00:00
James Coglan ec94a219e9 I think you have to use jruby-head instead of jruby-9 now. 2017-11-23 23:14:37 +00:00
James Coglan b14488aac5 Bump the Ruby versions for Travis. 2017-11-23 23:03:01 +00:00
James Coglan 11476318ea If any header used by Hybi is present, then pick Hybi, and likewise for Draft76. This means the driver is more likely to pick Hybi and report likely combinations of malformed headers as errors to the client. 2017-11-23 23:02:15 +00:00
James Coglan 2ec898c6a1 If any driver encounters a validation error in the request headers, it can throw an error and Driver#start will catch that and send a 400 response to the client. 2017-11-23 23:01:26 +00:00
James Coglan 12d2aa8a80 Fix the version of Rubygems that Travis is using on Ruby 1.9. 0.7.0 2017-09-11 22:05:09 +01:00
James Coglan 222e93a01c Bump version to 0.7.0. 2017-09-11 22:00:08 +01:00
James Coglan bc03ce72fe Refactor the client examples, and get the TCPSocket one into a runnable state so it can be run from the command line with a URI. 2017-08-15 19:00:04 +01:00
James Coglan bed599ae32 Don't require rubygems, this has not been necessary since Ruby 1.8. 2017-08-08 23:41:48 +01:00
James Coglan d3aee30def Merge pull request #53 from izwick-schachter/master
Added TCPSocket client example
2017-08-08 23:30:14 +01:00
izwick-schachter 391c3d0426 Added TCPSocket client example 2017-08-08 13:44:08 -04:00
James Coglan 8739c7966f Rename tcp_server.rb to em_server.rb. 2017-08-08 08:55:13 +01:00
James Coglan 77e46d6fce Add an example EventMachine client. 2017-08-08 08:54:50 +01:00
James Coglan 06f215611e Flesh out the docs for the new ping/pong events. 2017-08-02 21:55:14 +01:00
James Coglan cd38349f9a Make the ping/pong tests check the content of the events. 2017-08-02 21:54:59 +01:00
James Coglan 5daa01be5e Emit ping and pong events after all other effects of those frames have been carried out. 2017-08-02 21:32:17 +01:00
James Coglan 1ea7205acf Merge pull request #51 from ably-forks/support-ping-in-event-emitter
Support ping in EventEmitter
2017-08-02 21:28:31 +01:00
James Coglan 7dba28caa2 Update Ruby versions in Travis config. 2017-08-01 20:34:39 +01:00
Matthew O'Riordan dacae81312 Update docs to reflect ping & pong events 2017-05-16 15:01:27 +01:00
Matthew O'Riordan f22c97f977 Emit :ping and :pong events in the driver 2017-05-16 15:00:10 +01:00
James Coglan 65c068b24d Merge pull request #50 from junaruga/feature/travis-ruby-head
Feature/travis ruby head
2017-04-14 10:32:59 +01:00
Jun Aruga cab7ae1b29 Update Ruby 2.3, 2.4 to latest version on Travis. 2017-04-03 19:31:18 +02:00
James Coglan 38b8f63f10 Bump version to 0.6.5. 0.6.5 2017-01-22 19:58:03 +00:00
James Coglan 2936754e81 Test on Ruby 2.4.0. 2016-12-29 11:30:09 +00:00
James Coglan 4fa9e19063 Merge pull request #48 from kbarrette/pure_ruby_masking
Pure Ruby masking
2016-12-27 15:07:32 +00:00
Keith Barrette cfc45f2360 Fall back to ruby 2016-12-07 11:32:43 -05:00
Keith Barrette 6e32ee04f3 Add Ruby mask implementation 2016-12-07 11:32:43 -05:00
James Coglan 568dc364a8 Bump Ruby versions 2.2 and 2.3 on Travis. 2016-11-21 23:22:52 +00:00
James Coglan 58cdc2305b Remove Rubinius from the build as it hasn't worked on Travis for weeks. 2016-10-26 09:14:02 +01:00
James Coglan 930bbe2020 Move the license text into a separate file. 2016-07-19 20:57:38 +01:00
James Coglan 673d11e436 Bump version to 0.6.4. 0.6.4 2016-05-20 08:46:06 +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