websocket-driver 0.5.0 → 0.5.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (4) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +4 -0
  3. data/lib/websocket/driver.rb +15 -5
  4. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: e371cab2dac96506c460bb5aab3a22c8bfabc0e9
4
- data.tar.gz: b85a67f43bf82c133f3daff8af5de42f75d02582
3
+ metadata.gz: 0b046fb6e3d1a05a5d1af3e0e1c328d1b647e01a
4
+ data.tar.gz: 901e817816e37309039527b775ba7c99a67efd54
5
5
  SHA512:
6
- metadata.gz: 87183ecb591a96cd5ba849a2718f224b473542db6fa0f6b4bad21469612996464621eee65b6038ecf044bd9d68bbb4a137a865dafbd69f11df05c55cf52ea546
7
- data.tar.gz: 0e12e2b733e5e6189b8c5520328eaa310aaf79d2f57a69bafb9ab74089cfbd64a6e04eda3667a0d545bb982afc5eaf7a8f76e2ad88bc87dc31e44c9c93605e0c
6
+ metadata.gz: 419cc80493b66e1ebfc1abd0e05f9a4ae8c49327bf2d0dd554ababcf95e2d846b32a968d2245e5670d5202a0e4a644abb7bdc491f27fbf5980f33e91cdc208b5
7
+ data.tar.gz: 990a461eadf0cfe36c263019012c506d565874d5005ff6b5d5a6104b01dc11c573f4855b9ded57a110ff9e6276ad8ecf5360ed3b1a1ec0a3dafbe3d543ca0b15
data/CHANGELOG.md CHANGED
@@ -1,3 +1,7 @@
1
+ ### 0.5.1 / 2014-12-18
2
+
3
+ * Don't allow drivers to be created with unrecognized options
4
+
1
5
  ### 0.5.0 / 2014-12-13
2
6
 
3
7
  * Support protocol extensions via the websocket-extensions module
@@ -40,12 +40,13 @@ module WebSocket
40
40
  MAX_LENGTH = 0x3ffffff
41
41
  STATES = [:connecting, :open, :closing, :closed]
42
42
 
43
- class ConnectEvent < Struct.new(nil) ; end
44
- class OpenEvent < Struct.new(nil) ; end
45
- class MessageEvent < Struct.new(:data) ; end
46
- class CloseEvent < Struct.new(:code, :reason) ; end
43
+ ConnectEvent = Struct.new(nil)
44
+ OpenEvent = Struct.new(nil)
45
+ MessageEvent = Struct.new(:data)
46
+ CloseEvent = Struct.new(:code, :reason)
47
47
 
48
- class ProtocolError < StandardError ; end
48
+ ProtocolError = Class.new(StandardError)
49
+ ConfigurationError = Class.new(ArgumentError)
49
50
 
50
51
  autoload :Client, root + '/client'
51
52
  autoload :Draft75, root + '/draft75'
@@ -61,6 +62,7 @@ module WebSocket
61
62
 
62
63
  def initialize(socket, options = {})
63
64
  super()
65
+ Driver.validate_options(options, [:max_length, :masking, :require_masking, :protocols])
64
66
 
65
67
  @socket = socket
66
68
  @options = options
@@ -158,6 +160,14 @@ module WebSocket
158
160
  string
159
161
  end
160
162
 
163
+ def self.validate_options(options, valid_keys)
164
+ options.keys.each do |key|
165
+ unless valid_keys.include?(key)
166
+ raise ConfigurationError, "Unrecognized option: #{key.inspect}"
167
+ end
168
+ end
169
+ end
170
+
161
171
  def self.valid_utf8?(string)
162
172
  if defined?(UTF8_MATCH)
163
173
  UTF8_MATCH =~ string ? true : false
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: websocket-driver
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.0
4
+ version: 0.5.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - James Coglan
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-12-13 00:00:00.000000000 Z
11
+ date: 2014-12-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: websocket-extensions