permessage_deflate 0.1.1 → 0.1.2
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.
- checksums.yaml +4 -4
- data/CHANGELOG.md +5 -0
- data/README.md +9 -10
- data/lib/permessage_deflate/client_session.rb +3 -3
- data/lib/permessage_deflate/server_session.rb +29 -23
- data/lib/permessage_deflate/session.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a14c8dd2a4f9ba707ef04843ddf38f63edab8a96
|
4
|
+
data.tar.gz: a5ae9bc81616693639e4c3bc119c9e0f56fba26e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3a652f56d83877215d70642b93fa2d06903e5dbdf1696cc73a397ffa6614864a71d82ec5b4d0f5cdb5854930e166dfe0f24da605137b1e70acac10fd533fcc32
|
7
|
+
data.tar.gz: 3c7d27e351764c4f6c19ced876ba6a8664b638ac0aef40ce8290a03412d628164723b49b277582887eb9aa0aeca6fdfa7fb4e11c73730c194ac6a576c5d0d407
|
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
@@ -70,22 +70,21 @@ can be used to set the local session's behaviour and control that of the peer:
|
|
70
70
|
|
71
71
|
(The MIT License)
|
72
72
|
|
73
|
-
Copyright (c) 2014 James Coglan
|
73
|
+
Copyright (c) 2014-2015 James Coglan
|
74
74
|
|
75
75
|
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
76
76
|
this software and associated documentation files (the 'Software'), to deal in
|
77
77
|
the Software without restriction, including without limitation the rights to
|
78
|
-
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
|
79
|
-
|
80
|
-
|
78
|
+
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
79
|
+
the Software, and to permit persons to whom the Software is furnished to do so,
|
80
|
+
subject to the following conditions:
|
81
81
|
|
82
82
|
The above copyright notice and this permission notice shall be included in all
|
83
83
|
copies or substantial portions of the Software.
|
84
84
|
|
85
85
|
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
86
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
SOFTWARE.
|
86
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
87
|
+
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
88
|
+
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
89
|
+
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
90
|
+
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
@@ -59,12 +59,12 @@ class PermessageDeflate
|
|
59
59
|
|
60
60
|
@own_context_takeover = !(@accept_no_context_takeover || params['client_no_context_takeover'])
|
61
61
|
@own_window_bits = [
|
62
|
-
@accept_max_window_bits ||
|
63
|
-
params['client_max_window_bits'] ||
|
62
|
+
@accept_max_window_bits || MAX_WINDOW_BITS,
|
63
|
+
params['client_max_window_bits'] || MAX_WINDOW_BITS
|
64
64
|
].min
|
65
65
|
|
66
66
|
@peer_context_takeover = !params['server_no_context_takeover']
|
67
|
-
@peer_window_bits = params['server_max_window_bits'] ||
|
67
|
+
@peer_window_bits = params['server_max_window_bits'] || MAX_WINDOW_BITS
|
68
68
|
|
69
69
|
true
|
70
70
|
end
|
@@ -17,42 +17,48 @@ class PermessageDeflate
|
|
17
17
|
end
|
18
18
|
|
19
19
|
def generate_response
|
20
|
-
|
20
|
+
response = {}
|
21
21
|
|
22
22
|
# https://tools.ietf.org/html/draft-ietf-hybi-permessage-compression#section-8.1.1.1
|
23
|
-
|
24
|
-
|
25
|
-
|
23
|
+
|
24
|
+
@own_context_takeover = !@accept_no_context_takeover &&
|
25
|
+
!@params['server_no_context_takeover']
|
26
|
+
|
27
|
+
response['server_no_context_takeover'] = true unless @own_context_takeover
|
26
28
|
|
27
29
|
# https://tools.ietf.org/html/draft-ietf-hybi-permessage-compression#section-8.1.1.2
|
28
|
-
|
29
|
-
|
30
|
-
|
30
|
+
|
31
|
+
@peer_context_takeover = !@request_no_context_takeover &&
|
32
|
+
!@params['client_no_context_takeover']
|
33
|
+
|
34
|
+
response['client_no_context_takeover'] = true unless @peer_context_takeover
|
31
35
|
|
32
36
|
# https://tools.ietf.org/html/draft-ietf-hybi-permessage-compression#section-8.1.2.1
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
+
|
38
|
+
@own_window_bits = [ @accept_max_window_bits || MAX_WINDOW_BITS,
|
39
|
+
@params['server_max_window_bits'] || MAX_WINDOW_BITS
|
40
|
+
].min
|
41
|
+
|
42
|
+
# In violation of the spec, Firefox closes the connection if it does not
|
43
|
+
# send server_max_window_bits but the server includes this in its response
|
44
|
+
if @own_window_bits < MAX_WINDOW_BITS and @params['server_max_window_bits']
|
45
|
+
response['server_max_window_bits'] = @own_window_bits
|
37
46
|
end
|
38
47
|
|
39
48
|
# https://tools.ietf.org/html/draft-ietf-hybi-permessage-compression#section-8.1.2.2
|
49
|
+
|
40
50
|
if client_max = @params['client_max_window_bits']
|
41
|
-
if client_max == true
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
params['client_max_window_bits'] = [request_max, client_max].min
|
46
|
-
end
|
51
|
+
client_max = MAX_WINDOW_BITS if client_max == true
|
52
|
+
@peer_window_bits = [@request_max_window_bits || MAX_WINDOW_BITS, client_max].min
|
53
|
+
else
|
54
|
+
@peer_window_bits = MAX_WINDOW_BITS
|
47
55
|
end
|
48
56
|
|
49
|
-
@
|
50
|
-
|
51
|
-
|
52
|
-
@peer_context_takeover = !params['client_no_context_takeover']
|
53
|
-
@peer_window_bits = params['client_max_window_bits'] || DEFAULT_MAX_WINDOW_BITS
|
57
|
+
if @peer_window_bits < MAX_WINDOW_BITS
|
58
|
+
response['client_max_window_bits'] = @peer_window_bits
|
59
|
+
end
|
54
60
|
|
55
|
-
|
61
|
+
response
|
56
62
|
end
|
57
63
|
|
58
64
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: permessage_deflate
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- James Coglan
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2015-11-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rspec
|
@@ -61,7 +61,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
61
61
|
version: '0'
|
62
62
|
requirements: []
|
63
63
|
rubyforge_project:
|
64
|
-
rubygems_version: 2.
|
64
|
+
rubygems_version: 2.4.5.1
|
65
65
|
signing_key:
|
66
66
|
specification_version: 4
|
67
67
|
summary: Per-message DEFLATE compression extension for WebSocket connections
|