reel 0.6.0 → 0.6.1

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of reel might be problematic. Click here for more details.

checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 5ce24f419ce91dd55a85503c2540abea3c2c79d9
4
- data.tar.gz: 8a5adfc3c0a04db334dbacdc70f4748bab8c5b41
3
+ metadata.gz: 27ae07b4f60f202562fa1ec10b4830370348b1eb
4
+ data.tar.gz: d98ee1efa426485d3c2846b93f28efd102ffa26c
5
5
  SHA512:
6
- metadata.gz: e46d0cb9591419a96bdc072256f6329d5b75272f753137ac90984a06afa89cf52bb8a2f08b92adbc0314f7fef2933f75b524cec26c04ee6018e59d0401c9a9a7
7
- data.tar.gz: 40ff868aee4a82390395cf210970ae4e6603e84772bab12c56890fbbee979d6086ef13a6037ed71e7e5be2ab5b23ba8ecf87c721837a51abd1c01c6c3ecee98f
6
+ metadata.gz: e09edac0eb23863984a25d88c4c27a23ecedbf0334cd0cd1f5eb73a5fda21c86a9f4229548f69c2fe8ab8772b8974efcad7abd8393b67fb05424b9608558ade0
7
+ data.tar.gz: c917765676238a5191def17263161ca0b481506e6017193671f588dda4c901dd7759e83771ed455db600e1561416db3e5db825a0aed327e464f854c64981eef3
data/CHANGES.md CHANGED
@@ -1,47 +1,53 @@
1
- ## 0.6.0 (2016-02-13)
1
+ ## 0.6.1 (2016-03-14)
2
2
 
