websocket-driver 0.5.0-java → 0.5.1-java

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: bc15766e2fa0e536038e29fadff1132446bce140
4
- data.tar.gz: ad665aaf5f8088712fd10524cb99ab8911013215
3
+ metadata.gz: 9309a5e07cfe961676a86f4a69ea5d1259e108f1
4
+ data.tar.gz: 74ad3723262d26e0d97d7cf457b0ea103fe3849d
5
5
  SHA512:
6
- metadata.gz: f11999301bb7c87b560543d2668841fe03ddcfd2545f49009096c707a5d266ffedbc3430450579a36218b4d09c8925923cf27607d45a215d2cfb71832473bb96
7
- data.tar.gz: 9c79cd87ff2541ee12d0b953f9993dae2db27460a39bb197a4115f68f727479794ecd943d5ab7fb57293d2fac7ddf59ceda291355e42b5fdb80be8ec93f48a54
6
+ metadata.gz: cee6af332c646c9576a01e977c71a9c3da7907c542797c24f8c306fedad6cc442407cfcd9363cc4464408b98c129d45912ad40327045a503cb00c94aa2f6099b
7
+ data.tar.gz: 7150f3ddcbbe15aa39202ae2553f029bebae510c852ca35a63b4f9811d8570c2b781e607b8a31b4271c4015d4cce5d7b63fba0e331abbaef01a4f1e938b77c5d
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
Binary file
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: java
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