rack-session-smart_cookie 0.1.1 → 0.1.2

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: ccfe1e78018ea5fe84485f07aa4f7e192a84f6f4
4
- data.tar.gz: 7452755223ebb2ac46fdcb39c407c31c5fffc7b4
3
+ metadata.gz: e682138e9aecc0f8acefb54f729c959536974345
4
+ data.tar.gz: 681900b1c6f1305a3e9bea1a8373de8715916ed6
5
5
  SHA512:
6
- metadata.gz: 3cef56db48bce136ae73a44b98bfbf8ff25458d6436c6d7783e6c511194f86903620023786b2d097805514af8cf20129368613f8b924243d881475ff9e33238d
7
- data.tar.gz: 8734ea8cc650b99ccac644a5e0f70f9f021709517923834618b33b9b6b1756ba2e6f0cb330ffbb57c0dc836e1a216a1f64269fe26ad812aeb32d9b028cc086a9
6
+ metadata.gz: 881d18f4b0f1dfd52990d6e850c6c7661ca2901632e4082b8ce71f75b8afe791f01847f8ed3d7697532bd40c4a60892c9d66dbc64d42ed70124e7f6d48f579fa
7
+ data.tar.gz: 4a581360b1a4ba190134cd6dc9211fe11c030cfd582789645702bffb54e4b4b78276082642da1a5c3cce8216ac75c26a761b2eae8bb4b0f017abbcea24777278
data/Gemfile CHANGED
@@ -4,4 +4,4 @@ git_source(:github) { |repo_name| "https://github.com/#{repo_name}" }
4
4
 
5
5
  gemspec
6
6
 
7
- #gem 'openssl', '>= 2.0.3'
7
+ gem 'openssl', '>= 2.0.3'
data/README.md CHANGED
@@ -43,10 +43,10 @@ serialized and stringified (in the case of the session payload) or merely
43
43
  stringified (in the case of the digest).
44
44
 
45
45
  The other key realization is that the method Rack uses to escape cookie data
46
- ([URI.encode_www_form_component][5]) will only ever allow URL-safe Base64 plus
47
- period (`.`) and asterisk (`*`), so there's no sense in using any
48
- stringification scheme other than URL-safe Base64! It doesn't need to be
49
- configurable. The serializer remains configurable as the `:coder`.
46
+ ([URI.encode_www_form_component][5]) will only ever allow non-padded, URL-safe
47
+ Base64 plus period (`.`) and asterisk (`*`), so there's no sense in using any
48
+ stringification scheme other than non-padded, URL-safe Base64! It doesn't need
49
+ to be configurable. The serializer remains configurable as the `:coder`.
50
50
 
51
51
  The remaining differences are mostly just better defaults: MessagePack and
52
52
  SHA2.
@@ -77,19 +77,23 @@ $ gem install rack-session-smart_cookie
77
77
  use Rack::Session::SmartCookie
78
78
  ```
79
79
 
80
- Rack::Session::SmartCookie accepts the same options as
81
- [Rack::Session::Cookie][6]. If you choose to override the default `:coder`, it
82
- should *not* perform the Base64 steps.
80
+ Rack::Session::SmartCookie is a sub-class of [Rack::Session::Cookie][6] and
81
+ accepts all the same options. If you choose to override the default `:coder`,
82
+ it should *not* perform Base64 encoding or decoding.
83
83
 
84
- You can easily register additional custom types on the default coder's factory:
84
+ The default `:coder` registers Symbol as a custom type on the factory. You can
85
+ easily register additional custom types like so:
85
86
 
86
87
  ```ruby
87
- my_coder = Rack::Session::SmartCookie::MessagePack.new
88
- my_coder.factory.register_type(0x00, MyCustomType) # 0x60..0xFF are reserved
88
+ my_coder = Rack::Session::SmartCookie::MessagePack.new do |factory|
89
+ factory.register_type(0x00, MyCustomType) # 0x60..0xFF are reserved
90
+ end
89
91
 
90
92
  use Rack::Session::SmartCookie, :coder=>my_coder
91
93
  ```
92
94
 
95
+ Please see the [MessagePack][3] documentation for more details.
96
+
93
97
  ## Comparisons
94
98
 
95
99
  For general size and performance benchmarks of the encoding schemes, see
@@ -55,10 +55,12 @@ module Rack
55
55
  # Create our own factory so we don't pollute the global namespace
56
56
  # with our custom type.
57
57
  @factory = ::MessagePack::Factory.new
58
- # user gets 0x00...0x60
58
+
59
+ # MessagePack gets custom types 0x80..0xFF
59
60
  # we get 0x60...0x80
60
- # MessagePack gets 0x80..0xFF
61
61
  @factory.register_type(0x60, Symbol)
62
+ # user gets 0x00...0x60
63
+ yield @factory if block_given?
62
64
  end
63
65
 
64
66
  def encode(data)
@@ -10,7 +10,7 @@ module Rack
10
10
  Cookie = Class.new unless defined?(Cookie)
11
11
 
12
12
  class SmartCookie < Cookie
13
- VERSION = '0.1.1'.freeze
13
+ VERSION = '0.1.2'.freeze
14
14
  end
15
15
  end
16
16
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rack-session-smart_cookie
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mike Pastore