diff -Nru ruby-websocket-1.2.5/CHANGELOG.md ruby-websocket-1.2.8/CHANGELOG.md --- ruby-websocket-1.2.5/CHANGELOG.md 2018-05-07 14:53:30.000000000 +0000 +++ ruby-websocket-1.2.8/CHANGELOG.md 2018-06-25 07:01:34.000000000 +0000 @@ -1,5 +1,17 @@ # Changelog +## 1.2.8 + +- restore support for Ruby 2.0+ + +## 1.2.7 + +- fix bug in previous version for Ruby 2.3 + +## 1.2.6 + +- duplicate variables passed in initializers to avoid changing them + ## 1.2.5 - make handshake server resilient to non-string Rack env keys diff -Nru ruby-websocket-1.2.5/.codeclimate.yml ruby-websocket-1.2.8/.codeclimate.yml --- ruby-websocket-1.2.5/.codeclimate.yml 2018-05-07 14:53:30.000000000 +0000 +++ ruby-websocket-1.2.8/.codeclimate.yml 2018-06-25 07:01:34.000000000 +0000 @@ -9,6 +9,7 @@ enabled: true rubocop: enabled: true + channel: rubocop-0-52 ratings: paths: - "**.rb" diff -Nru ruby-websocket-1.2.5/debian/changelog ruby-websocket-1.2.8/debian/changelog --- ruby-websocket-1.2.5/debian/changelog 2018-05-07 15:27:01.000000000 +0000 +++ ruby-websocket-1.2.8/debian/changelog 2018-06-25 07:07:03.000000000 +0000 @@ -1,3 +1,9 @@ +ruby-websocket (1.2.8-1) unstable; urgency=medium + + * New upstream release + + -- Manas kashyap Mon, 25 Jun 2018 07:07:03 +0000 + ruby-websocket (1.2.5-1) unstable; urgency=medium * Initial release (Closes: #694798) diff -Nru ruby-websocket-1.2.5/Gemfile ruby-websocket-1.2.8/Gemfile --- ruby-websocket-1.2.5/Gemfile 2018-05-07 14:53:30.000000000 +0000 +++ ruby-websocket-1.2.8/Gemfile 2018-06-25 07:01:34.000000000 +0000 @@ -1,13 +1,15 @@ +# frozen_string_literal: true + source 'http://rubygems.org' group :development do gem 'rake' - gem 'rspec', '~> 3.0' + gem 'rspec', '~> 3.7' # Use same version as Code Climate for consistency with CI # https://github.com/codeclimate/codeclimate-rubocop/blob/master/Gemfile.lock - gem 'rubocop', '0.46.0', require: false - gem 'rubocop-rspec', '1.8.0', require: false + gem 'rubocop', '0.52.1', require: false + gem 'rubocop-rspec', '1.21.0', require: false end gemspec diff -Nru ruby-websocket-1.2.5/lib/websocket/error.rb ruby-websocket-1.2.8/lib/websocket/error.rb --- ruby-websocket-1.2.5/lib/websocket/error.rb 2018-05-07 14:53:30.000000000 +0000 +++ ruby-websocket-1.2.8/lib/websocket/error.rb 2018-06-25 07:01:34.000000000 +0000 @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module WebSocket class Error < RuntimeError class Frame < ::WebSocket::Error diff -Nru ruby-websocket-1.2.5/lib/websocket/exception_handler.rb ruby-websocket-1.2.8/lib/websocket/exception_handler.rb --- ruby-websocket-1.2.5/lib/websocket/exception_handler.rb 2018-05-07 14:53:30.000000000 +0000 +++ ruby-websocket-1.2.8/lib/websocket/exception_handler.rb 2018-06-25 07:01:34.000000000 +0000 @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module WebSocket module ExceptionHandler attr_accessor :error diff -Nru ruby-websocket-1.2.5/lib/websocket/frame/base.rb ruby-websocket-1.2.8/lib/websocket/frame/base.rb --- ruby-websocket-1.2.5/lib/websocket/frame/base.rb 2018-05-07 14:53:30.000000000 +0000 +++ ruby-websocket-1.2.8/lib/websocket/frame/base.rb 2018-06-25 07:01:34.000000000 +0000 @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module WebSocket module Frame # @abstract Subclass and override to implement custom frames diff -Nru ruby-websocket-1.2.5/lib/websocket/frame/data.rb ruby-websocket-1.2.8/lib/websocket/frame/data.rb --- ruby-websocket-1.2.5/lib/websocket/frame/data.rb 2018-05-07 14:53:30.000000000 +0000 +++ ruby-websocket-1.2.8/lib/websocket/frame/data.rb 2018-06-25 07:01:34.000000000 +0000 @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module WebSocket module Frame class Data < String @@ -11,7 +13,7 @@ # Convert all arguments to ASCII-8BIT for easier traversing def convert_args(args) - args.each { |arg| arg.force_encoding('ASCII-8BIT') } + args.collect { |arg| arg.dup.force_encoding('ASCII-8BIT') } end # Extract mask from 4 first bytes according to spec diff -Nru ruby-websocket-1.2.5/lib/websocket/frame/handler/base.rb ruby-websocket-1.2.8/lib/websocket/frame/handler/base.rb --- ruby-websocket-1.2.5/lib/websocket/frame/handler/base.rb 2018-05-07 14:53:30.000000000 +0000 +++ ruby-websocket-1.2.8/lib/websocket/frame/handler/base.rb 2018-06-25 07:01:34.000000000 +0000 @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module WebSocket module Frame module Handler @@ -24,14 +26,14 @@ # @param [Symbol] frame_type Frame type # @return [Boolean] True if given frame type is control frame def control_frame?(frame_type) - !%i(text binary continuation).include?(frame_type) + !%i[text binary continuation].include?(frame_type) end # Check if frame is one of data frames # @param [Symbol] frame_type Frame type # @return [Boolean] True if given frame type is data frame def data_frame?(frame_type) - %i(text binary).include?(frame_type) + %i[text binary].include?(frame_type) end end end diff -Nru ruby-websocket-1.2.5/lib/websocket/frame/handler/handler03.rb ruby-websocket-1.2.8/lib/websocket/frame/handler/handler03.rb --- ruby-websocket-1.2.5/lib/websocket/frame/handler/handler03.rb 2018-05-07 14:53:30.000000000 +0000 +++ ruby-websocket-1.2.8/lib/websocket/frame/handler/handler03.rb 2018-06-25 07:01:34.000000000 +0000 @@ -1,4 +1,5 @@ # encoding: binary +# frozen_string_literal: true require 'securerandom' @@ -21,7 +22,7 @@ # @see WebSocket::Frame::Base#supported_frames def supported_frames - %i(text binary close ping pong) + %i[text binary close ping pong] end # @see WebSocket::Frame::Handler::Base#encode_frame @@ -89,14 +90,14 @@ def encode_header mask = @frame.outgoing_masking? ? 0b10000000 : 0b00000000 - output = '' + output = String.new('') output << (type_to_opcode(@frame.type) | (fin ? 0b10000000 : 0b00000000)) # since more, rsv1-3 are 0 and 0x80 for Draft 4 output << encode_payload_length(@frame.data.size, mask) output end def encode_payload_length(length, mask) - output = '' + output = String.new('') if length <= 125 output << (length | mask) # since rsv4 is 0 elsif length < 65_536 # write 2 byte length @@ -197,7 +198,7 @@ end def decode_continuation_frame(application_data, frame_type) - @application_data_buffer ||= '' + @application_data_buffer ||= String.new('') @application_data_buffer << application_data @frame_type ||= frame_type end diff -Nru ruby-websocket-1.2.5/lib/websocket/frame/handler/handler04.rb ruby-websocket-1.2.8/lib/websocket/frame/handler/handler04.rb --- ruby-websocket-1.2.5/lib/websocket/frame/handler/handler04.rb 2018-05-07 14:53:30.000000000 +0000 +++ ruby-websocket-1.2.8/lib/websocket/frame/handler/handler04.rb 2018-06-25 07:01:34.000000000 +0000 @@ -1,4 +1,5 @@ # encoding: binary +# frozen_string_literal: true module WebSocket module Frame diff -Nru ruby-websocket-1.2.5/lib/websocket/frame/handler/handler05.rb ruby-websocket-1.2.8/lib/websocket/frame/handler/handler05.rb --- ruby-websocket-1.2.5/lib/websocket/frame/handler/handler05.rb 2018-05-07 14:53:30.000000000 +0000 +++ ruby-websocket-1.2.8/lib/websocket/frame/handler/handler05.rb 2018-06-25 07:01:34.000000000 +0000 @@ -1,4 +1,5 @@ # encoding: binary +# frozen_string_literal: true module WebSocket module Frame diff -Nru ruby-websocket-1.2.5/lib/websocket/frame/handler/handler07.rb ruby-websocket-1.2.8/lib/websocket/frame/handler/handler07.rb --- ruby-websocket-1.2.5/lib/websocket/frame/handler/handler07.rb 2018-05-07 14:53:30.000000000 +0000 +++ ruby-websocket-1.2.8/lib/websocket/frame/handler/handler07.rb 2018-06-25 07:01:34.000000000 +0000 @@ -1,4 +1,5 @@ # encoding: binary +# frozen_string_literal: true module WebSocket module Frame @@ -48,7 +49,7 @@ return true if data.nil? data.encode('UTF-8') true - rescue + rescue StandardError false end diff -Nru ruby-websocket-1.2.5/lib/websocket/frame/handler/handler75.rb ruby-websocket-1.2.8/lib/websocket/frame/handler/handler75.rb --- ruby-websocket-1.2.5/lib/websocket/frame/handler/handler75.rb 2018-05-07 14:53:30.000000000 +0000 +++ ruby-websocket-1.2.8/lib/websocket/frame/handler/handler75.rb 2018-06-25 07:01:34.000000000 +0000 @@ -1,4 +1,5 @@ # encoding: binary +# frozen_string_literal: true module WebSocket module Frame @@ -6,7 +7,7 @@ class Handler75 < Base # @see WebSocket::Frame::Base#supported_frames def supported_frames - %i(text close) + %i[text close] end # @see WebSocket::Frame::Handler::Base#encode_frame diff -Nru ruby-websocket-1.2.5/lib/websocket/frame/handler.rb ruby-websocket-1.2.8/lib/websocket/frame/handler.rb --- ruby-websocket-1.2.5/lib/websocket/frame/handler.rb 2018-05-07 14:53:30.000000000 +0000 +++ ruby-websocket-1.2.8/lib/websocket/frame/handler.rb 2018-06-25 07:01:34.000000000 +0000 @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module WebSocket module Frame module Handler diff -Nru ruby-websocket-1.2.5/lib/websocket/frame/incoming/client.rb ruby-websocket-1.2.8/lib/websocket/frame/incoming/client.rb --- ruby-websocket-1.2.5/lib/websocket/frame/incoming/client.rb 2018-05-07 14:53:30.000000000 +0000 +++ ruby-websocket-1.2.8/lib/websocket/frame/incoming/client.rb 2018-06-25 07:01:34.000000000 +0000 @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module WebSocket module Frame class Incoming diff -Nru ruby-websocket-1.2.5/lib/websocket/frame/incoming/server.rb ruby-websocket-1.2.8/lib/websocket/frame/incoming/server.rb --- ruby-websocket-1.2.5/lib/websocket/frame/incoming/server.rb 2018-05-07 14:53:30.000000000 +0000 +++ ruby-websocket-1.2.8/lib/websocket/frame/incoming/server.rb 2018-06-25 07:01:34.000000000 +0000 @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module WebSocket module Frame class Incoming diff -Nru ruby-websocket-1.2.5/lib/websocket/frame/incoming.rb ruby-websocket-1.2.8/lib/websocket/frame/incoming.rb --- ruby-websocket-1.2.5/lib/websocket/frame/incoming.rb 2018-05-07 14:53:30.000000000 +0000 +++ ruby-websocket-1.2.8/lib/websocket/frame/incoming.rb 2018-06-25 07:01:34.000000000 +0000 @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module WebSocket module Frame # Construct or parse incoming WebSocket Frame. diff -Nru ruby-websocket-1.2.5/lib/websocket/frame/outgoing/client.rb ruby-websocket-1.2.8/lib/websocket/frame/outgoing/client.rb --- ruby-websocket-1.2.5/lib/websocket/frame/outgoing/client.rb 2018-05-07 14:53:30.000000000 +0000 +++ ruby-websocket-1.2.8/lib/websocket/frame/outgoing/client.rb 2018-06-25 07:01:34.000000000 +0000 @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module WebSocket module Frame class Outgoing diff -Nru ruby-websocket-1.2.5/lib/websocket/frame/outgoing/server.rb ruby-websocket-1.2.8/lib/websocket/frame/outgoing/server.rb --- ruby-websocket-1.2.5/lib/websocket/frame/outgoing/server.rb 2018-05-07 14:53:30.000000000 +0000 +++ ruby-websocket-1.2.8/lib/websocket/frame/outgoing/server.rb 2018-06-25 07:01:34.000000000 +0000 @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module WebSocket module Frame class Outgoing diff -Nru ruby-websocket-1.2.5/lib/websocket/frame/outgoing.rb ruby-websocket-1.2.8/lib/websocket/frame/outgoing.rb --- ruby-websocket-1.2.5/lib/websocket/frame/outgoing.rb 2018-05-07 14:53:30.000000000 +0000 +++ ruby-websocket-1.2.8/lib/websocket/frame/outgoing.rb 2018-06-25 07:01:34.000000000 +0000 @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module WebSocket module Frame # Construct or parse incoming WebSocket Frame. diff -Nru ruby-websocket-1.2.5/lib/websocket/frame.rb ruby-websocket-1.2.8/lib/websocket/frame.rb --- ruby-websocket-1.2.5/lib/websocket/frame.rb 2018-05-07 14:53:30.000000000 +0000 +++ ruby-websocket-1.2.8/lib/websocket/frame.rb 2018-06-25 07:01:34.000000000 +0000 @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module WebSocket module Frame autoload :Base, "#{::WebSocket::ROOT}/websocket/frame/base" diff -Nru ruby-websocket-1.2.5/lib/websocket/handshake/base.rb ruby-websocket-1.2.8/lib/websocket/handshake/base.rb --- ruby-websocket-1.2.5/lib/websocket/handshake/base.rb 2018-05-07 14:53:30.000000000 +0000 +++ ruby-websocket-1.2.8/lib/websocket/handshake/base.rb 2018-06-25 07:01:34.000000000 +0000 @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module WebSocket module Handshake # @abstract Subclass and override to implement custom handshakes @@ -11,12 +13,19 @@ # Initialize new WebSocket Handshake and set it's state to :new def initialize(args = {}) - args.each { |k, v| instance_variable_set("@#{k}", v) } + args.each do |k, v| + value = begin + v.dup + rescue TypeError + v + end + instance_variable_set("@#{k}", value) + end @state = :new @handler = nil - @data = '' + @data = String.new('') @headers ||= {} @protocols ||= [] end @@ -62,7 +71,7 @@ # @example # @handshake.uri #=> "ws://example.com/path?query=true" def uri - uri = secure ? 'wss://' : 'ws://' + uri = String.new(secure ? 'wss://' : 'ws://') uri << host uri << ":#{port}" if port uri << path diff -Nru ruby-websocket-1.2.5/lib/websocket/handshake/client.rb ruby-websocket-1.2.8/lib/websocket/handshake/client.rb --- ruby-websocket-1.2.5/lib/websocket/handshake/client.rb 2018-05-07 14:53:30.000000000 +0000 +++ ruby-websocket-1.2.8/lib/websocket/handshake/client.rb 2018-06-25 07:01:34.000000000 +0000 @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'uri' module WebSocket diff -Nru ruby-websocket-1.2.5/lib/websocket/handshake/handler/base.rb ruby-websocket-1.2.8/lib/websocket/handshake/handler/base.rb --- ruby-websocket-1.2.5/lib/websocket/handshake/handler/base.rb 2018-05-07 14:53:30.000000000 +0000 +++ ruby-websocket-1.2.8/lib/websocket/handshake/handler/base.rb 2018-06-25 07:01:34.000000000 +0000 @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module WebSocket module Handshake module Handler diff -Nru ruby-websocket-1.2.5/lib/websocket/handshake/handler/client01.rb ruby-websocket-1.2.8/lib/websocket/handshake/handler/client01.rb --- ruby-websocket-1.2.5/lib/websocket/handshake/handler/client01.rb 2018-05-07 14:53:30.000000000 +0000 +++ ruby-websocket-1.2.8/lib/websocket/handshake/handler/client01.rb 2018-06-25 07:01:34.000000000 +0000 @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'digest/md5' module WebSocket diff -Nru ruby-websocket-1.2.5/lib/websocket/handshake/handler/client04.rb ruby-websocket-1.2.8/lib/websocket/handshake/handler/client04.rb --- ruby-websocket-1.2.5/lib/websocket/handshake/handler/client04.rb 2018-05-07 14:53:30.000000000 +0000 +++ ruby-websocket-1.2.8/lib/websocket/handshake/handler/client04.rb 2018-06-25 07:01:34.000000000 +0000 @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'digest/sha1' require 'base64' @@ -15,8 +17,8 @@ # @see WebSocket::Handshake::Handler::Base#handshake_keys def handshake_keys keys = [ - %w(Upgrade websocket), - %w(Connection Upgrade) + %w[Upgrade websocket], + %w[Connection Upgrade] ] host = @handshake.host host += ":#{@handshake.port}" if @handshake.port diff -Nru ruby-websocket-1.2.5/lib/websocket/handshake/handler/client11.rb ruby-websocket-1.2.8/lib/websocket/handshake/handler/client11.rb --- ruby-websocket-1.2.5/lib/websocket/handshake/handler/client11.rb 2018-05-07 14:53:30.000000000 +0000 +++ ruby-websocket-1.2.8/lib/websocket/handshake/handler/client11.rb 2018-06-25 07:01:34.000000000 +0000 @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module WebSocket module Handshake module Handler diff -Nru ruby-websocket-1.2.5/lib/websocket/handshake/handler/client75.rb ruby-websocket-1.2.8/lib/websocket/handshake/handler/client75.rb --- ruby-websocket-1.2.5/lib/websocket/handshake/handler/client75.rb 2018-05-07 14:53:30.000000000 +0000 +++ ruby-websocket-1.2.8/lib/websocket/handshake/handler/client75.rb 2018-06-25 07:01:34.000000000 +0000 @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module WebSocket module Handshake module Handler @@ -12,8 +14,8 @@ # @see WebSocket::Handshake::Handler::Base#handshake_keys def handshake_keys keys = [ - %w(Upgrade WebSocket), - %w(Connection Upgrade) + %w[Upgrade WebSocket], + %w[Connection Upgrade] ] host = @handshake.host host += ":#{@handshake.port}" if @handshake.port diff -Nru ruby-websocket-1.2.5/lib/websocket/handshake/handler/client76.rb ruby-websocket-1.2.8/lib/websocket/handshake/handler/client76.rb --- ruby-websocket-1.2.5/lib/websocket/handshake/handler/client76.rb 2018-05-07 14:53:30.000000000 +0000 +++ ruby-websocket-1.2.8/lib/websocket/handshake/handler/client76.rb 2018-06-25 07:01:34.000000000 +0000 @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'digest/md5' module WebSocket @@ -72,12 +74,12 @@ # @param [String] name of key. Will be used to set number variable needed later. Valid values: key1, key2 # @return [String] generated key def generate_key(key) - spaces = 1 + rand(12) + spaces = rand(1..12) max = 0xffffffff / spaces number = rand(max + 1) instance_variable_set("@#{key}_number", number) key = (number * spaces).to_s - (1 + rand(12)).times do + rand(1..12).times do char = NOISE_CHARS[rand(NOISE_CHARS.size)] pos = rand(key.size + 1) key[pos...pos] = char diff -Nru ruby-websocket-1.2.5/lib/websocket/handshake/handler/client.rb ruby-websocket-1.2.8/lib/websocket/handshake/handler/client.rb --- ruby-websocket-1.2.5/lib/websocket/handshake/handler/client.rb 2018-05-07 14:53:30.000000000 +0000 +++ ruby-websocket-1.2.8/lib/websocket/handshake/handler/client.rb 2018-06-25 07:01:34.000000000 +0000 @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module WebSocket module Handshake module Handler diff -Nru ruby-websocket-1.2.5/lib/websocket/handshake/handler/server04.rb ruby-websocket-1.2.8/lib/websocket/handshake/handler/server04.rb --- ruby-websocket-1.2.5/lib/websocket/handshake/handler/server04.rb 2018-05-07 14:53:30.000000000 +0000 +++ ruby-websocket-1.2.8/lib/websocket/handshake/handler/server04.rb 2018-06-25 07:01:34.000000000 +0000 @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'digest/sha1' require 'base64' @@ -20,8 +22,8 @@ # @see WebSocket::Handshake::Handler::Base#handshake_keys def handshake_keys [ - %w(Upgrade websocket), - %w(Connection Upgrade), + %w[Upgrade websocket], + %w[Connection Upgrade], ['Sec-WebSocket-Accept', signature] ] + protocol end diff -Nru ruby-websocket-1.2.5/lib/websocket/handshake/handler/server75.rb ruby-websocket-1.2.8/lib/websocket/handshake/handler/server75.rb --- ruby-websocket-1.2.5/lib/websocket/handshake/handler/server75.rb 2018-05-07 14:53:30.000000000 +0000 +++ ruby-websocket-1.2.8/lib/websocket/handshake/handler/server75.rb 2018-06-25 07:01:34.000000000 +0000 @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module WebSocket module Handshake module Handler @@ -20,8 +22,8 @@ # @see WebSocket::Handshake::Handler::Base#handshake_keys def handshake_keys [ - %w(Upgrade WebSocket), - %w(Connection Upgrade), + %w[Upgrade WebSocket], + %w[Connection Upgrade], [headers[:origin], @handshake.headers['origin']], [headers[:location], @handshake.uri] ] + protocol diff -Nru ruby-websocket-1.2.5/lib/websocket/handshake/handler/server76.rb ruby-websocket-1.2.8/lib/websocket/handshake/handler/server76.rb --- ruby-websocket-1.2.5/lib/websocket/handshake/handler/server76.rb 2018-05-07 14:53:30.000000000 +0000 +++ ruby-websocket-1.2.8/lib/websocket/handshake/handler/server76.rb 2018-06-25 07:01:34.000000000 +0000 @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'digest/md5' module WebSocket diff -Nru ruby-websocket-1.2.5/lib/websocket/handshake/handler/server.rb ruby-websocket-1.2.8/lib/websocket/handshake/handler/server.rb --- ruby-websocket-1.2.5/lib/websocket/handshake/handler/server.rb 2018-05-07 14:53:30.000000000 +0000 +++ ruby-websocket-1.2.8/lib/websocket/handshake/handler/server.rb 2018-06-25 07:01:34.000000000 +0000 @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module WebSocket module Handshake module Handler diff -Nru ruby-websocket-1.2.5/lib/websocket/handshake/handler.rb ruby-websocket-1.2.8/lib/websocket/handshake/handler.rb --- ruby-websocket-1.2.5/lib/websocket/handshake/handler.rb 2018-05-07 14:53:30.000000000 +0000 +++ ruby-websocket-1.2.8/lib/websocket/handshake/handler.rb 2018-06-25 07:01:34.000000000 +0000 @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module WebSocket module Handshake module Handler diff -Nru ruby-websocket-1.2.5/lib/websocket/handshake/server.rb ruby-websocket-1.2.8/lib/websocket/handshake/server.rb --- ruby-websocket-1.2.5/lib/websocket/handshake/server.rb 2018-05-07 14:53:30.000000000 +0000 +++ ruby-websocket-1.2.8/lib/websocket/handshake/server.rb 2018-06-25 07:01:34.000000000 +0000 @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module WebSocket module Handshake # Construct or parse a server WebSocket handshake. diff -Nru ruby-websocket-1.2.5/lib/websocket/handshake.rb ruby-websocket-1.2.8/lib/websocket/handshake.rb --- ruby-websocket-1.2.5/lib/websocket/handshake.rb 2018-05-07 14:53:30.000000000 +0000 +++ ruby-websocket-1.2.8/lib/websocket/handshake.rb 2018-06-25 07:01:34.000000000 +0000 @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module WebSocket module Handshake autoload :Base, "#{::WebSocket::ROOT}/websocket/handshake/base" diff -Nru ruby-websocket-1.2.5/lib/websocket/nice_inspect.rb ruby-websocket-1.2.8/lib/websocket/nice_inspect.rb --- ruby-websocket-1.2.5/lib/websocket/nice_inspect.rb 2018-05-07 14:53:30.000000000 +0000 +++ ruby-websocket-1.2.8/lib/websocket/nice_inspect.rb 2018-06-25 07:01:34.000000000 +0000 @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module WebSocket module NiceInspect # Recreate inspect as #to_s will be overwritten diff -Nru ruby-websocket-1.2.5/lib/websocket/version.rb ruby-websocket-1.2.8/lib/websocket/version.rb --- ruby-websocket-1.2.5/lib/websocket/version.rb 2018-05-07 14:53:30.000000000 +0000 +++ ruby-websocket-1.2.8/lib/websocket/version.rb 2018-06-25 07:01:34.000000000 +0000 @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module WebSocket - VERSION = '1.2.5'.freeze + VERSION = '1.2.8'.freeze end diff -Nru ruby-websocket-1.2.5/lib/websocket.rb ruby-websocket-1.2.8/lib/websocket.rb --- ruby-websocket-1.2.5/lib/websocket.rb 2018-05-07 14:53:30.000000000 +0000 +++ ruby-websocket-1.2.8/lib/websocket.rb 2018-06-25 07:01:34.000000000 +0000 @@ -1,3 +1,5 @@ +# frozen_string_literal: true + # WebSocket protocol implementation in Ruby # This module does not provide a WebSocket server or client, but is made for using # in http servers or clients to provide WebSocket support. @@ -6,7 +8,7 @@ module WebSocket # Default WebSocket version to use DEFAULT_VERSION = 13 - ROOT = File.expand_path(File.dirname(__FILE__)) + ROOT = __dir__ autoload :Error, "#{ROOT}/websocket/error" autoload :ExceptionHandler, "#{ROOT}/websocket/exception_handler" diff -Nru ruby-websocket-1.2.5/Rakefile ruby-websocket-1.2.8/Rakefile --- ruby-websocket-1.2.5/Rakefile 2018-05-07 14:53:30.000000000 +0000 +++ ruby-websocket-1.2.8/Rakefile 2018-06-25 07:01:34.000000000 +0000 @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'bundler' require 'rspec/core/rake_task' require 'rubocop/rake_task' @@ -11,7 +13,7 @@ RuboCop::RakeTask.new -task default: %i(spec rubocop) +task default: %i[spec rubocop] namespace :autobahn do desc 'Run autobahn tests for client' diff -Nru ruby-websocket-1.2.5/.rubocop.yml ruby-websocket-1.2.8/.rubocop.yml --- ruby-websocket-1.2.5/.rubocop.yml 2018-05-07 14:53:30.000000000 +0000 +++ ruby-websocket-1.2.8/.rubocop.yml 2018-06-25 07:01:34.000000000 +0000 @@ -4,6 +4,13 @@ DisplayCopNames: true TargetRubyVersion: 2.1 +# New version of Rubocop does not support 2.0 +Gemspec/RequiredRubyVersion: + Enabled: false + +Layout/IndentHeredoc: + Enabled: false + # Target: 15 Metrics/AbcSize: Max: 24 @@ -40,6 +47,9 @@ - lib/websocket/frame/handler/handler75.rb - spec/support/handshake_requests.rb +RSpec/ContextWording: + Enabled: false + RSpec/DescribeClass: Enabled: false diff -Nru ruby-websocket-1.2.5/spec/frame/incoming_03_spec.rb ruby-websocket-1.2.8/spec/frame/incoming_03_spec.rb --- ruby-websocket-1.2.5/spec/frame/incoming_03_spec.rb 2018-05-07 14:53:30.000000000 +0000 +++ ruby-websocket-1.2.8/spec/frame/incoming_03_spec.rb 2018-06-25 07:01:34.000000000 +0000 @@ -1,9 +1,11 @@ # encoding: binary +# frozen_string_literal: true require 'spec_helper' RSpec.describe 'Incoming frame draft 03' do subject { frame } + let(:version) { 3 } let(:frame) { WebSocket::Frame::Incoming.new(version: version, data: encoded_text) } let(:encoded_text) { nil } @@ -11,14 +13,14 @@ let(:frame_type) { nil } let(:error) { nil } - it_should_behave_like 'valid_incoming_frame' + it_behaves_like 'valid_incoming_frame' context 'should properly decode close frame' do let(:encoded_text) { "\x01\x05" + decoded_text } let(:frame_type) { :close } let(:decoded_text) { 'Hello' } - it_should_behave_like 'valid_incoming_frame' + it_behaves_like 'valid_incoming_frame' end context 'should properly decode ping frame' do @@ -26,7 +28,7 @@ let(:frame_type) { :ping } let(:decoded_text) { 'Hello' } - it_should_behave_like 'valid_incoming_frame' + it_behaves_like 'valid_incoming_frame' end context 'should properly decode pong frame' do @@ -34,7 +36,7 @@ let(:frame_type) { :pong } let(:decoded_text) { 'Hello' } - it_should_behave_like 'valid_incoming_frame' + it_behaves_like 'valid_incoming_frame' end context 'should properly decode text frame' do @@ -42,7 +44,7 @@ let(:decoded_text) { 'Hello' } let(:frame_type) { :text } - it_should_behave_like 'valid_incoming_frame' + it_behaves_like 'valid_incoming_frame' end context 'should properly decode text frame with continuation' do @@ -50,15 +52,15 @@ let(:frame_type) { :text } let(:decoded_text) { 'Hello' } - it_should_behave_like 'valid_incoming_frame' + it_behaves_like 'valid_incoming_frame' end context 'should properly decode text frame in between of continuation' do let(:encoded_text) { "\x84\x03Hel\x03\x03abc\x00\x02lo" } - let(:frame_type) { %i(pong text) } - let(:decoded_text) { %w(abc Hello) } + let(:frame_type) { %i[pong text] } + let(:decoded_text) { %w[abc Hello] } - it_should_behave_like 'valid_incoming_frame' + it_behaves_like 'valid_incoming_frame' end context 'should not return unfinished more frame' do @@ -66,7 +68,7 @@ let(:frame_type) { :pong } let(:decoded_text) { 'abc' } - it_should_behave_like 'valid_incoming_frame' + it_behaves_like 'valid_incoming_frame' end context 'should properly decode 256 bytes binary frame' do @@ -74,7 +76,7 @@ let(:frame_type) { :binary } let(:decoded_text) { 'a' * 256 } - it_should_behave_like 'valid_incoming_frame' + it_behaves_like 'valid_incoming_frame' end context 'should properly decode 64KiB binary frame' do @@ -82,14 +84,14 @@ let(:frame_type) { :binary } let(:decoded_text) { 'a' * 65_536 } - it_should_behave_like 'valid_incoming_frame' + it_behaves_like 'valid_incoming_frame' end context 'should wait with incomplete frame' do let(:encoded_text) { "\x04\x06Hello" } let(:decoded_text) { nil } - it_should_behave_like 'valid_incoming_frame' + it_behaves_like 'valid_incoming_frame' end context 'should raise error with invalid opcode' do @@ -97,7 +99,7 @@ let(:decoded_text) { nil } let(:error) { WebSocket::Error::Frame::UnknownOpcode } - it_should_behave_like 'valid_incoming_frame' + it_behaves_like 'valid_incoming_frame' end context 'should raise error with too long frame' do @@ -105,7 +107,7 @@ let(:decoded_text) { nil } let(:error) { WebSocket::Error::Frame::TooLong } - it_should_behave_like 'valid_incoming_frame' + it_behaves_like 'valid_incoming_frame' end context 'should raise error with continuation frame without more frame earlier' do @@ -113,6 +115,6 @@ let(:decoded_text) { nil } let(:error) { WebSocket::Error::Frame::UnexpectedContinuationFrame } - it_should_behave_like 'valid_incoming_frame' + it_behaves_like 'valid_incoming_frame' end end diff -Nru ruby-websocket-1.2.5/spec/frame/incoming_04_spec.rb ruby-websocket-1.2.8/spec/frame/incoming_04_spec.rb --- ruby-websocket-1.2.5/spec/frame/incoming_04_spec.rb 2018-05-07 14:53:30.000000000 +0000 +++ ruby-websocket-1.2.8/spec/frame/incoming_04_spec.rb 2018-06-25 07:01:34.000000000 +0000 @@ -1,9 +1,11 @@ # encoding: binary +# frozen_string_literal: true require 'spec_helper' RSpec.describe 'Incoming frame draft 04' do subject { frame } + let(:version) { 4 } let(:frame) { WebSocket::Frame::Incoming.new(version: version, data: encoded_text) } let(:encoded_text) { nil } @@ -11,14 +13,14 @@ let(:frame_type) { nil } let(:error) { nil } - it_should_behave_like 'valid_incoming_frame' + it_behaves_like 'valid_incoming_frame' context 'should properly decode close frame' do let(:encoded_text) { "\x81\x05" + decoded_text } let(:frame_type) { :close } let(:decoded_text) { 'Hello' } - it_should_behave_like 'valid_incoming_frame' + it_behaves_like 'valid_incoming_frame' end context 'should properly decode ping frame' do @@ -26,7 +28,7 @@ let(:frame_type) { :ping } let(:decoded_text) { 'Hello' } - it_should_behave_like 'valid_incoming_frame' + it_behaves_like 'valid_incoming_frame' end context 'should properly decode pong frame' do @@ -34,7 +36,7 @@ let(:frame_type) { :pong } let(:decoded_text) { 'Hello' } - it_should_behave_like 'valid_incoming_frame' + it_behaves_like 'valid_incoming_frame' end context 'should properly decode text frame' do @@ -42,7 +44,7 @@ let(:decoded_text) { 'Hello' } let(:frame_type) { :text } - it_should_behave_like 'valid_incoming_frame' + it_behaves_like 'valid_incoming_frame' end context 'should properly decode text frame with continuation' do @@ -50,15 +52,15 @@ let(:frame_type) { :text } let(:decoded_text) { 'Hello' } - it_should_behave_like 'valid_incoming_frame' + it_behaves_like 'valid_incoming_frame' end context 'should properly decode text frame in between of continuation' do let(:encoded_text) { "\x04\x03Hel\x83\x03abc\x80\x02lo" } - let(:frame_type) { %i(pong text) } - let(:decoded_text) { %w(abc Hello) } + let(:frame_type) { %i[pong text] } + let(:decoded_text) { %w[abc Hello] } - it_should_behave_like 'valid_incoming_frame' + it_behaves_like 'valid_incoming_frame' end context 'should not return unfinished more frame' do @@ -66,7 +68,7 @@ let(:frame_type) { :pong } let(:decoded_text) { 'abc' } - it_should_behave_like 'valid_incoming_frame' + it_behaves_like 'valid_incoming_frame' end context 'should properly decode 256 bytes binary frame' do @@ -74,7 +76,7 @@ let(:frame_type) { :binary } let(:decoded_text) { 'a' * 256 } - it_should_behave_like 'valid_incoming_frame' + it_behaves_like 'valid_incoming_frame' end context 'should properly decode 64KiB binary frame' do @@ -82,14 +84,14 @@ let(:frame_type) { :binary } let(:decoded_text) { 'a' * 65_536 } - it_should_behave_like 'valid_incoming_frame' + it_behaves_like 'valid_incoming_frame' end context 'should wait with incomplete frame' do let(:encoded_text) { "\x84\x06Hello" } let(:decoded_text) { nil } - it_should_behave_like 'valid_incoming_frame' + it_behaves_like 'valid_incoming_frame' end context 'should raise error with invalid opcode' do @@ -97,7 +99,7 @@ let(:decoded_text) { nil } let(:error) { WebSocket::Error::Frame::UnknownOpcode } - it_should_behave_like 'valid_incoming_frame' + it_behaves_like 'valid_incoming_frame' end context 'should raise error with too long frame' do @@ -105,7 +107,7 @@ let(:decoded_text) { nil } let(:error) { WebSocket::Error::Frame::TooLong } - it_should_behave_like 'valid_incoming_frame' + it_behaves_like 'valid_incoming_frame' end context 'should raise error with continuation frame without more frame earlier' do @@ -113,6 +115,6 @@ let(:decoded_text) { nil } let(:error) { WebSocket::Error::Frame::UnexpectedContinuationFrame } - it_should_behave_like 'valid_incoming_frame' + it_behaves_like 'valid_incoming_frame' end end diff -Nru ruby-websocket-1.2.5/spec/frame/incoming_05_spec.rb ruby-websocket-1.2.8/spec/frame/incoming_05_spec.rb --- ruby-websocket-1.2.5/spec/frame/incoming_05_spec.rb 2018-05-07 14:53:30.000000000 +0000 +++ ruby-websocket-1.2.8/spec/frame/incoming_05_spec.rb 2018-06-25 07:01:34.000000000 +0000 @@ -1,9 +1,11 @@ # encoding: binary +# frozen_string_literal: true require 'spec_helper' RSpec.describe 'Incoming frame draft 05' do subject { frame } + let(:version) { 5 } let(:frame) { WebSocket::Frame::Incoming.new(version: version, data: encoded_text) } let(:encoded_text) { nil } @@ -11,14 +13,14 @@ let(:frame_type) { nil } let(:error) { nil } - it_should_behave_like 'valid_incoming_frame' + it_behaves_like 'valid_incoming_frame' context 'should properly decode close frame' do let(:encoded_text) { "\x81\x05" + decoded_text } let(:frame_type) { :close } let(:decoded_text) { 'Hello' } - it_should_behave_like 'valid_incoming_frame' + it_behaves_like 'valid_incoming_frame' end context 'should properly decode ping frame' do @@ -26,7 +28,7 @@ let(:frame_type) { :ping } let(:decoded_text) { 'Hello' } - it_should_behave_like 'valid_incoming_frame' + it_behaves_like 'valid_incoming_frame' end context 'should properly decode pong frame' do @@ -34,7 +36,7 @@ let(:frame_type) { :pong } let(:decoded_text) { 'Hello' } - it_should_behave_like 'valid_incoming_frame' + it_behaves_like 'valid_incoming_frame' end context 'should properly decode text frame' do @@ -42,7 +44,7 @@ let(:decoded_text) { 'Hello' } let(:frame_type) { :text } - it_should_behave_like 'valid_incoming_frame' + it_behaves_like 'valid_incoming_frame' end context 'should properly decode masked text frame' do @@ -50,7 +52,7 @@ let(:decoded_text) { 'Hello' } let(:frame_type) { :text } - it_should_behave_like 'valid_incoming_frame' + it_behaves_like 'valid_incoming_frame' end context 'should properly decode text frame with continuation' do @@ -58,7 +60,7 @@ let(:frame_type) { :text } let(:decoded_text) { 'Hello' } - it_should_behave_like 'valid_incoming_frame' + it_behaves_like 'valid_incoming_frame' end context 'should properly decode masked text frame with continuation' do @@ -66,15 +68,15 @@ let(:frame_type) { :text } let(:decoded_text) { 'Hello' } - it_should_behave_like 'valid_incoming_frame' + it_behaves_like 'valid_incoming_frame' end context 'should properly decode text frame in between of continuation' do let(:encoded_text) { "\x04\x03Hel\x83\x03abc\x80\x02lo" } - let(:frame_type) { %i(pong text) } - let(:decoded_text) { %w(abc Hello) } + let(:frame_type) { %i[pong text] } + let(:decoded_text) { %w[abc Hello] } - it_should_behave_like 'valid_incoming_frame' + it_behaves_like 'valid_incoming_frame' end context 'should not return unfinished more frame' do @@ -82,7 +84,7 @@ let(:frame_type) { :pong } let(:decoded_text) { 'abc' } - it_should_behave_like 'valid_incoming_frame' + it_behaves_like 'valid_incoming_frame' end context 'should properly decode 256 bytes binary frame' do @@ -90,7 +92,7 @@ let(:frame_type) { :binary } let(:decoded_text) { 'a' * 256 } - it_should_behave_like 'valid_incoming_frame' + it_behaves_like 'valid_incoming_frame' end context 'should properly decode 64KiB binary frame' do @@ -98,14 +100,14 @@ let(:frame_type) { :binary } let(:decoded_text) { 'a' * 65_536 } - it_should_behave_like 'valid_incoming_frame' + it_behaves_like 'valid_incoming_frame' end context 'should wait with incomplete frame' do let(:encoded_text) { "\x84\x06Hello" } let(:decoded_text) { nil } - it_should_behave_like 'valid_incoming_frame' + it_behaves_like 'valid_incoming_frame' end context 'should raise error with invalid opcode' do @@ -113,7 +115,7 @@ let(:decoded_text) { nil } let(:error) { WebSocket::Error::Frame::UnknownOpcode } - it_should_behave_like 'valid_incoming_frame' + it_behaves_like 'valid_incoming_frame' end context 'should raise error with too long frame' do @@ -121,7 +123,7 @@ let(:decoded_text) { nil } let(:error) { WebSocket::Error::Frame::TooLong } - it_should_behave_like 'valid_incoming_frame' + it_behaves_like 'valid_incoming_frame' end context 'should raise error with continuation frame without more frame earlier' do @@ -129,6 +131,6 @@ let(:decoded_text) { nil } let(:error) { WebSocket::Error::Frame::UnexpectedContinuationFrame } - it_should_behave_like 'valid_incoming_frame' + it_behaves_like 'valid_incoming_frame' end end diff -Nru ruby-websocket-1.2.5/spec/frame/incoming_07_spec.rb ruby-websocket-1.2.8/spec/frame/incoming_07_spec.rb --- ruby-websocket-1.2.5/spec/frame/incoming_07_spec.rb 2018-05-07 14:53:30.000000000 +0000 +++ ruby-websocket-1.2.8/spec/frame/incoming_07_spec.rb 2018-06-25 07:01:34.000000000 +0000 @@ -1,9 +1,11 @@ # encoding: binary +# frozen_string_literal: true require 'spec_helper' RSpec.describe 'Incoming frame draft 07' do subject { frame } + let(:version) { 7 } let(:frame) { WebSocket::Frame::Incoming.new(version: version, data: encoded_text) } let(:encoded_text) { nil } @@ -11,7 +13,7 @@ let(:frame_type) { nil } let(:error) { nil } - it_should_behave_like 'valid_incoming_frame' + it_behaves_like 'valid_incoming_frame' context 'should properly decode close frame' do let(:encoded_text) { "\x88\x07\x03\xE8" + decoded_text } @@ -19,7 +21,7 @@ let(:decoded_text) { 'Hello' } let(:close_code) { 1000 } - it_should_behave_like 'valid_incoming_frame' + it_behaves_like 'valid_incoming_frame' end context 'should raise error with invalid close code' do @@ -27,7 +29,7 @@ let(:decoded_text) { nil } let(:error) { WebSocket::Error::Frame::UnknownCloseCode } - it_should_behave_like 'valid_incoming_frame' + it_behaves_like 'valid_incoming_frame' end context 'should properly decode close frame with invalid UTF-8 message' do @@ -35,7 +37,7 @@ let(:decoded_text) { nil } let(:error) { WebSocket::Error::Frame::InvalidPayloadEncoding } - it_should_behave_like 'valid_incoming_frame' + it_behaves_like 'valid_incoming_frame' end context 'should properly decode ping frame' do @@ -43,7 +45,7 @@ let(:frame_type) { :ping } let(:decoded_text) { 'Hello' } - it_should_behave_like 'valid_incoming_frame' + it_behaves_like 'valid_incoming_frame' end context 'should properly decode pong frame' do @@ -51,7 +53,7 @@ let(:frame_type) { :pong } let(:decoded_text) { 'Hello' } - it_should_behave_like 'valid_incoming_frame' + it_behaves_like 'valid_incoming_frame' end context 'should properly decode text frame' do @@ -59,7 +61,7 @@ let(:decoded_text) { 'Hello' } let(:frame_type) { :text } - it_should_behave_like 'valid_incoming_frame' + it_behaves_like 'valid_incoming_frame' end context 'should properly decode masked text frame' do @@ -67,7 +69,7 @@ let(:decoded_text) { 'Hello' } let(:frame_type) { :text } - it_should_behave_like 'valid_incoming_frame' + it_behaves_like 'valid_incoming_frame' end context 'should properly decode text frame with continuation' do @@ -75,7 +77,7 @@ let(:frame_type) { :text } let(:decoded_text) { 'Hello' } - it_should_behave_like 'valid_incoming_frame' + it_behaves_like 'valid_incoming_frame' end context 'should properly decode masked text frame with continuation' do @@ -83,15 +85,15 @@ let(:frame_type) { :text } let(:decoded_text) { 'Hello' } - it_should_behave_like 'valid_incoming_frame' + it_behaves_like 'valid_incoming_frame' end context 'should properly decode text frame in between of continuation' do let(:encoded_text) { "\x01\x03Hel\x8a\x03abc\x80\x02lo" } - let(:frame_type) { %i(pong text) } - let(:decoded_text) { %w(abc Hello) } + let(:frame_type) { %i[pong text] } + let(:decoded_text) { %w[abc Hello] } - it_should_behave_like 'valid_incoming_frame' + it_behaves_like 'valid_incoming_frame' end context 'should not return unfinished more frame' do @@ -99,7 +101,7 @@ let(:frame_type) { :pong } let(:decoded_text) { 'abc' } - it_should_behave_like 'valid_incoming_frame' + it_behaves_like 'valid_incoming_frame' end context 'should properly decode 256 bytes binary frame' do @@ -107,7 +109,7 @@ let(:frame_type) { :binary } let(:decoded_text) { 'a' * 256 } - it_should_behave_like 'valid_incoming_frame' + it_behaves_like 'valid_incoming_frame' end context 'should properly decode 64KiB binary frame' do @@ -115,14 +117,14 @@ let(:frame_type) { :binary } let(:decoded_text) { 'a' * 65_536 } - it_should_behave_like 'valid_incoming_frame' + it_behaves_like 'valid_incoming_frame' end context 'should wait with incomplete frame' do let(:encoded_text) { "\x81\x06Hello" } let(:decoded_text) { nil } - it_should_behave_like 'valid_incoming_frame' + it_behaves_like 'valid_incoming_frame' end context 'should raise error with invalid opcode' do @@ -130,7 +132,7 @@ let(:decoded_text) { nil } let(:error) { WebSocket::Error::Frame::UnknownOpcode } - it_should_behave_like 'valid_incoming_frame' + it_behaves_like 'valid_incoming_frame' end context 'should raise error with too long frame' do @@ -138,7 +140,7 @@ let(:decoded_text) { nil } let(:error) { WebSocket::Error::Frame::TooLong } - it_should_behave_like 'valid_incoming_frame' + it_behaves_like 'valid_incoming_frame' end context 'should raise error with continuation frame without more frame earlier' do @@ -146,6 +148,6 @@ let(:decoded_text) { nil } let(:error) { WebSocket::Error::Frame::UnexpectedContinuationFrame } - it_should_behave_like 'valid_incoming_frame' + it_behaves_like 'valid_incoming_frame' end end diff -Nru ruby-websocket-1.2.5/spec/frame/incoming_75_spec.rb ruby-websocket-1.2.8/spec/frame/incoming_75_spec.rb --- ruby-websocket-1.2.5/spec/frame/incoming_75_spec.rb 2018-05-07 14:53:30.000000000 +0000 +++ ruby-websocket-1.2.8/spec/frame/incoming_75_spec.rb 2018-06-25 07:01:34.000000000 +0000 @@ -1,9 +1,11 @@ # encoding: binary +# frozen_string_literal: true require 'spec_helper' RSpec.describe 'Incoming frame draft 75' do subject { frame } + let(:version) { 75 } let(:frame) { WebSocket::Frame::Incoming.new(version: version, data: encoded_text) } let(:encoded_text) { nil } @@ -11,22 +13,22 @@ let(:frame_type) { nil } let(:error) { nil } - it_should_behave_like 'valid_incoming_frame' + it_behaves_like 'valid_incoming_frame' context 'with valid text frame' do let(:encoded_text) { "\x00abc\xFF" } let(:decoded_text) { 'abc' } let(:frame_type) { :text } - it_should_behave_like 'valid_incoming_frame' + it_behaves_like 'valid_incoming_frame' end context 'with two frames' do let(:encoded_text) { "\x00abc\xFF\x00def\xFF" } - let(:decoded_text) { %w(abc def) } - let(:frame_type) { %i(text text) } + let(:decoded_text) { %w[abc def] } + let(:frame_type) { %i[text text] } - it_should_behave_like 'valid_incoming_frame' + it_behaves_like 'valid_incoming_frame' end context 'with close frame' do @@ -34,27 +36,27 @@ let(:decoded_text) { '' } let(:frame_type) { :close } - it_should_behave_like 'valid_incoming_frame' + it_behaves_like 'valid_incoming_frame' end context 'with incomplete frame' do let(:encoded_text) { "\x00test" } let(:decoded_text) { nil } - it_should_behave_like 'valid_incoming_frame' + it_behaves_like 'valid_incoming_frame' end context 'with invalid frame' do let(:encoded_text) { 'invalid' } let(:error) { WebSocket::Error::Frame::Invalid } - it_should_behave_like 'valid_incoming_frame' + it_behaves_like 'valid_incoming_frame' end context 'with too long frame' do let(:encoded_text) { "\x00" + 'a' * WebSocket.max_frame_size + "\xFF" } let(:error) { WebSocket::Error::Frame::TooLong } - it_should_behave_like 'valid_incoming_frame' + it_behaves_like 'valid_incoming_frame' end end diff -Nru ruby-websocket-1.2.5/spec/frame/incoming_common_spec.rb ruby-websocket-1.2.8/spec/frame/incoming_common_spec.rb --- ruby-websocket-1.2.5/spec/frame/incoming_common_spec.rb 2018-05-07 14:53:30.000000000 +0000 +++ ruby-websocket-1.2.8/spec/frame/incoming_common_spec.rb 2018-06-25 07:01:34.000000000 +0000 @@ -1,4 +1,5 @@ # encoding: binary +# frozen_string_literal: true require 'spec_helper' diff -Nru ruby-websocket-1.2.5/spec/frame/masking_spec.rb ruby-websocket-1.2.8/spec/frame/masking_spec.rb --- ruby-websocket-1.2.5/spec/frame/masking_spec.rb 2018-05-07 14:53:30.000000000 +0000 +++ ruby-websocket-1.2.8/spec/frame/masking_spec.rb 2018-06-25 07:01:34.000000000 +0000 @@ -1,4 +1,5 @@ # encoding: binary +# frozen_string_literal: true require 'spec_helper' diff -Nru ruby-websocket-1.2.5/spec/frame/outgoing_03_spec.rb ruby-websocket-1.2.8/spec/frame/outgoing_03_spec.rb --- ruby-websocket-1.2.5/spec/frame/outgoing_03_spec.rb 2018-05-07 14:53:30.000000000 +0000 +++ ruby-websocket-1.2.8/spec/frame/outgoing_03_spec.rb 2018-06-25 07:01:34.000000000 +0000 @@ -1,9 +1,11 @@ # encoding: binary +# frozen_string_literal: true require 'spec_helper' RSpec.describe 'Outgoing frame draft 03' do subject { frame } + let(:version) { 3 } let(:frame) { WebSocket::Frame::Outgoing.new(version: version, data: decoded_text, type: frame_type) } let(:decoded_text) { '' } @@ -12,7 +14,7 @@ let(:require_sending) { true } let(:error) { nil } - it_should_behave_like 'valid_outgoing_frame' + it_behaves_like 'valid_outgoing_frame' context 'should properly encode close frame' do let(:frame_type) { :close } @@ -20,7 +22,7 @@ let(:encoded_text) { "\x01\x05" + decoded_text } let(:require_sending) { true } - it_should_behave_like 'valid_outgoing_frame' + it_behaves_like 'valid_outgoing_frame' end context 'should properly encode ping frame' do @@ -29,7 +31,7 @@ let(:encoded_text) { "\x02\x05" + decoded_text } let(:require_sending) { true } - it_should_behave_like 'valid_outgoing_frame' + it_behaves_like 'valid_outgoing_frame' end context 'should properly encode pong frame' do @@ -38,7 +40,7 @@ let(:encoded_text) { "\x03\x05" + decoded_text } let(:require_sending) { true } - it_should_behave_like 'valid_outgoing_frame' + it_behaves_like 'valid_outgoing_frame' end context 'should properly encode text frame' do @@ -46,7 +48,7 @@ let(:encoded_text) { "\x04\x05" + decoded_text } let(:require_sending) { true } - it_should_behave_like 'valid_outgoing_frame' + it_behaves_like 'valid_outgoing_frame' end context 'should properly encode 256 bytes binary frame' do @@ -55,7 +57,7 @@ let(:encoded_text) { "\x05\x7E\x01\x00" + decoded_text } let(:require_sending) { true } - it_should_behave_like 'valid_outgoing_frame' + it_behaves_like 'valid_outgoing_frame' end context 'should properly encode 64KiB binary frame' do @@ -64,7 +66,7 @@ let(:encoded_text) { "\x05\x7F\x00\x00\x00\x00\x00\x01\x00\x00" + decoded_text } let(:require_sending) { true } - it_should_behave_like 'valid_outgoing_frame' + it_behaves_like 'valid_outgoing_frame' end context 'should return error for unknown frame type' do @@ -74,6 +76,6 @@ let(:error) { :unknown_frame_type } let(:require_sending) { false } - it_should_behave_like 'valid_outgoing_frame' + it_behaves_like 'valid_outgoing_frame' end end diff -Nru ruby-websocket-1.2.5/spec/frame/outgoing_04_spec.rb ruby-websocket-1.2.8/spec/frame/outgoing_04_spec.rb --- ruby-websocket-1.2.5/spec/frame/outgoing_04_spec.rb 2018-05-07 14:53:30.000000000 +0000 +++ ruby-websocket-1.2.8/spec/frame/outgoing_04_spec.rb 2018-06-25 07:01:34.000000000 +0000 @@ -1,9 +1,11 @@ # encoding: binary +# frozen_string_literal: true require 'spec_helper' RSpec.describe 'Outgoing frame draft 04' do subject { frame } + let(:version) { 4 } let(:frame) { WebSocket::Frame::Outgoing.new(version: version, data: decoded_text, type: frame_type) } let(:decoded_text) { '' } @@ -12,7 +14,7 @@ let(:require_sending) { true } let(:error) { nil } - it_should_behave_like 'valid_outgoing_frame' + it_behaves_like 'valid_outgoing_frame' context 'should properly encode close frame' do let(:frame_type) { :close } @@ -20,7 +22,7 @@ let(:encoded_text) { "\x81\x05" + decoded_text } let(:require_sending) { true } - it_should_behave_like 'valid_outgoing_frame' + it_behaves_like 'valid_outgoing_frame' end context 'should properly encode ping frame' do @@ -29,7 +31,7 @@ let(:encoded_text) { "\x82\x05" + decoded_text } let(:require_sending) { true } - it_should_behave_like 'valid_outgoing_frame' + it_behaves_like 'valid_outgoing_frame' end context 'should properly encode pong frame' do @@ -38,7 +40,7 @@ let(:encoded_text) { "\x83\x05" + decoded_text } let(:require_sending) { true } - it_should_behave_like 'valid_outgoing_frame' + it_behaves_like 'valid_outgoing_frame' end context 'should properly encode text frame' do @@ -46,7 +48,7 @@ let(:encoded_text) { "\x84\x05" + decoded_text } let(:require_sending) { true } - it_should_behave_like 'valid_outgoing_frame' + it_behaves_like 'valid_outgoing_frame' end context 'should properly encode 256 bytes binary frame' do @@ -55,7 +57,7 @@ let(:encoded_text) { "\x85\x7E\x01\x00" + decoded_text } let(:require_sending) { true } - it_should_behave_like 'valid_outgoing_frame' + it_behaves_like 'valid_outgoing_frame' end context 'should properly encode 64KiB binary frame' do @@ -64,7 +66,7 @@ let(:encoded_text) { "\x85\x7F\x00\x00\x00\x00\x00\x01\x00\x00" + decoded_text } let(:require_sending) { true } - it_should_behave_like 'valid_outgoing_frame' + it_behaves_like 'valid_outgoing_frame' end context 'should return error for unknown frame type' do @@ -74,6 +76,6 @@ let(:error) { :unknown_frame_type } let(:require_sending) { false } - it_should_behave_like 'valid_outgoing_frame' + it_behaves_like 'valid_outgoing_frame' end end diff -Nru ruby-websocket-1.2.5/spec/frame/outgoing_05_spec.rb ruby-websocket-1.2.8/spec/frame/outgoing_05_spec.rb --- ruby-websocket-1.2.5/spec/frame/outgoing_05_spec.rb 2018-05-07 14:53:30.000000000 +0000 +++ ruby-websocket-1.2.8/spec/frame/outgoing_05_spec.rb 2018-06-25 07:01:34.000000000 +0000 @@ -1,9 +1,11 @@ # encoding: binary +# frozen_string_literal: true require 'spec_helper' RSpec.describe 'Outgoing frame draft 05' do subject { frame } + let(:version) { 5 } let(:frame) { WebSocket::Frame::Outgoing.new(version: version, data: decoded_text, type: frame_type) } let(:decoded_text) { '' } @@ -12,7 +14,7 @@ let(:require_sending) { true } let(:error) { nil } - it_should_behave_like 'valid_outgoing_frame' + it_behaves_like 'valid_outgoing_frame' context 'should properly encode close frame' do let(:frame_type) { :close } @@ -20,7 +22,7 @@ let(:encoded_text) { "\x81\x05" + decoded_text } let(:require_sending) { true } - it_should_behave_like 'valid_outgoing_frame' + it_behaves_like 'valid_outgoing_frame' end context 'should properly encode ping frame' do @@ -29,7 +31,7 @@ let(:encoded_text) { "\x82\x05" + decoded_text } let(:require_sending) { true } - it_should_behave_like 'valid_outgoing_frame' + it_behaves_like 'valid_outgoing_frame' end context 'should properly encode pong frame' do @@ -38,7 +40,7 @@ let(:encoded_text) { "\x83\x05" + decoded_text } let(:require_sending) { true } - it_should_behave_like 'valid_outgoing_frame' + it_behaves_like 'valid_outgoing_frame' end context 'should properly encode text frame' do @@ -46,7 +48,7 @@ let(:encoded_text) { "\x84\x05" + decoded_text } let(:require_sending) { true } - it_should_behave_like 'valid_outgoing_frame' + it_behaves_like 'valid_outgoing_frame' end context 'should properly encode 256 bytes binary frame' do @@ -55,7 +57,7 @@ let(:encoded_text) { "\x85\x7E\x01\x00" + decoded_text } let(:require_sending) { true } - it_should_behave_like 'valid_outgoing_frame' + it_behaves_like 'valid_outgoing_frame' end context 'should properly encode 64KiB binary frame' do @@ -64,7 +66,7 @@ let(:encoded_text) { "\x85\x7F\x00\x00\x00\x00\x00\x01\x00\x00" + decoded_text } let(:require_sending) { true } - it_should_behave_like 'valid_outgoing_frame' + it_behaves_like 'valid_outgoing_frame' end context 'should return error for unknown frame type' do @@ -74,6 +76,6 @@ let(:error) { :unknown_frame_type } let(:require_sending) { false } - it_should_behave_like 'valid_outgoing_frame' + it_behaves_like 'valid_outgoing_frame' end end diff -Nru ruby-websocket-1.2.5/spec/frame/outgoing_07_spec.rb ruby-websocket-1.2.8/spec/frame/outgoing_07_spec.rb --- ruby-websocket-1.2.5/spec/frame/outgoing_07_spec.rb 2018-05-07 14:53:30.000000000 +0000 +++ ruby-websocket-1.2.8/spec/frame/outgoing_07_spec.rb 2018-06-25 07:01:34.000000000 +0000 @@ -1,9 +1,11 @@ # encoding: binary +# frozen_string_literal: true require 'spec_helper' RSpec.describe 'Outgoing frame draft 07' do subject { frame } + let(:version) { 7 } let(:frame) { WebSocket::Frame::Outgoing.new(version: version, data: decoded_text, type: frame_type, code: close_code) } let(:decoded_text) { '' } @@ -13,7 +15,7 @@ let(:require_sending) { true } let(:error) { nil } - it_should_behave_like 'valid_outgoing_frame' + it_behaves_like 'valid_outgoing_frame' context 'should properly encode close frame without close code' do let(:frame_type) { :close } @@ -21,7 +23,7 @@ let(:encoded_text) { "\x88\x07\x03\xE8" + decoded_text } let(:require_sending) { true } - it_should_behave_like 'valid_outgoing_frame' + it_behaves_like 'valid_outgoing_frame' end context 'should properly encode close frame with close code' do @@ -31,7 +33,7 @@ let(:encoded_text) { "\x88\x07\x03\xE9" + decoded_text } let(:require_sending) { true } - it_should_behave_like 'valid_outgoing_frame' + it_behaves_like 'valid_outgoing_frame' end context 'should properly encode ping frame' do @@ -40,7 +42,7 @@ let(:encoded_text) { "\x89\x05" + decoded_text } let(:require_sending) { true } - it_should_behave_like 'valid_outgoing_frame' + it_behaves_like 'valid_outgoing_frame' end context 'should properly encode pong frame' do @@ -49,7 +51,7 @@ let(:encoded_text) { "\x8a\x05" + decoded_text } let(:require_sending) { true } - it_should_behave_like 'valid_outgoing_frame' + it_behaves_like 'valid_outgoing_frame' end context 'should properly encode text frame' do @@ -57,7 +59,7 @@ let(:encoded_text) { "\x81\x05" + decoded_text } let(:require_sending) { true } - it_should_behave_like 'valid_outgoing_frame' + it_behaves_like 'valid_outgoing_frame' end context 'should properly encode 256 bytes binary frame' do @@ -66,7 +68,7 @@ let(:encoded_text) { "\x82\x7E\x01\x00" + decoded_text } let(:require_sending) { true } - it_should_behave_like 'valid_outgoing_frame' + it_behaves_like 'valid_outgoing_frame' end context 'should properly encode 64KiB binary frame' do @@ -75,7 +77,7 @@ let(:encoded_text) { "\x82\x7F\x00\x00\x00\x00\x00\x01\x00\x00" + decoded_text } let(:require_sending) { true } - it_should_behave_like 'valid_outgoing_frame' + it_behaves_like 'valid_outgoing_frame' end context 'should return error for unknown frame type' do @@ -85,6 +87,6 @@ let(:error) { :unknown_frame_type } let(:require_sending) { false } - it_should_behave_like 'valid_outgoing_frame' + it_behaves_like 'valid_outgoing_frame' end end diff -Nru ruby-websocket-1.2.5/spec/frame/outgoing_75_spec.rb ruby-websocket-1.2.8/spec/frame/outgoing_75_spec.rb --- ruby-websocket-1.2.5/spec/frame/outgoing_75_spec.rb 2018-05-07 14:53:30.000000000 +0000 +++ ruby-websocket-1.2.8/spec/frame/outgoing_75_spec.rb 2018-06-25 07:01:34.000000000 +0000 @@ -1,9 +1,11 @@ # encoding: binary +# frozen_string_literal: true require 'spec_helper' RSpec.describe 'Outgoing frame draft 75' do subject { frame } + let(:version) { 75 } let(:frame) { WebSocket::Frame::Outgoing.new(version: version, data: decoded_text, type: frame_type) } let(:decoded_text) { '' } @@ -12,14 +14,14 @@ let(:require_sending) { true } let(:error) { nil } - it_should_behave_like 'valid_outgoing_frame' + it_behaves_like 'valid_outgoing_frame' context 'should properly encode text frame' do let(:decoded_text) { 'abc' } let(:encoded_text) { "\x00abc\xFF" } let(:require_sending) { true } - it_should_behave_like 'valid_outgoing_frame' + it_behaves_like 'valid_outgoing_frame' end context 'should properly encode close frame' do @@ -28,7 +30,7 @@ let(:encoded_text) { "\xFF\x00" } let(:require_sending) { true } - it_should_behave_like 'valid_outgoing_frame' + it_behaves_like 'valid_outgoing_frame' end context 'should return error for unknown frame type' do @@ -38,6 +40,6 @@ let(:error) { :unknown_frame_type } let(:require_sending) { false } - it_should_behave_like 'valid_outgoing_frame' + it_behaves_like 'valid_outgoing_frame' end end diff -Nru ruby-websocket-1.2.5/spec/frame/outgoing_common_spec.rb ruby-websocket-1.2.8/spec/frame/outgoing_common_spec.rb --- ruby-websocket-1.2.5/spec/frame/outgoing_common_spec.rb 2018-05-07 14:53:30.000000000 +0000 +++ ruby-websocket-1.2.8/spec/frame/outgoing_common_spec.rb 2018-06-25 07:01:34.000000000 +0000 @@ -1,4 +1,5 @@ # encoding: binary +# frozen_string_literal: true require 'spec_helper' diff -Nru ruby-websocket-1.2.5/spec/handshake/client_04_spec.rb ruby-websocket-1.2.8/spec/handshake/client_04_spec.rb --- ruby-websocket-1.2.5/spec/handshake/client_04_spec.rb 2018-05-07 14:53:30.000000000 +0000 +++ ruby-websocket-1.2.8/spec/handshake/client_04_spec.rb 2018-06-25 07:01:34.000000000 +0000 @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'spec_helper' RSpec.describe 'Client draft 4 handshake' do @@ -7,7 +9,7 @@ let(:client_request) { client_handshake_04({ key: handshake.handler.send(:key), version: version }.merge(@request_params || {})) } let(:server_response) { server_handshake_04({ accept: handshake.handler.send(:accept) }.merge(@request_params || {})) } - it_should_behave_like 'all client drafts' + it_behaves_like 'all client drafts' it 'disallows client with invalid challenge' do @request_params = { accept: 'invalid' } @@ -22,7 +24,7 @@ let(:handshake) { WebSocket::Handshake::Client.new(uri: 'ws://example.com/demo', origin: 'http://example.com', version: version, protocols: protocols) } context 'single protocol requested' do - let(:protocols) { %w(binary) } + let(:protocols) { %w[binary] } it 'returns a valid handshake' do @request_params = { headers: { 'Sec-WebSocket-Protocol' => 'binary' } } @@ -34,7 +36,7 @@ end context 'multiple protocols requested' do - let(:protocols) { %w(binary xmpp) } + let(:protocols) { %w[binary xmpp] } it 'returns with a valid handshake' do @request_params = { headers: { 'Sec-WebSocket-Protocol' => 'xmpp' } } @@ -46,7 +48,7 @@ end context 'unsupported protocol requested' do - let(:protocols) { %w(binary xmpp) } + let(:protocols) { %w[binary xmpp] } it 'fails with an unsupported protocol error' do @request_params = { headers: { 'Sec-WebSocket-Protocol' => 'generic' } } diff -Nru ruby-websocket-1.2.5/spec/handshake/client_11_spec.rb ruby-websocket-1.2.8/spec/handshake/client_11_spec.rb --- ruby-websocket-1.2.5/spec/handshake/client_11_spec.rb 2018-05-07 14:53:30.000000000 +0000 +++ ruby-websocket-1.2.8/spec/handshake/client_11_spec.rb 2018-06-25 07:01:34.000000000 +0000 @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'spec_helper' RSpec.describe 'Client draft 11 handshake' do @@ -7,7 +9,7 @@ let(:client_request) { client_handshake_11({ key: handshake.handler.send(:key), version: version }.merge(@request_params || {})) } let(:server_response) { server_handshake_11({ accept: handshake.handler.send(:accept) }.merge(@request_params || {})) } - it_should_behave_like 'all client drafts' + it_behaves_like 'all client drafts' it 'disallows client with invalid challenge' do @request_params = { accept: 'invalid' } diff -Nru ruby-websocket-1.2.5/spec/handshake/client_75_spec.rb ruby-websocket-1.2.8/spec/handshake/client_75_spec.rb --- ruby-websocket-1.2.5/spec/handshake/client_75_spec.rb 2018-05-07 14:53:30.000000000 +0000 +++ ruby-websocket-1.2.8/spec/handshake/client_75_spec.rb 2018-06-25 07:01:34.000000000 +0000 @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'spec_helper' RSpec.describe 'Client draft 75 handshake' do @@ -7,10 +9,10 @@ let(:client_request) { client_handshake_75(@request_params || {}) } let(:server_response) { server_handshake_75(@request_params || {}) } - it_should_behave_like 'all client drafts' + it_behaves_like 'all client drafts' context 'protocol header specified' do - let(:handshake) { WebSocket::Handshake::Client.new(uri: 'ws://example.com/demo', origin: 'http://example.com', version: version, protocols: %w(binary)) } + let(:handshake) { WebSocket::Handshake::Client.new(uri: 'ws://example.com/demo', origin: 'http://example.com', version: version, protocols: %w[binary]) } context 'supported' do it 'returns a valid handshake' do diff -Nru ruby-websocket-1.2.5/spec/handshake/client_76_spec.rb ruby-websocket-1.2.8/spec/handshake/client_76_spec.rb --- ruby-websocket-1.2.5/spec/handshake/client_76_spec.rb 2018-05-07 14:53:30.000000000 +0000 +++ ruby-websocket-1.2.8/spec/handshake/client_76_spec.rb 2018-06-25 07:01:34.000000000 +0000 @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'spec_helper' RSpec.describe 'Client draft 76 handshake' do @@ -7,7 +9,7 @@ let(:client_request) { client_handshake_76({ key1: handshake.handler.send(:key1), key2: handshake.handler.send(:key2), key3: handshake.handler.send(:key3) }.merge(@request_params || {})) } let(:server_response) { server_handshake_76({ challenge: handshake.handler.send(:challenge) }.merge(@request_params || {})) } - it_should_behave_like 'all client drafts' + it_behaves_like 'all client drafts' it 'disallows client with invalid challenge' do @request_params = { challenge: 'invalid' } @@ -19,7 +21,7 @@ end context 'protocol header specified' do - let(:handshake) { WebSocket::Handshake::Client.new(uri: 'ws://example.com/demo', origin: 'http://example.com', version: version, protocols: %w(binary)) } + let(:handshake) { WebSocket::Handshake::Client.new(uri: 'ws://example.com/demo', origin: 'http://example.com', version: version, protocols: %w[binary]) } context 'supported' do it 'returns a valid handshake' do diff -Nru ruby-websocket-1.2.5/spec/handshake/server_04_spec.rb ruby-websocket-1.2.8/spec/handshake/server_04_spec.rb --- ruby-websocket-1.2.5/spec/handshake/server_04_spec.rb 2018-05-07 14:53:30.000000000 +0000 +++ ruby-websocket-1.2.8/spec/handshake/server_04_spec.rb 2018-06-25 07:01:34.000000000 +0000 @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'spec_helper' RSpec.describe 'Server draft 04 handshake' do @@ -6,7 +8,7 @@ let(:client_request) { client_handshake_04(@request_params || {}) } let(:server_response) { server_handshake_04(@request_params || {}) } - it_should_behave_like 'all server drafts' + it_behaves_like 'all server drafts' it 'disallows request without Sec-WebSocket-Key' do handshake << client_request.gsub(/^Sec-WebSocket-Key:.*\n/, '') @@ -17,7 +19,7 @@ end context 'protocol header specified' do - let(:handshake) { WebSocket::Handshake::Server.new(protocols: %w(binary xmpp)) } + let(:handshake) { WebSocket::Handshake::Server.new(protocols: %w[binary xmpp]) } context 'single protocol requested' do it 'returns with the same protocol' do diff -Nru ruby-websocket-1.2.5/spec/handshake/server_75_spec.rb ruby-websocket-1.2.8/spec/handshake/server_75_spec.rb --- ruby-websocket-1.2.5/spec/handshake/server_75_spec.rb 2018-05-07 14:53:30.000000000 +0000 +++ ruby-websocket-1.2.8/spec/handshake/server_75_spec.rb 2018-06-25 07:01:34.000000000 +0000 @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'spec_helper' RSpec.describe 'Server draft 75 handshake' do @@ -7,10 +9,10 @@ let(:client_request) { client_handshake_75(@request_params || {}) } let(:server_response) { server_handshake_75(@request_params || {}) } - it_should_behave_like 'all server drafts' + it_behaves_like 'all server drafts' context 'protocol header specified' do - let(:handshake) { WebSocket::Handshake::Server.new(protocols: %w(binary)) } + let(:handshake) { WebSocket::Handshake::Server.new(protocols: %w[binary]) } context 'supported' do it 'returns with the same protocol' do diff -Nru ruby-websocket-1.2.5/spec/handshake/server_76_spec.rb ruby-websocket-1.2.8/spec/handshake/server_76_spec.rb --- ruby-websocket-1.2.5/spec/handshake/server_76_spec.rb 2018-05-07 14:53:30.000000000 +0000 +++ ruby-websocket-1.2.8/spec/handshake/server_76_spec.rb 2018-06-25 07:01:34.000000000 +0000 @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'spec_helper' RSpec.describe 'Server draft 76 handshake' do @@ -6,7 +8,7 @@ let(:client_request) { client_handshake_76(@request_params || {}) } let(:server_response) { server_handshake_76(@request_params || {}) } - it_should_behave_like 'all server drafts' + it_behaves_like 'all server drafts' it 'disallows request without spaces in key 1' do @request_params = { key1: '4@146546xW%0l15' } @@ -45,7 +47,7 @@ end context 'protocol header specified' do - let(:handshake) { WebSocket::Handshake::Server.new(protocols: %w(binary)) } + let(:handshake) { WebSocket::Handshake::Server.new(protocols: %w[binary]) } context 'supported' do it 'returns with the same protocol' do diff -Nru ruby-websocket-1.2.5/spec/spec_helper.rb ruby-websocket-1.2.8/spec/spec_helper.rb --- ruby-websocket-1.2.5/spec/spec_helper.rb 2018-05-07 14:53:30.000000000 +0000 +++ ruby-websocket-1.2.8/spec/spec_helper.rb 2018-06-25 07:01:34.000000000 +0000 @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'rspec' require 'websocket' diff -Nru ruby-websocket-1.2.5/spec/support/all_client_drafts.rb ruby-websocket-1.2.8/spec/support/all_client_drafts.rb --- ruby-websocket-1.2.5/spec/support/all_client_drafts.rb 2018-05-07 14:53:30.000000000 +0000 +++ ruby-websocket-1.2.8/spec/support/all_client_drafts.rb 2018-06-25 07:01:34.000000000 +0000 @@ -1,3 +1,5 @@ +# frozen_string_literal: true + RSpec.shared_examples_for 'all client drafts' do def validate_request expect(handshake.to_s).to eql(client_request) diff -Nru ruby-websocket-1.2.5/spec/support/all_server_drafts.rb ruby-websocket-1.2.8/spec/support/all_server_drafts.rb --- ruby-websocket-1.2.5/spec/support/all_server_drafts.rb 2018-05-07 14:53:30.000000000 +0000 +++ ruby-websocket-1.2.8/spec/support/all_server_drafts.rb 2018-06-25 07:01:34.000000000 +0000 @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'webrick' RSpec.shared_examples_for 'all server drafts' do diff -Nru ruby-websocket-1.2.5/spec/support/frames_base.rb ruby-websocket-1.2.8/spec/support/frames_base.rb --- ruby-websocket-1.2.5/spec/support/frames_base.rb 2018-05-07 14:53:30.000000000 +0000 +++ ruby-websocket-1.2.8/spec/support/frames_base.rb 2018-06-25 07:01:34.000000000 +0000 @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module WebSocket module Frame class Base diff -Nru ruby-websocket-1.2.5/spec/support/handshake_requests.rb ruby-websocket-1.2.8/spec/support/handshake_requests.rb --- ruby-websocket-1.2.5/spec/support/handshake_requests.rb 2018-05-07 14:53:30.000000000 +0000 +++ ruby-websocket-1.2.8/spec/support/handshake_requests.rb 2018-06-25 07:01:34.000000000 +0000 @@ -1,27 +1,29 @@ +# frozen_string_literal: true + def client_handshake_75(args = {}) - <<-EOF + <<-REQUEST GET #{args[:path] || '/demo'}#{"?#{args[:query]}" if args[:query]} HTTP/1.1\r Upgrade: WebSocket\r Connection: Upgrade\r Host: #{args[:host] || 'example.com'}#{":#{args[:port]}" if args[:port]}\r Origin: http://example.com\r #{(args[:headers] || {}).map { |key, value| "#{key}: #{value}\r\n" }.join('')}\r - EOF + REQUEST end def server_handshake_75(args = {}) - <<-EOF + <<-REQUEST HTTP/1.1 101 Web Socket Protocol Handshake\r Upgrade: WebSocket\r Connection: Upgrade\r #{(args[:headers] || {}).map { |key, value| "#{key}: #{value}\r\n" }.join('')}WebSocket-Origin: http://example.com\r WebSocket-Location: ws#{args[:secure] ? 's' : ''}://#{args[:host] || 'example.com'}#{":#{args[:port]}" if args[:port]}#{args[:path] || '/demo'}\r \r - EOF + REQUEST end def client_handshake_76(args = {}) - request = <<-EOF + request = <<-REQUEST GET #{args[:path] || '/demo'}#{"?#{args[:query]}" if args[:query]} HTTP/1.1\r Upgrade: WebSocket\r Connection: Upgrade\r @@ -31,12 +33,12 @@ Sec-WebSocket-Key2: #{args[:key2] || '12998 5 Y3 1 .P00'}\r \r #{args[:key3] || '^n:ds[4U'} - EOF + REQUEST request[0..-2] end def server_handshake_76(args = {}) - request = <<-EOF + request = <<-REQUEST HTTP/1.1 101 WebSocket Protocol Handshake\r Upgrade: WebSocket\r Connection: Upgrade\r @@ -44,12 +46,12 @@ Sec-WebSocket-Location: ws#{args[:secure] ? 's' : ''}://#{args[:host] || 'example.com'}#{":#{args[:port]}" if args[:port]}#{args[:path] || '/demo'}\r \r #{args[:challenge] || "8jKS'y:G*Co,Wxa-"} - EOF + REQUEST request[0..-2] end def client_handshake_04(args = {}) - <<-EOF + <<-REQUEST GET #{args[:path] || '/demo'}#{"?#{args[:query]}" if args[:query]} HTTP/1.1\r Upgrade: websocket\r Connection: Upgrade\r @@ -58,21 +60,21 @@ Sec-WebSocket-Version: #{args[:version] || '4'}\r Sec-WebSocket-Key: #{args[:key] || 'dGhlIHNhbXBsZSBub25jZQ=='}\r \r - EOF + REQUEST end def server_handshake_04(args = {}) - <<-EOF + <<-REQUEST HTTP/1.1 101 Switching Protocols\r Upgrade: websocket\r Connection: Upgrade\r #{(args[:headers] || {}).map { |key, value| "#{key}: #{value}\r\n" }.join('')}Sec-WebSocket-Accept: #{args[:accept] || 's3pPLMBiTxaQ9kYGzzhZRbK+xOo='}\r \r - EOF + REQUEST end def client_handshake_11(args = {}) - <<-EOF + <<-REQUEST GET #{args[:path] || '/demo'}#{"?#{args[:query]}" if args[:query]} HTTP/1.1\r Upgrade: websocket\r Connection: Upgrade\r @@ -81,7 +83,7 @@ Sec-WebSocket-Version: #{args[:version] || '4'}\r Sec-WebSocket-Key: #{args[:key] || 'dGhlIHNhbXBsZSBub25jZQ=='}\r \r - EOF + REQUEST end def server_handshake_11(args = {}) diff -Nru ruby-websocket-1.2.5/spec/support/incoming_frames.rb ruby-websocket-1.2.8/spec/support/incoming_frames.rb --- ruby-websocket-1.2.5/spec/support/incoming_frames.rb 2018-05-07 14:53:30.000000000 +0000 +++ ruby-websocket-1.2.8/spec/support/incoming_frames.rb 2018-06-25 07:01:34.000000000 +0000 @@ -1,3 +1,5 @@ +# frozen_string_literal: true + RSpec.shared_examples_for 'valid_incoming_frame' do let(:decoded_text_array) { Array(decoded_text) } let(:frame_type_array) { Array(frame_type) } diff -Nru ruby-websocket-1.2.5/spec/support/outgoing_frames.rb ruby-websocket-1.2.8/spec/support/outgoing_frames.rb --- ruby-websocket-1.2.5/spec/support/outgoing_frames.rb 2018-05-07 14:53:30.000000000 +0000 +++ ruby-websocket-1.2.8/spec/support/outgoing_frames.rb 2018-06-25 07:01:34.000000000 +0000 @@ -1,3 +1,5 @@ +# frozen_string_literal: true + RSpec.shared_examples_for 'valid_outgoing_frame' do it 'is outgoing frame' do expect(subject.class).to be WebSocket::Frame::Outgoing diff -Nru ruby-websocket-1.2.5/spec/support/overwrites.rb ruby-websocket-1.2.8/spec/support/overwrites.rb --- ruby-websocket-1.2.5/spec/support/overwrites.rb 2018-05-07 14:53:30.000000000 +0000 +++ ruby-websocket-1.2.8/spec/support/overwrites.rb 2018-06-25 07:01:34.000000000 +0000 @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module WebSocket module Handshake class Base diff -Nru ruby-websocket-1.2.5/.travis.yml ruby-websocket-1.2.8/.travis.yml --- ruby-websocket-1.2.5/.travis.yml 2018-05-07 14:53:30.000000000 +0000 +++ ruby-websocket-1.2.8/.travis.yml 2018-06-25 07:01:34.000000000 +0000 @@ -6,6 +6,7 @@ - 2.2 - 2.3 - 2.4 + - 2.5 - ruby-head - jruby-9.1.9.0 # https://github.com/travis-ci/travis-ci/issues/8446 - jruby-head @@ -16,6 +17,3 @@ - rvm: ruby-head - rvm: jruby-head - rvm: rbx-3 - -before_install: - - gem update bundler diff -Nru ruby-websocket-1.2.5/websocket.gemspec ruby-websocket-1.2.8/websocket.gemspec --- ruby-websocket-1.2.5/websocket.gemspec 2018-05-07 14:53:30.000000000 +0000 +++ ruby-websocket-1.2.8/websocket.gemspec 2018-06-25 07:01:34.000000000 +0000 @@ -1,4 +1,4 @@ -# -*- encoding: utf-8 -*- +# frozen_string_literal: true $LOAD_PATH.push File.expand_path('../lib', __FILE__) require 'websocket/version'