permessage_deflate 0.1.3 → 0.1.4

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 152e4441be7d3c79b3e8169d4268b2d7f5abdb09
4
- data.tar.gz: af5b39863453e9a56cbc33cd1cb96a4e0956bf9b
3
+ metadata.gz: 0b7269ee5c2053e590df3ee23dee682643a94141
4
+ data.tar.gz: ce977b261ba5a4496a18a295ba786e522ff7c54d
5
5
  SHA512:
6
- metadata.gz: 3a80afa2e48ab51d6f2d80f2132f4c52ff3c9c80dcf3a17b4911970266f728919b068e0df991b060af8aa5e4a940df65749908b0a13c7ece32f3b7503d79929e
7
- data.tar.gz: 989ee3dfa1d4c62618cd816be874a69e4f7508dd5e8d23c4e64cfa67b6e312fcc0a4c99ed523825b82c623b486bea216672a79d169b2d4e2959a020e846a5981
6
+ metadata.gz: 5c5e3671daa908ef039e1d0ebc7adc7f216072b38f04f2f6668cd1b74acc5c81946233053002cbff5af045fc8454ab087a2bdc03d90e4dab9cf94bf5f57e1617
7
+ data.tar.gz: d4b4e6f843ed4eef06eb7c5b16a1c322689c9f61bd662fc581c1101824011113674c3c6248f89e9ec798bb6895cd64a401eb0408ada92c634d81903dfe5e1424
@@ -1,3 +1,8 @@
1
+ ### 0.1.4 / 2017-09-10
2
+
3
+ * Use `9` instead of `8` as the `windowBits` parameter to zlib, to deal with
4
+ restrictions introduced in zlib v1.2.9
5
+
1
6
  ### 0.1.3 / 2016-05-20
2
7
 
3
8
  * Amend all warnings issued when running with -W2
@@ -0,0 +1,21 @@
1
+ # The MIT License
2
+
3
+ Copyright (c) 2014-2017 James Coglan
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy of
6
+ this software and associated documentation files (the 'Software'), to deal in
7
+ the Software without restriction, including without limitation the rights to
8
+ use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
9
+ the Software, and to permit persons to whom the Software is furnished to do so,
10
+ subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
17
+ FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
18
+ COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
19
+ IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
20
+ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
21
+
data/README.md CHANGED
@@ -11,7 +11,7 @@ WebSocket protocol extension as a plugin for
11
11
  $ gem install permessage_deflate
12
12
  ```
13
13
 
14
- ## Usage
14
+ ## Usage
15
15
 
16
16
  Add the plugin to your extensions:
17
17
 
@@ -65,26 +65,3 @@ can be used to set the local session's behaviour and control that of the peer:
65
65
  if requested by the peer
66
66
  * `:request_max_window_bits`: an integer from `8` to `15` inclusive to ask the
67
67
  other peer to use to set its maximum sliding window size, if supported
68
-
69
- ## License
70
-
71
- (The MIT License)
72
-
73
- Copyright (c) 2014-2016 James Coglan
74
-
75
- Permission is hereby granted, free of charge, to any person obtaining a copy of
76
- this software and associated documentation files (the 'Software'), to deal in
77
- the Software without restriction, including without limitation the rights to
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
-
82
- The above copyright notice and this permission notice shall be included in all
83
- copies or substantial portions of the Software.
84
-
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, 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.
@@ -19,21 +19,21 @@ class PermessageDeflate
19
19
  def generate_response
20
20
  response = {}
21
21
 
22
- # https://tools.ietf.org/html/draft-ietf-hybi-permessage-compression#section-8.1.1.1
22
+ # https://tools.ietf.org/html/rfc7692#section-7.1.1.1
23
23
 
24
24
  @own_context_takeover = !@accept_no_context_takeover &&
25
25
  !@params['server_no_context_takeover']
26
26
 
27
27
  response['server_no_context_takeover'] = true unless @own_context_takeover
28
28
 
29
- # https://tools.ietf.org/html/draft-ietf-hybi-permessage-compression#section-8.1.1.2
29
+ # https://tools.ietf.org/html/rfc7692#section-7.1.1.2
30
30
 
31
31
  @peer_context_takeover = !@request_no_context_takeover &&
32
32
  !@params['client_no_context_takeover']
33
33
 
34
34
  response['client_no_context_takeover'] = true unless @peer_context_takeover
35
35
 
36
- # https://tools.ietf.org/html/draft-ietf-hybi-permessage-compression#section-8.1.2.1
36
+ # https://tools.ietf.org/html/rfc7692#section-7.1.2.1
37
37
 
38
38
  @own_window_bits = [ @accept_max_window_bits || MAX_WINDOW_BITS,
39
39
  @params['server_max_window_bits'] || MAX_WINDOW_BITS
@@ -45,7 +45,7 @@ class PermessageDeflate
45
45
  response['server_max_window_bits'] = @own_window_bits
46
46
  end
47
47
 
48
- # https://tools.ietf.org/html/draft-ietf-hybi-permessage-compression#section-8.1.2.2
48
+ # https://tools.ietf.org/html/rfc7692#section-7.1.2.2
49
49
 
50
50
  if client_max = @params['client_max_window_bits']
51
51
  client_max = MAX_WINDOW_BITS if client_max == true
@@ -8,6 +8,7 @@ class PermessageDeflate
8
8
  'client_max_window_bits'
9
9
  ]
10
10
 
11
+ MIN_WINDOW_BITS = 9
11
12
  MAX_WINDOW_BITS = 15
12
13
  VALID_WINDOW_BITS = [8, 9, 10, 11, 12, 13, 14, 15]
13
14
 
@@ -83,14 +84,20 @@ class PermessageDeflate
83
84
 
84
85
  def get_inflate
85
86
  return @inflate if @inflate
86
- inflate = Zlib::Inflate.new(-@peer_window_bits)
87
+
88
+ window_bits = [@peer_window_bits, MIN_WINDOW_BITS].max
89
+ inflate = Zlib::Inflate.new(-window_bits)
90
+
87
91
  @inflate = inflate if @peer_context_takeover
88
92
  inflate
89
93
  end
90
94
 
91
95
  def get_deflate
92
96
  return @deflate if @deflate
93
- deflate = Zlib::Deflate.new(@level, -@own_window_bits, @mem_level, @strategy)
97
+
98
+ window_bits = [@own_window_bits, MIN_WINDOW_BITS].max
99
+ deflate = Zlib::Deflate.new(@level, -window_bits, @mem_level, @strategy)
100
+
94
101
  @deflate = deflate if @own_context_takeover
95
102
  deflate
96
103
  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.3
4
+ version: 0.1.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - James Coglan
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-05-20 00:00:00.000000000 Z
11
+ date: 2017-09-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rspec
@@ -32,6 +32,7 @@ extra_rdoc_files:
32
32
  - README.md
33
33
  files:
34
34
  - CHANGELOG.md
35
+ - LICENSE.md
35
36
  - README.md
36
37
  - lib/permessage_deflate.rb
37
38
  - lib/permessage_deflate/client_session.rb
@@ -61,7 +62,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
61
62
  version: '0'
62
63
  requirements: []
63
64
  rubyforge_project:
64
- rubygems_version: 2.5.1
65
+ rubygems_version: 2.6.11
65
66
  signing_key:
66
67
  specification_version: 4
67
68
  summary: Per-message DEFLATE compression extension for WebSocket connections