reel 0.2.0 → 0.3.0.pre
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.
- data/.travis.yml +2 -3
- data/CHANGES.md +12 -2
- data/README.md +105 -19
- data/bin/reel +2 -1
- data/examples/chunked.rb +25 -0
- data/examples/hello_world.rb +4 -1
- data/examples/roundtrip.rb +157 -0
- data/examples/server-sent-events.rb +48 -0
- data/examples/stream.rb +26 -0
- data/examples/websocket-wall.rb +53 -0
- data/examples/websocket.ru +92 -0
- data/examples/websocket_rack.sh +1 -0
- data/examples/websockets.rb +1 -3
- data/lib/rack/handler/reel.rb +7 -5
- data/lib/reel.rb +6 -0
- data/lib/reel/connection.rb +43 -34
- data/lib/reel/mixins.rb +57 -0
- data/lib/reel/rack_worker.rb +103 -59
- data/lib/reel/request.rb +19 -34
- data/lib/reel/request_parser.rb +12 -2
- data/lib/reel/response.rb +36 -30
- data/lib/reel/server.rb +11 -7
- data/lib/reel/stream.rb +128 -0
- data/lib/reel/version.rb +1 -1
- data/lib/reel/websocket.rb +44 -8
- data/spec/reel/connection_spec.rb +89 -0
- data/spec/reel/rack_worker_spec.rb +28 -16
- data/spec/reel/response_spec.rb +2 -2
- data/spec/reel/server_spec.rb +2 -2
- data/spec/reel/websocket_spec.rb +2 -17
- data/spec/spec_helper.rb +26 -2
- metadata +74 -22
data/spec/spec_helper.rb
CHANGED
@@ -18,14 +18,15 @@ end
|
|
18
18
|
|
19
19
|
def with_socket_pair
|
20
20
|
host = '127.0.0.1'
|
21
|
-
port =
|
21
|
+
port = 10101
|
22
22
|
|
23
23
|
server = TCPServer.new(host, port)
|
24
24
|
client = TCPSocket.new(host, port)
|
25
25
|
peer = server.accept
|
26
26
|
|
27
27
|
begin
|
28
|
-
|
28
|
+
connection = Reel::Connection.new(peer)
|
29
|
+
yield client, connection
|
29
30
|
ensure
|
30
31
|
server.close rescue nil
|
31
32
|
client.close rescue nil
|
@@ -65,3 +66,26 @@ class ExampleRequest
|
|
65
66
|
(@body ? @body : '')
|
66
67
|
end
|
67
68
|
end
|
69
|
+
|
70
|
+
module WebSocketHelpers
|
71
|
+
def self.included(spec)
|
72
|
+
spec.instance_eval do
|
73
|
+
let(:example_host) { "www.example.com" }
|
74
|
+
let(:example_path) { "/example"}
|
75
|
+
let(:example_url) { "ws://#{example_host}#{example_path}" }
|
76
|
+
let :handshake_headers do
|
77
|
+
{
|
78
|
+
"Host" => example_host,
|
79
|
+
"Upgrade" => "websocket",
|
80
|
+
"Connection" => "Upgrade",
|
81
|
+
"Sec-WebSocket-Key" => "dGhlIHNhbXBsZSBub25jZQ==",
|
82
|
+
"Origin" => "http://example.com",
|
83
|
+
"Sec-WebSocket-Protocol" => "chat, superchat",
|
84
|
+
"Sec-WebSocket-Version" => "13"
|
85
|
+
}
|
86
|
+
end
|
87
|
+
|
88
|
+
let(:handshake) { WebSocket::ClientHandshake.new(:get, example_url, handshake_headers) }
|
89
|
+
end
|
90
|
+
end
|
91
|
+
end
|
metadata
CHANGED
@@ -1,19 +1,19 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: reel
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
5
|
-
prerelease:
|
4
|
+
version: 0.3.0.pre
|
5
|
+
prerelease: 6
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
8
|
- Tony Arcieri
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2013-01-29 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: celluloid-io
|
16
|
-
requirement:
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ! '>='
|
@@ -21,10 +21,15 @@ dependencies:
|
|
21
21
|
version: 0.8.0
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
|
-
version_requirements:
|
24
|
+
version_requirements: !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
26
|
+
requirements:
|
27
|
+
- - ! '>='
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: 0.8.0
|
25
30
|
- !ruby/object:Gem::Dependency
|
26
31
|
name: http
|
27
|
-
requirement:
|
32
|
+
requirement: !ruby/object:Gem::Requirement
|
28
33
|
none: false
|
29
34
|
requirements:
|
30
35
|
- - ! '>='
|
@@ -32,10 +37,15 @@ dependencies:
|
|
32
37
|
version: 0.2.0
|
33
38
|
type: :runtime
|
34
39
|
prerelease: false
|
35
|
-
version_requirements:
|
40
|
+
version_requirements: !ruby/object:Gem::Requirement
|
41
|
+
none: false
|
42
|
+
requirements:
|
43
|
+
- - ! '>='
|
44
|
+
- !ruby/object:Gem::Version
|
45
|
+
version: 0.2.0
|
36
46
|
- !ruby/object:Gem::Dependency
|
37
47
|
name: http_parser.rb
|
38
|
-
requirement:
|
48
|
+
requirement: !ruby/object:Gem::Requirement
|
39
49
|
none: false
|
40
50
|
requirements:
|
41
51
|
- - ! '>='
|
@@ -43,10 +53,15 @@ dependencies:
|
|
43
53
|
version: 0.5.3
|
44
54
|
type: :runtime
|
45
55
|
prerelease: false
|
46
|
-
version_requirements:
|
56
|
+
version_requirements: !ruby/object:Gem::Requirement
|
57
|
+
none: false
|
58
|
+
requirements:
|
59
|
+
- - ! '>='
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: 0.5.3
|
47
62
|
- !ruby/object:Gem::Dependency
|
48
63
|
name: websocket_parser
|
49
|
-
requirement:
|
64
|
+
requirement: !ruby/object:Gem::Requirement
|
50
65
|
none: false
|
51
66
|
requirements:
|
52
67
|
- - ! '>='
|
@@ -54,10 +69,15 @@ dependencies:
|
|
54
69
|
version: 0.1.0
|
55
70
|
type: :runtime
|
56
71
|
prerelease: false
|
57
|
-
version_requirements:
|
72
|
+
version_requirements: !ruby/object:Gem::Requirement
|
73
|
+
none: false
|
74
|
+
requirements:
|
75
|
+
- - ! '>='
|
76
|
+
- !ruby/object:Gem::Version
|
77
|
+
version: 0.1.0
|
58
78
|
- !ruby/object:Gem::Dependency
|
59
79
|
name: rack
|
60
|
-
requirement:
|
80
|
+
requirement: !ruby/object:Gem::Requirement
|
61
81
|
none: false
|
62
82
|
requirements:
|
63
83
|
- - ! '>='
|
@@ -65,10 +85,15 @@ dependencies:
|
|
65
85
|
version: 1.4.0
|
66
86
|
type: :runtime
|
67
87
|
prerelease: false
|
68
|
-
version_requirements:
|
88
|
+
version_requirements: !ruby/object:Gem::Requirement
|
89
|
+
none: false
|
90
|
+
requirements:
|
91
|
+
- - ! '>='
|
92
|
+
- !ruby/object:Gem::Version
|
93
|
+
version: 1.4.0
|
69
94
|
- !ruby/object:Gem::Dependency
|
70
95
|
name: rake
|
71
|
-
requirement:
|
96
|
+
requirement: !ruby/object:Gem::Requirement
|
72
97
|
none: false
|
73
98
|
requirements:
|
74
99
|
- - ! '>='
|
@@ -76,10 +101,15 @@ dependencies:
|
|
76
101
|
version: '0'
|
77
102
|
type: :development
|
78
103
|
prerelease: false
|
79
|
-
version_requirements:
|
104
|
+
version_requirements: !ruby/object:Gem::Requirement
|
105
|
+
none: false
|
106
|
+
requirements:
|
107
|
+
- - ! '>='
|
108
|
+
- !ruby/object:Gem::Version
|
109
|
+
version: '0'
|
80
110
|
- !ruby/object:Gem::Dependency
|
81
111
|
name: rspec
|
82
|
-
requirement:
|
112
|
+
requirement: !ruby/object:Gem::Requirement
|
83
113
|
none: false
|
84
114
|
requirements:
|
85
115
|
- - ! '>='
|
@@ -87,10 +117,15 @@ dependencies:
|
|
87
117
|
version: '0'
|
88
118
|
type: :development
|
89
119
|
prerelease: false
|
90
|
-
version_requirements:
|
120
|
+
version_requirements: !ruby/object:Gem::Requirement
|
121
|
+
none: false
|
122
|
+
requirements:
|
123
|
+
- - ! '>='
|
124
|
+
- !ruby/object:Gem::Version
|
125
|
+
version: '0'
|
91
126
|
- !ruby/object:Gem::Dependency
|
92
127
|
name: octarine
|
93
|
-
requirement:
|
128
|
+
requirement: !ruby/object:Gem::Requirement
|
94
129
|
none: false
|
95
130
|
requirements:
|
96
131
|
- - ! '>='
|
@@ -98,7 +133,12 @@ dependencies:
|
|
98
133
|
version: '0'
|
99
134
|
type: :development
|
100
135
|
prerelease: false
|
101
|
-
version_requirements:
|
136
|
+
version_requirements: !ruby/object:Gem::Requirement
|
137
|
+
none: false
|
138
|
+
requirements:
|
139
|
+
- - ! '>='
|
140
|
+
- !ruby/object:Gem::Version
|
141
|
+
version: '0'
|
102
142
|
description: A Celluloid::IO-powered HTTP server
|
103
143
|
email:
|
104
144
|
- tony.arcieri@gmail.com
|
@@ -120,18 +160,27 @@ files:
|
|
120
160
|
- benchmarks/hello_rack.ru
|
121
161
|
- benchmarks/hello_reel.rb
|
122
162
|
- bin/reel
|
163
|
+
- examples/chunked.rb
|
123
164
|
- examples/hello_world.rb
|
165
|
+
- examples/roundtrip.rb
|
166
|
+
- examples/server-sent-events.rb
|
167
|
+
- examples/stream.rb
|
168
|
+
- examples/websocket-wall.rb
|
169
|
+
- examples/websocket.ru
|
170
|
+
- examples/websocket_rack.sh
|
124
171
|
- examples/websockets.rb
|
125
172
|
- lib/rack/handler/reel.rb
|
126
173
|
- lib/reel.rb
|
127
174
|
- lib/reel/app.rb
|
128
175
|
- lib/reel/connection.rb
|
129
176
|
- lib/reel/logger.rb
|
177
|
+
- lib/reel/mixins.rb
|
130
178
|
- lib/reel/rack_worker.rb
|
131
179
|
- lib/reel/request.rb
|
132
180
|
- lib/reel/request_parser.rb
|
133
181
|
- lib/reel/response.rb
|
134
182
|
- lib/reel/server.rb
|
183
|
+
- lib/reel/stream.rb
|
135
184
|
- lib/reel/version.rb
|
136
185
|
- lib/reel/websocket.rb
|
137
186
|
- log/.gitignore
|
@@ -158,15 +207,18 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
158
207
|
- - ! '>='
|
159
208
|
- !ruby/object:Gem::Version
|
160
209
|
version: '0'
|
210
|
+
segments:
|
211
|
+
- 0
|
212
|
+
hash: -375858903993702671
|
161
213
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
162
214
|
none: false
|
163
215
|
requirements:
|
164
|
-
- - ! '
|
216
|
+
- - ! '>'
|
165
217
|
- !ruby/object:Gem::Version
|
166
|
-
version:
|
218
|
+
version: 1.3.1
|
167
219
|
requirements: []
|
168
220
|
rubyforge_project:
|
169
|
-
rubygems_version: 1.8.
|
221
|
+
rubygems_version: 1.8.23
|
170
222
|
signing_key:
|
171
223
|
specification_version: 3
|
172
224
|
summary: A reel good HTTP server
|