3
- * [#148](https://github.com/celluloid/reel/pull/148):
4
- Fix stack level too deep when writing to ChunkStream.
5
- (**@bastjan**)
6
-
7
- * [#151](https://github.com/celluloid/reel/pull/151):
8
- Support for new http.rb gem API.
9
- (**@ixti**)
10
-
11
- * [#152](https://github.com/celluloid/reel/pull/152):
12
- Case insensitivity for header field names.
3
+ * [#221](https://github.com/celluloid/reel/pull/221)
4
+ Remove rack dependency. Add WebSocket ping forward.
13
5
  (**@kenichi**)
14
6
 
15
- * [#155](https://github.com/celluloid/reel/pull/155):
16
- Handle Errno::ECONNRESET in SSL server.
17
- (**@czaks**)
7
+ ## 0.6.0 "Garland" (2016-02-13)
18
8
 
19
- * [#162](https://github.com/celluloid/reel/pull/162):
20
- Fix for #150: Reel::StateError: already processing
21
- a request when client is killed.
22
- (**@artcom**)
9
+ * [#214](https://github.com/celluloid/reel/pull/214):
10
+ Fix ChunkStream termination.
11
+ (**@ogoid**)
23
12
 
24
- * [#166](https://github.com/celluloid/reel/pull/166):
25
- Switch to websocket-driver gem.
13
+ * [#182](https://github.com/celluloid/reel/pull/182):
14
+ Do not allow transitioning out of closed.
15
+ (**@zanker**)
16
+
17
+ * [#168](https://github.com/celluloid/reel/pull/168):
18
+ Revert removal of addr and peeraddr delegates.
26
19
  (**@d-snp**)
27
20
 
28
21
  * [#167](https://github.com/celluloid/reel/pull/167):
29
22
  Delegate #addr, #peeraddr, etc. methods in Spy.
30
23
  (**@d-snp**)
31
24
 
32
- * [#168](https://github.com/celluloid/reel/pull/168):
33
- Revert removal of addr and peeraddr delegates.
25
+ * [#166](https://github.com/celluloid/reel/pull/166):
26
+ Switch to websocket-driver gem.
34
27
  (**@d-snp**)
35
28
 
36
- * [#182](https://github.com/celluloid/reel/pull/182):
37
- Do not allow transitioning out of closed.
38
- (**@zanker**)
29
+ * [#162](https://github.com/celluloid/reel/pull/162):
30
+ Fix for #150: Reel::StateError: already processing
31
+ a request when client is killed.
32
+ (**@artcom**)
39
33
 
40
- * [#214](https://github.com/celluloid/reel/pull/214):
41
- Fix ChunkStream termination.
42
- (**@ogoid**)
34
+ * [#155](https://github.com/celluloid/reel/pull/155):
35
+ Handle Errno::ECONNRESET in SSL server.
36
+ (**@czaks**)
37
+
38
+ * [#152](https://github.com/celluloid/reel/pull/152):
39
+ Case insensitivity for header field names.
40
+ (**@kenichi**)
41
+
42
+ * [#151](https://github.com/celluloid/reel/pull/151):
43
+ Support for new http.rb gem API.
44
+ (**@ixti**)
45
+
46
+ * [#148](https://github.com/celluloid/reel/pull/148):
47
+ Fix stack level too deep when writing to ChunkStream.
48
+ (**@bastjan**)
43
49
 
44
- ## 0.5.0 (2014-04-15)
50
+ ## 0.5.0 "Bette" (2014-04-15)
45
51
 
46
52
  * Reel::Server(::SSL) renamed to Reel::Server::HTTP and Reel::Server::HTTPS
47
53
  * New Reel::Spy API for observing requests and responses from the server
@@ -51,7 +57,7 @@
51
57
  * Ensure response bodies are always closed
52
58
  * Support for passing a fixnum status to Connection#respond
53
59
 
54
- ## 0.4.0
60
+ ## 0.4.0 "Garbo"
55
61
 
56
62
  * Rack adapter moved to the reel-rack project
57
63
  * Pipelining support
@@ -1,4 +1,4 @@
1
1
  module Reel
2
- VERSION = "0.6.0"
2
+ VERSION = "0.6.1"
3
3
  CODENAME = "Garland"
4
4
  end
@@ -1,6 +1,5 @@
1
1
  require 'forwardable'
2
2
  require 'websocket/driver'
3
- require 'rack'
4
3
 
5
4
  module Reel
6
5
  class WebSocket
@@ -10,10 +9,11 @@ module Reel
10
9
 
11
10
  attr_reader :socket
12
11
  def_delegators :@socket, :addr, :peeraddr
12
+ def_delegators :@driver, :ping
13
13
 
14
14
  def initialize(info, connection)
15
- driver_env = DriverEnvironment.new(info, connection.socket)
16
-
15
+ driver_env = DriverEnvironment.new(info, connection.socket)
16
+
17
17
  @socket = connection.hijack_socket
18
18
  @request_info = info
19
19
 
@@ -94,24 +94,24 @@ module Reel
94
94
  class DriverEnvironment
95
95
  extend Forwardable
96
96
 
97
- attr_reader :env, :url, :socket
98
-
99
- def_delegators :socket, :write
100
-
101
- def initialize(info, socket)
102
- @url = info.url
97
+ attr_reader :env, :socket
103
98
 
104
- env_hash = Hash[info.headers.map { |key, value| ['HTTP_' + key.upcase.gsub('-','_'),value ] }]
105
-
106
- env_hash.merge!({
107
- :method => info.method,
108
- :input => info.body.to_s,
109
- 'REMOTE_ADDR' => info.remote_addr
110
- })
99
+ def_delegator :@info, :url
100
+ def_delegator :@socket, :write
111
101
 
112
- @env = ::Rack::MockRequest.env_for(@url, env_hash)
102
+ RACK_HEADERS = {
103
+ 'HTTP_ORIGIN' => 'Origin',
104
+ 'HTTP_SEC_WEBSOCKET_KEY' => 'Sec-WebSocket-Key',
105
+ 'HTTP_SEC_WEBSOCKET_KEY1' => 'Sec-WebSocket-Key1',
106
+ 'HTTP_SEC_WEBSOCKET_KEY2' => 'Sec-WebSocket-Key2',
107
+ 'HTTP_SEC_WEBSOCKET_EXTENSIONS' => 'Sec-WebSocket-Extensions',
108
+ 'HTTP_SEC_WEBSOCKET_PROTOCOL' => 'Sec-WebSocket-Protocol',
109
+ 'HTTP_SEC_WEBSOCKET_VERSION' => 'Sec-WebSocket-Version'
110
+ }.freeze
113
111
 
114
- @socket = socket
112
+ def initialize(info, socket)
113
+ @info, @socket = info, socket
114
+ @env = Hash.new {|h,k| @info.headers[RACK_HEADERS[k]]}
115
115
  end
116
116
  end
117
117
 
@@ -20,7 +20,6 @@ Gem::Specification.new do |gem|
20
20
  gem.add_runtime_dependency 'http', '>= 0.6.0.pre'
21
21
  gem.add_runtime_dependency 'http_parser.rb', '>= 0.6.0'
22
22
  gem.add_runtime_dependency 'websocket-driver', '>= 0.5.1'
23
- gem.add_runtime_dependency 'rack'
24
23
 
25
24
  gem.add_development_dependency 'rake'
26
25
  gem.add_development_dependency 'rspec', '>= 2.11.0'
@@ -173,6 +173,20 @@ RSpec.describe Reel::WebSocket do
173
173
  end
174
174
  end
175
175
 
176
+ it "pings clients" do
177
+ with_websocket_pair do |client, websocket|
178
+ websocket.ping "<3"
179
+
180
+ pinger = double "pinger"
181
+ expect(pinger).to receive(:ping) { |msg| expect(msg).to eq("<3") }
182
+
183
+ parser = WebSocket::Parser.new
184
+ parser.on_ping { |msg| pinger.ping msg }
185
+
186
+ parser << client.readpartial(4096)
187
+ end
188
+ end
189
+
176
190
  def with_websocket_pair
177
191
  with_socket_pair do |client, peer|
178
192
  connection = Reel::Connection.new(peer)
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: reel
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.0
4
+ version: 0.6.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tony Arcieri
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-02-14 00:00:00.000000000 Z
11
+ date: 2016-03-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: celluloid
@@ -80,20 +80,6 @@ dependencies:
80
80
  - - ">="
81
81
  - !ruby/object:Gem::Version
82
82
  version: 0.5.1
83
- - !ruby/object:Gem::Dependency
84
- name: rack
85
- requirement: !ruby/object:Gem::Requirement
86
- requirements:
87
- - - ">="
88
- - !ruby/object:Gem::Version
89
- version: '0'
90
- type: :runtime
91
- prerelease: false
92
- version_requirements: !ruby/object:Gem::Requirement
93
- requirements:
94
- - - ">="
95
- - !ruby/object:Gem::Version
96
- version: '0'
97
83
  - !ruby/object:Gem::Dependency
98
84
  name: rake
99
85
  requirement: !ruby/object:Gem::Requirement