permessage_deflate 0.1.0 → 0.1.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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 5a45dd8e4933a9a41365043f0b770ad2f9df343c
4
- data.tar.gz: 59b4bbba3b0fc00a970604c1a307bf8b80fc034a
3
+ metadata.gz: 1df768e3e9548d14e1de4aa42cb436ba26ed8dcd
4
+ data.tar.gz: 5200b1ad6bd6b0c52f437ca19078897e5f172221
5
5
  SHA512:
6
- metadata.gz: b1c220ecbfe1f83d19c6a59d6045478bc827cb36f72e1f97ad914dc04002f188239bba1adde415f65cb85911a7c423e545e12d6ff1230d57e7bc62626c871af0
7
- data.tar.gz: ae327691407e387275f0f0e8a5ce54817108a9f4b4dc2fbd9245f23514873ac3585e380ccfe04b38f3a64a5c93d9d8b6a828f87e06550b759cf2ba8f2a29e8f5
6
+ metadata.gz: 507ca2039b829e07107eca9ccf5bfaa6c751f69bbcb7a3a26b433b90ec6e37f6af7ff75c043ac7e79b129abc23df55117cd1248fc02468be49363528ce634081
7
+ data.tar.gz: fa119c3394b0e2297e10f373a1f6afee3c47c391e07b7c7881e5662a628d87c57baeb9e7ca5f5bd631d000e1962b829a428871f408fed2dbb12269031a86969f
data/CHANGELOG.md ADDED
@@ -0,0 +1,7 @@
1
+ ### 0.1.1 / 2014-12-18
2
+
3
+ * Don't allow configure() to be called with unrecognized options
4
+
5
+ ### 0.1.0 / 2014-12-13
6
+
7
+ * Initial release
data/README.md CHANGED
@@ -40,12 +40,12 @@ exts.add(deflate)
40
40
 
41
41
  The set of available options can be split into two sets: those that control the
42
42
  session's compressor for outgoing messages and do not need to be communicated to
43
- the peer, and those that are negoatiated as part of the protocol. The settings
43
+ the peer, and those that are negotiated as part of the protocol. The settings
44
44
  only affecting the compressor are described fully in the [Zlib
45
45
  documentation](http://ruby-doc.org/stdlib-2.1.0/libdoc/zlib/rdoc/Zlib/Deflate.html#method-c-new):
46
46
 
47
47
  * `:level`: sets the compression level, can be an integer from `0` to `9`, or
48
- one of the contants `Zlib::NO_COMPRESSION`, `Zlib::BEST_SPEED`,
48
+ one of the constants `Zlib::NO_COMPRESSION`, `Zlib::BEST_SPEED`,
49
49
  `Zlib::BEST_COMPRESSION`, or `Zlib::DEFAULT_COMPRESSION`
50
50
  * `:mem_level`: sets how much memory the compressor allocates, can be an integer
51
51
  from `1` to `9`, or one of the constants `Zlib::MAX_MEM_LEVEL`, or
@@ -8,6 +8,24 @@ class PermessageDeflate
8
8
 
9
9
  ConfigurationError = Class.new(ArgumentError)
10
10
 
11
+ VALID_OPTIONS = [
12
+ :level,
13
+ :mem_level,
14
+ :strategy,
15
+ :no_context_takeover,
16
+ :max_window_bits,
17
+ :request_no_context_takeover,
18
+ :request_max_window_bits
19
+ ]
20
+
21
+ def self.validate_options(options, valid_keys)
22
+ options.keys.each do |key|
23
+ unless valid_keys.include?(key)
24
+ raise ConfigurationError, "Unrecognized option: #{key.inspect}"
25
+ end
26
+ end
27
+ end
28
+
11
29
  module Extension
12
30
  define_method(:name) { 'permessage-deflate' }
13
31
  define_method(:type) { 'permessage' }
@@ -16,6 +34,7 @@ class PermessageDeflate
16
34
  define_method(:rsv3) { false }
17
35
 
18
36
  def configure(options)
37
+ PermessageDeflate.validate_options(options, VALID_OPTIONS)
19
38
  options = (@options || {}).merge(options)
20
39
  PermessageDeflate.new(options)
21
40
  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.0
4
+ version: 0.1.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: rspec
@@ -31,6 +31,7 @@ extensions: []
31
31
  extra_rdoc_files:
32
32
  - README.md
33
33
  files:
34
+ - CHANGELOG.md
34
35
  - README.md
35
36
  - lib/permessage_deflate.rb
36
37
  - lib/permessage_deflate/client_session.rb