websocket-driver 0.3.0 → 0.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/CHANGELOG.md +4 -0
- data/README.md +2 -0
- data/lib/websocket/driver/hybi.rb +12 -5
- metadata +4 -3
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
@@ -212,6 +212,8 @@ enabled on outgoing frames.
|
|
212
212
|
The `options` argument is optional, and is a hash. It may contain the following
|
213
213
|
keys:
|
214
214
|
|
215
|
+
* `:max_length` - the maximum allowed size of incoming message frames, in bytes.
|
216
|
+
The default value is `2^30 - 1`, or 1 byte short of 1GiB.
|
215
217
|
* `:protocols` - an array of strings representing acceptable subprotocols for
|
216
218
|
use over the socket. The driver will negotiate one of these to use via the
|
217
219
|
`Sec-WebSocket-Protocol` header if supported by the other peer.
|
@@ -32,6 +32,8 @@ module WebSocket
|
|
32
32
|
FRAGMENTED_OPCODES = OPCODES.values_at(:continuation, :text, :binary)
|
33
33
|
OPENING_OPCODES = OPCODES.values_at(:text, :binary)
|
34
34
|
|
35
|
+
MAX_LENGTH = 0x3fffffff
|
36
|
+
|
35
37
|
ERRORS = {
|
36
38
|
:normal_closure => 1000,
|
37
39
|
:going_away => 1001,
|
@@ -52,11 +54,12 @@ module WebSocket
|
|
52
54
|
super
|
53
55
|
reset
|
54
56
|
|
55
|
-
@reader
|
56
|
-
@stage
|
57
|
-
@masking
|
58
|
-
@protocols
|
59
|
-
@protocols
|
57
|
+
@reader = StreamReader.new
|
58
|
+
@stage = 0
|
59
|
+
@masking = options[:masking]
|
60
|
+
@protocols = options[:protocols] || []
|
61
|
+
@protocols = @protocols.strip.split(/\s*,\s*/) if String === @protocols
|
62
|
+
@max_length = options[:max_length] || MAX_LENGTH
|
60
63
|
|
61
64
|
@require_masking = options[:require_masking]
|
62
65
|
@ping_callbacks = {}
|
@@ -280,6 +283,10 @@ module WebSocket
|
|
280
283
|
return fail(:protocol_error, "Received control frame having too long payload: #{@length}")
|
281
284
|
end
|
282
285
|
|
286
|
+
if @length > @max_length
|
287
|
+
return fail(:too_large, 'WebSocket frame length too large')
|
288
|
+
end
|
289
|
+
|
283
290
|
@stage = @masked ? 3 : 4
|
284
291
|
end
|
285
292
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: websocket-driver
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.1
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-
|
12
|
+
date: 2013-12-03 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: eventmachine
|
@@ -88,7 +88,8 @@ files:
|
|
88
88
|
- lib/websocket/driver/event_emitter.rb
|
89
89
|
- lib/websocket/driver/draft76.rb
|
90
90
|
homepage: http://github.com/faye/websocket-driver-ruby
|
91
|
-
licenses:
|
91
|
+
licenses:
|
92
|
+
- MIT
|
92
93
|
post_install_message:
|
93
94
|
rdoc_options:
|
94
95
|
- --main
|