reel 0.6.0.pre5 → 0.6.0
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 +4 -4
- data/.travis.yml +7 -34
- data/CHANGES.md +53 -30
- data/Gemfile +16 -6
- data/README.md +20 -37
- data/Rakefile +3 -6
- data/examples/roundtrip.rb +3 -3
- data/examples/server_sent_events.rb +1 -1
- data/examples/websockets.rb +2 -2
- data/lib/reel.rb +0 -2
- data/lib/reel/connection.rb +1 -1
- data/lib/reel/request/parser.rb +1 -5
- data/lib/reel/server.rb +4 -21
- data/lib/reel/server/https.rb +18 -5
- data/lib/reel/stream.rb +1 -1
- data/lib/reel/version.rb +1 -1
- data/lib/reel/websocket.rb +15 -15
- data/reel.gemspec +13 -12
- data/spec/reel/http_server_spec.rb +3 -0
- data/spec/reel/https_server_spec.rb +14 -3
- data/spec/reel/websocket_spec.rb +6 -2
- metadata +74 -253
- data/.gitmodules +0 -3
- data/lib/reel/server/unix.rb +0 -18
- data/spec/reel/unix_server_spec.rb +0 -41
- data/tasks/benchmarks.rake +0 -16
- data/tasks/rubocop.rake +0 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5ce24f419ce91dd55a85503c2540abea3c2c79d9
|
4
|
+
data.tar.gz: 8a5adfc3c0a04db334dbacdc70f4748bab8c5b41
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e46d0cb9591419a96bdc072256f6329d5b75272f753137ac90984a06afa89cf52bb8a2f08b92adbc0314f7fef2933f75b524cec26c04ee6018e59d0401c9a9a7
|
7
|
+
data.tar.gz: 40ff868aee4a82390395cf210970ae4e6603e84772bab12c56890fbbee979d6086ef13a6037ed71e7e5be2ab5b23ba8ecf87c721837a51abd1c01c6c3ecee98f
|
data/.travis.yml
CHANGED
@@ -1,41 +1,14 @@
|
|
1
|
-
script: rake ci
|
2
1
|
language: ruby
|
3
|
-
|
4
|
-
- 2.2.0
|
5
|
-
- 2.2.2
|
6
|
-
- jruby
|
7
|
-
- ruby-head
|
8
|
-
- jruby-head
|
9
|
-
- rbx-2
|
10
|
-
|
11
|
-
# TODO: Put these back:
|
12
|
-
# * CELLULOID_TASK_CLASS=Fibered
|
13
|
-
# * CELLULOID_TASK_CLASS=Threaded
|
14
|
-
# For right now the imporant thing is to test BACKPORTED mode:
|
2
|
+
sudo: false
|
15
3
|
|
4
|
+
rvm:
|
5
|
+
- 2.0.0
|
6
|
+
- 2.1.8
|
7
|
+
- 2.2.4
|
8
|
+
- 2.3.0
|
9
|
+
- jruby-9.0.5.0
|
16
10
|
matrix:
|
17
11
|
fast_finish: true
|
18
|
-
allow_failures:
|
19
|
-
- rvm: rbx-2
|
20
|
-
- rvm: ruby-head
|
21
|
-
- rvm: jruby-head
|
22
|
-
- env: CELLULOID_BACKPORTED=true
|
23
|
-
- env: CELLULOID_BACKPORTED=false CELLULOID_LEAKTEST=1
|
24
|
-
|
25
|
-
env:
|
26
|
-
global:
|
27
|
-
- NUMBER_OF_PROCESSORS=2 CELLULOID_CONFIG_FILE=.env-ci
|
28
|
-
matrix:
|
29
|
-
- CELLULOID_BACKPORTED=true
|
30
|
-
- CELLULOID_BACKPORTED=false
|
31
|
-
- CELLULOID_BACKPORTED=false CELLULOID_LEAKTEST=1
|
32
12
|
|
33
13
|
notifications:
|
34
14
|
irc: "irc.freenode.org#celluloid"
|
35
|
-
|
36
|
-
before_install:
|
37
|
-
# Only use 1 job until Travis fixes the rbx --jobs issue.
|
38
|
-
- if [ "$TRAVIS_RUBY_VERSION" == "rbx-2" ] ; then export BUNDLE_JOBS=1 ; else export BUNDLE_JOBS=4; fi
|
39
|
-
|
40
|
-
sudo: false
|
41
|
-
install: bundle install --without=development
|
data/CHANGES.md
CHANGED
@@ -1,25 +1,48 @@
|
|
1
|
-
0.6.0 (
|
2
|
-
|
3
|
-
*
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
*
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
*
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
*
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
*
|
20
|
-
|
21
|
-
|
22
|
-
|
1
|
+
## 0.6.0 (2016-02-13)
|
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.
|
13
|
+
(**@kenichi**)
|
14
|
+
|
15
|
+
* [#155](https://github.com/celluloid/reel/pull/155):
|
16
|
+
Handle Errno::ECONNRESET in SSL server.
|
17
|
+
(**@czaks**)
|
18
|
+
|
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**)
|
23
|
+
|
24
|
+
* [#166](https://github.com/celluloid/reel/pull/166):
|
25
|
+
Switch to websocket-driver gem.
|
26
|
+
(**@d-snp**)
|
27
|
+
|
28
|
+
* [#167](https://github.com/celluloid/reel/pull/167):
|
29
|
+
Delegate #addr, #peeraddr, etc. methods in Spy.
|
30
|
+
(**@d-snp**)
|
31
|
+
|
32
|
+
* [#168](https://github.com/celluloid/reel/pull/168):
|
33
|
+
Revert removal of addr and peeraddr delegates.
|
34
|
+
(**@d-snp**)
|
35
|
+
|
36
|
+
* [#182](https://github.com/celluloid/reel/pull/182):
|
37
|
+
Do not allow transitioning out of closed.
|
38
|
+
(**@zanker**)
|
39
|
+
|
40
|
+
* [#214](https://github.com/celluloid/reel/pull/214):
|
41
|
+
Fix ChunkStream termination.
|
42
|
+
(**@ogoid**)
|
43
|
+
|
44
|
+
## 0.5.0 (2014-04-15)
|
45
|
+
|
23
46
|
* Reel::Server(::SSL) renamed to Reel::Server::HTTP and Reel::Server::HTTPS
|
24
47
|
* New Reel::Spy API for observing requests and responses from the server
|
25
48
|
* Fixes to chunked encoding handling
|
@@ -28,8 +51,8 @@
|
|
28
51
|
* Ensure response bodies are always closed
|
29
52
|
* Support for passing a fixnum status to Connection#respond
|
30
53
|
|
31
|
-
0.4.0
|
32
|
-
|
54
|
+
## 0.4.0
|
55
|
+
|
33
56
|
* Rack adapter moved to the reel-rack project
|
34
57
|
* Pipelining support
|
35
58
|
* Reel::Connection#each_request for iterating through keep-alive requests
|
@@ -43,8 +66,8 @@
|
|
43
66
|
* Remove Reel::App (unmaintained, sorry)
|
44
67
|
* Reel::CODENAME added (0.4.0 is "Garbo")
|
45
68
|
|
46
|
-
0.3.0
|
47
|
-
|
69
|
+
## 0.3.0
|
70
|
+
|
48
71
|
* Reel::App: Sinatra-like DSL for defining Reel apps using Octarine
|
49
72
|
* Chunked upload support
|
50
73
|
* Lots of additional work on the Rack adapter
|
@@ -53,12 +76,12 @@
|
|
53
76
|
* Bugfix: Send CRLF after chunks
|
54
77
|
* Bugfix: Increase TCP connection backlog to 1024
|
55
78
|
|
56
|
-
0.2.0
|
57
|
-
|
79
|
+
## 0.2.0
|
80
|
+
|
58
81
|
* Initial WebSockets support via Reel::WebSocket
|
59
82
|
* Experimental Rack adapter by Alberto Fernández-Capel
|
60
83
|
* Octarine (Sinatra-like DSL) support by Grant Rodgers
|
61
84
|
|
62
|
-
0.1.0
|
63
|
-
|
85
|
+
## 0.1.0
|
86
|
+
|
64
87
|
* Initial release
|
data/Gemfile
CHANGED
@@ -1,12 +1,22 @@
|
|
1
|
-
|
2
|
-
Celluloid::Sync::Gemfile[self]
|
1
|
+
source 'https://rubygems.org'
|
3
2
|
|
4
|
-
gem '
|
5
|
-
gem '
|
6
|
-
gem '
|
3
|
+
gem 'celluloid'
|
4
|
+
gem 'celluloid-io'
|
5
|
+
gem 'http'
|
6
|
+
|
7
|
+
gem 'jruby-openssl' if defined? JRUBY_VERSION
|
8
|
+
gem 'coveralls', require: false
|
9
|
+
|
10
|
+
# Specify your gem's dependencies in reel.gemspec
|
11
|
+
gemspec
|
12
|
+
|
13
|
+
group :development do
|
14
|
+
gem 'guard-rspec'
|
15
|
+
gem 'pry'
|
16
|
+
end
|
7
17
|
|
8
18
|
platforms :rbx do
|
9
19
|
gem 'racc'
|
10
20
|
gem 'rubinius-coverage'
|
11
21
|
gem 'rubysl', '~> 2.0'
|
12
|
-
end
|
22
|
+
end
|
data/README.md
CHANGED
@@ -1,9 +1,10 @@
|
|
1
1
|
![Reel](https://github.com/celluloid/reel/raw/master/logo.png)
|
2
2
|
=======
|
3
|
-
[![Gem Version](https://badge.fury.io/rb/reel.
|
4
|
-
[![Build Status](https://secure.travis-ci.org/celluloid/reel.
|
5
|
-
[![Code Climate](https://codeclimate.com/github/celluloid/reel.
|
6
|
-
[![Coverage Status](https://coveralls.io/repos/celluloid/reel/badge.
|
3
|
+
[![Gem Version](https://badge.fury.io/rb/reel.svg)](http://rubygems.org/gems/reel)
|
4
|
+
[![Build Status](https://secure.travis-ci.org/celluloid/reel.svg?branch=master)](http://travis-ci.org/celluloid/reel)
|
5
|
+
[![Code Climate](https://codeclimate.com/github/celluloid/reel.svg)](https://codeclimate.com/github/celluloid/reel)
|
6
|
+
[![Coverage Status](https://coveralls.io/repos/celluloid/reel/badge.svg?branch=master)](https://coveralls.io/r/celluloid/reel)
|
7
|
+
[![MIT licensed](https://img.shields.io/badge/license-MIT-blue.svg)](https://github.com/celluloid/reel/master/LICENSE.txt)
|
7
8
|
|
8
9
|
> "A dizzying lifetime... reeling by on celluloid" _-- Rush / Between The Wheels_
|
9
10
|
|
@@ -34,34 +35,6 @@ primarily I/O bound, and threads for where you're compute bound.
|
|
34
35
|
|
35
36
|
[Yes](http://news.ycombinator.com/item?id=3067434)
|
36
37
|
|
37
|
-
Here's a "hello world" web server benchmark, run on a 2GHz i7 (OS X 10.7.3).
|
38
|
-
All servers used in a single-threaded mode.
|
39
|
-
|
40
|
-
Reel performance on various Ruby VMs:
|
41
|
-
|
42
|
-
```
|
43
|
-
# httperf --num-conns=50 --num-calls=1000
|
44
|
-
|
45
|
-
Ruby Version Throughput Latency
|
46
|
-
------------ ---------- -------
|
47
|
-
JRuby 1.7.0 3978 req/s (0.3 ms/req)
|
48
|
-
rbx HEAD 2288 reqs/s (0.4 ms/req)
|
49
|
-
Ruby 1.9.3 2071 req/s (0.5 ms/req)
|
50
|
-
```
|
51
|
-
|
52
|
-
Comparison with other web servers:
|
53
|
-
|
54
|
-
```
|
55
|
-
Web Server Throughput Latency
|
56
|
-
---------- ---------- -------
|
57
|
-
Goliath (0.9.4) 2058 reqs/s (0.5 ms/req)
|
58
|
-
Thin (1.2.11) 7502 reqs/s (0.1 ms/req)
|
59
|
-
Node.js (0.6.5) 11735 reqs/s (0.1 ms/req)
|
60
|
-
```
|
61
|
-
|
62
|
-
All Ruby benchmarks done on Ruby 1.9.3. Latencies given are average-per-request
|
63
|
-
and are not amortized across all concurrent requests.
|
64
|
-
|
65
38
|
Documentation
|
66
39
|
-------------
|
67
40
|
|
@@ -133,6 +106,7 @@ applications.
|
|
133
106
|
Reel lets you pass a block to initialize which receives connections:
|
134
107
|
|
135
108
|
```ruby
|
109
|
+
require 'celluloid/autostart'
|
136
110
|
require 'reel'
|
137
111
|
|
138
112
|
Reel::Server::HTTP.supervise("0.0.0.0", 3000) do |connection|
|
@@ -164,6 +138,7 @@ Reel::WebSocket object for WebSockets connections.
|
|
164
138
|
You can also subclass Reel, which allows additional customizations:
|
165
139
|
|
166
140
|
```ruby
|
141
|
+
require 'celluloid/autostart'
|
167
142
|
require 'reel'
|
168
143
|
|
169
144
|
class MyServer < Reel::Server::HTTP
|
@@ -194,16 +169,24 @@ end
|
|
194
169
|
MyServer.run
|
195
170
|
```
|
196
171
|
|
172
|
+
Supported Ruby Versions
|
173
|
+
-----------------------
|
174
|
+
|
175
|
+
This library supports and is tested against the following Ruby versions:
|
176
|
+
|
177
|
+
* Ruby (MRI) 2.0, 2.1, 2.2, 2.3
|
178
|
+
* JRuby 9000
|
179
|
+
|
197
180
|
Contributing
|
198
181
|
------------
|
199
182
|
|
200
|
-
* Fork this repository on
|
201
|
-
* Make your changes and send
|
202
|
-
* If
|
203
|
-
* If
|
183
|
+
* Fork this repository on GitHub
|
184
|
+
* Make your changes and send us a pull request
|
185
|
+
* If we like them we'll merge them
|
186
|
+
* If we've accepted a patch, feel free to ask for commit access
|
204
187
|
|
205
188
|
License
|
206
189
|
-------
|
207
190
|
|
208
|
-
Copyright (c) 2012 Tony Arcieri. Distributed under the MIT License. See
|
191
|
+
Copyright (c) 2012-2016 Tony Arcieri. Distributed under the MIT License. See
|
209
192
|
LICENSE.txt for further details.
|
data/Rakefile
CHANGED
@@ -1,9 +1,6 @@
|
|
1
|
+
#!/usr/bin/env rake
|
1
2
|
require "bundler/gem_tasks"
|
2
3
|
|
3
|
-
Dir["tasks/**/*.rake"].each { |task| load task }
|
4
|
+
Dir[File.expand_path("../tasks/**/*.rake", __FILE__)].each { |task| load task }
|
4
5
|
|
5
|
-
|
6
|
-
default_tasks << "rubocop" unless ENV["CI"]
|
7
|
-
task default: default_tasks
|
8
|
-
|
9
|
-
task ci: %w(spec benchmark)
|
6
|
+
task :default => :spec
|
data/examples/roundtrip.rb
CHANGED
@@ -24,7 +24,7 @@ end
|
|
24
24
|
class Writer
|
25
25
|
include Celluloid
|
26
26
|
include Celluloid::Notifications
|
27
|
-
include Celluloid::
|
27
|
+
include Celluloid::Logger
|
28
28
|
|
29
29
|
def initialize(websocket)
|
30
30
|
info "Writing to socket"
|
@@ -44,7 +44,7 @@ end
|
|
44
44
|
class Reader
|
45
45
|
include Celluloid
|
46
46
|
include Celluloid::Notifications
|
47
|
-
include Celluloid::
|
47
|
+
include Celluloid::Logger
|
48
48
|
|
49
49
|
def initialize(websocket)
|
50
50
|
info "Reading socket"
|
@@ -62,7 +62,7 @@ class Reader
|
|
62
62
|
end
|
63
63
|
|
64
64
|
class WebServer < Reel::Server::HTTP
|
65
|
-
include Celluloid::
|
65
|
+
include Celluloid::Logger
|
66
66
|
|
67
67
|
def initialize(host = "0.0.0.0", port = 9000)
|
68
68
|
info "Roundtrip example starting on #{host}:#{port}"
|
data/examples/websockets.rb
CHANGED
@@ -22,7 +22,7 @@ end
|
|
22
22
|
class TimeClient
|
23
23
|
include Celluloid
|
24
24
|
include Celluloid::Notifications
|
25
|
-
include Celluloid::
|
25
|
+
include Celluloid::Logger
|
26
26
|
|
27
27
|
def initialize(websocket)
|
28
28
|
info "Streaming time changes to client"
|
@@ -39,7 +39,7 @@ class TimeClient
|
|
39
39
|
end
|
40
40
|
|
41
41
|
class WebServer < Reel::Server::HTTP
|
42
|
-
include Celluloid::
|
42
|
+
include Celluloid::Logger
|
43
43
|
|
44
44
|
def initialize(host = "127.0.0.1", port = 1234)
|
45
45
|
info "Time server example starting on #{host}:#{port}"
|
data/lib/reel.rb
CHANGED
@@ -1,6 +1,5 @@
|
|
1
1
|
require 'uri'
|
2
2
|
|
3
|
-
require 'celluloid/autostart'
|
4
3
|
require 'http/parser'
|
5
4
|
require 'http'
|
6
5
|
require 'celluloid/io'
|
@@ -15,7 +14,6 @@ require 'reel/response'
|
|
15
14
|
require 'reel/server'
|
16
15
|
require 'reel/server/http'
|
17
16
|
require 'reel/server/https'
|
18
|
-
require 'reel/server/unix' unless RUBY_PLATFORM == 'java'
|
19
17
|
|
20
18
|
require 'reel/websocket'
|
21
19
|
require 'reel/stream'
|
data/lib/reel/connection.rb
CHANGED
@@ -56,7 +56,7 @@ module Reel
|
|
56
56
|
|
57
57
|
req = @parser.current_request
|
58
58
|
@request_fsm.transition :headers
|
59
|
-
@keepalive = false if req
|
59
|
+
@keepalive = false if req[CONNECTION] == CLOSE || req.version == HTTP_VERSION_1_0
|
60
60
|
@current_request = req
|
61
61
|
|
62
62
|
req
|
data/lib/reel/request/parser.rb
CHANGED
data/lib/reel/server.rb
CHANGED
@@ -2,14 +2,14 @@ module Reel
|
|
2
2
|
# Base class for Reel servers.
|
3
3
|
#
|
4
4
|
# This class is a Celluloid::IO actor which provides a barebones server
|
5
|
-
# which does not open a socket itself, it just begin handling connections
|
6
|
-
#
|
5
|
+
# which does not open a socket itself, it just begin handling connections once
|
6
|
+
# initialized with a specific kind of protocol-based server.
|
7
7
|
|
8
8
|
# For specific protocol support, use:
|
9
9
|
|
10
10
|
# Reel::Server::HTTP
|
11
11
|
# Reel::Server::HTTPS
|
12
|
-
# Reel::Server::UNIX
|
12
|
+
# Coming soon: Reel::Server::UNIX
|
13
13
|
|
14
14
|
class Server
|
15
15
|
include Celluloid::IO
|
@@ -25,15 +25,6 @@ module Reel
|
|
25
25
|
@callback = callback
|
26
26
|
@server = server
|
27
27
|
|
28
|
-
@options[:rescue] ||= []
|
29
|
-
@options[:rescue] += [
|
30
|
-
Errno::ECONNRESET,
|
31
|
-
Errno::EPIPE,
|
32
|
-
Errno::EINPROGRESS,
|
33
|
-
Errno::ETIMEDOUT,
|
34
|
-
Errno::EHOSTUNREACH
|
35
|
-
]
|
36
|
-
|
37
28
|
@server.listen(options.fetch(:backlog, DEFAULT_BACKLOG))
|
38
29
|
|
39
30
|
async.run
|
@@ -44,15 +35,7 @@ module Reel
|
|
44
35
|
end
|
45
36
|
|
46
37
|
def run
|
47
|
-
loop {
|
48
|
-
begin
|
49
|
-
socket = @server.accept
|
50
|
-
rescue *@options[:rescue] => ex
|
51
|
-
Logger.warn "Error accepting socket: #{ex.class}: #{ex.to_s}"
|
52
|
-
next
|
53
|
-
end
|
54
|
-
async.handle_connection socket
|
55
|
-
}
|
38
|
+
loop { async.handle_connection @server.accept }
|
56
39
|
end
|
57
40
|
|
58
41
|
def handle_connection(socket)
|
data/lib/reel/server/https.rb
CHANGED
@@ -27,11 +27,12 @@ module Reel
|
|
27
27
|
|
28
28
|
# if verify_mode isn't explicitly set, verify peers if we've
|
29
29
|
# been provided CA information that would enable us to do so
|
30
|
-
ssl_context.verify_mode =
|
30
|
+
ssl_context.verify_mode = case
|
31
|
+
when options.include?(:verify_mode)
|
31
32
|
options[:verify_mode]
|
32
|
-
|
33
|
+
when options.include?(:ca_file)
|
33
34
|
OpenSSL::SSL::VERIFY_PEER
|
34
|
-
|
35
|
+
when options.include?(:ca_path)
|
35
36
|
OpenSSL::SSL::VERIFY_PEER
|
36
37
|
else
|
37
38
|
OpenSSL::SSL::VERIFY_NONE
|
@@ -42,10 +43,22 @@ module Reel
|
|
42
43
|
server = Celluloid::IO::SSLServer.new(@tcpserver, ssl_context)
|
43
44
|
options.merge!(host: host, port: port)
|
44
45
|
|
45
|
-
options[:rescue] = [ OpenSSL::SSL::SSLError ]
|
46
|
-
|
47
46
|
super(server, options, &callback)
|
48
47
|
end
|
48
|
+
|
49
|
+
def run
|
50
|
+
loop do
|
51
|
+
begin
|
52
|
+
socket = @server.accept
|
53
|
+
rescue OpenSSL::SSL::SSLError, Errno::ECONNRESET, Errno::EPIPE,
|
54
|
+
Errno::ETIMEDOUT, Errno::EHOSTUNREACH => ex
|
55
|
+
Logger.warn "Error accepting SSLSocket: #{ex.class}: #{ex.to_s}"
|
56
|
+
retry
|
57
|
+
end
|
58
|
+
|
59
|
+
async.handle_connection socket
|
60
|
+
end
|
61
|
+
end
|
49
62
|
end
|
50
63
|
end
|
51
64
|
end
|
data/lib/reel/stream.rb
CHANGED
data/lib/reel/version.rb
CHANGED
data/lib/reel/websocket.rb
CHANGED
@@ -1,5 +1,6 @@
|
|
1
1
|
require 'forwardable'
|
2
2
|
require 'websocket/driver'
|
3
|
+
require 'rack'
|
3
4
|
|
4
5
|
module Reel
|
5
6
|
class WebSocket
|
@@ -9,11 +10,10 @@ module Reel
|
|
9
10
|
|
10
11
|
attr_reader :socket
|
11
12
|
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
|
|
@@ -98,19 +98,19 @@ module Reel
|
|
98
98
|
|
99
99
|
def_delegators :socket, :write
|
100
100
|
|
101
|
-
RACK_HEADERS = {
|
102
|
-
'Origin' => 'HTTP_ORIGIN',
|
103
|
-
'Sec-WebSocket-Key' => 'HTTP_SEC_WEBSOCKET_KEY',
|
104
|
-
'Sec-WebSocket-Key1' => 'HTTP_SEC_WEBSOCKET_KEY1',
|
105
|
-
'Sec-WebSocket-Key2' => 'HTTP_SEC_WEBSOCKET_KEY2',
|
106
|
-
'Sec-WebSocket-Extensions' => 'HTTP_SEC_WEBSOCKET_EXTENSIONS',
|
107
|
-
'Sec-WebSocket-Protocol' => 'HTTP_SEC_WEBSOCKET_PROTOCOL',
|
108
|
-
'Sec-WebSocket-Version' => 'HTTP_SEC_WEBSOCKET_VERSION'
|
109
|
-
}
|
110
|
-
|
111
101
|
def initialize(info, socket)
|
112
|
-
@
|
113
|
-
|
102
|
+
@url = info.url
|
103
|
+
|
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
|
+
})
|
111
|
+
|
112
|
+
@env = ::Rack::MockRequest.env_for(@url, env_hash)
|
113
|
+
|
114
114
|
@socket = socket
|
115
115
|
end
|
116
116
|
end
|
data/reel.gemspec
CHANGED
@@ -1,11 +1,11 @@
|
|
1
1
|
# -*- encoding: utf-8 -*-
|
2
|
-
require File.expand_path(
|
2
|
+
require File.expand_path('../lib/reel/version', __FILE__)
|
3
3
|
|
4
4
|
Gem::Specification.new do |gem|
|
5
|
-
gem.authors = ["Tony Arcieri"
|
6
|
-
gem.email = ["tony.arcieri@gmail.com"
|
7
|
-
gem.description = "A Celluloid::IO-powered
|
8
|
-
gem.summary = "A Reel good
|
5
|
+
gem.authors = ["Tony Arcieri"]
|
6
|
+
gem.email = ["tony.arcieri@gmail.com"]
|
7
|
+
gem.description = "A Celluloid::IO-powered HTTP server"
|
8
|
+
gem.summary = "A Reel good HTTP server"
|
9
9
|
gem.homepage = "https://github.com/celluloid/reel"
|
10
10
|
|
11
11
|
gem.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
@@ -15,14 +15,15 @@ Gem::Specification.new do |gem|
|
|
15
15
|
gem.require_paths = ["lib"]
|
16
16
|
gem.version = Reel::VERSION
|
17
17
|
|
18
|
-
gem.add_runtime_dependency 'celluloid
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
gem.add_runtime_dependency 'http', '>= 0.6.0.pre'
|
23
|
-
gem.add_runtime_dependency 'http_parser.rb', '>= 0.6.0'
|
18
|
+
gem.add_runtime_dependency 'celluloid', '>= 0.15.1'
|
19
|
+
gem.add_runtime_dependency 'celluloid-io', '>= 0.15.0'
|
20
|
+
gem.add_runtime_dependency 'http', '>= 0.6.0.pre'
|
21
|
+
gem.add_runtime_dependency 'http_parser.rb', '>= 0.6.0'
|
24
22
|
gem.add_runtime_dependency 'websocket-driver', '>= 0.5.1'
|
25
|
-
gem.add_runtime_dependency '
|
23
|
+
gem.add_runtime_dependency 'rack'
|
26
24
|
|
25
|
+
gem.add_development_dependency 'rake'
|
26
|
+
gem.add_development_dependency 'rspec', '>= 2.11.0'
|
27
27
|
gem.add_development_dependency 'certificate_authority'
|
28
|
+
gem.add_development_dependency 'websocket_parser', '>= 0.1.6'
|
28
29
|
end
|
@@ -14,7 +14,9 @@ RSpec.describe Reel::Server::HTTP do
|
|
14
14
|
expect(request.method).to eq 'GET'
|
15
15
|
expect(request.version).to eq "1.1"
|
16
16
|
expect(request.url).to eq example_path
|
17
|
+
|
17
18
|
connection.respond :ok, response_body
|
19
|
+
rescue => ex
|
18
20
|
end
|
19
21
|
end
|
20
22
|
|
@@ -34,6 +36,7 @@ RSpec.describe Reel::Server::HTTP do
|
|
34
36
|
request = connection.request
|
35
37
|
expect(request.method).to eq 'POST'
|
36
38
|
connection.respond :ok, request.body.to_s
|
39
|
+
rescue => ex
|
37
40
|
end
|
38
41
|
end
|
39
42
|
|
@@ -2,7 +2,6 @@ require 'spec_helper'
|
|
2
2
|
require 'net/http'
|
3
3
|
|
4
4
|
RSpec.describe Reel::Server::HTTPS do
|
5
|
-
|
6
5
|
let(:example_https_port) { example_port + 1 }
|
7
6
|
let(:example_url) { "https://#{example_addr}:#{example_https_port}#{example_path}" }
|
8
7
|
let(:endpoint) { URI(example_url) }
|
@@ -25,7 +24,9 @@ RSpec.describe Reel::Server::HTTPS do
|
|
25
24
|
expect(request.method).to eq 'GET'
|
26
25
|
expect(request.version).to eq "1.1"
|
27
26
|
expect(request.url).to eq example_path
|
27
|
+
|
28
28
|
connection.respond :ok, response_body
|
29
|
+
rescue => ex
|
29
30
|
end
|
30
31
|
end
|
31
32
|
|
@@ -33,15 +34,17 @@ RSpec.describe Reel::Server::HTTPS do
|
|
33
34
|
http = Net::HTTP.new(endpoint.host, endpoint.port)
|
34
35
|
http.use_ssl = true
|
35
36
|
http.ca_file = self.ca_file
|
37
|
+
|
36
38
|
request = Net::HTTP::Get.new(endpoint.path)
|
37
39
|
response = http.request(request)
|
40
|
+
|
38
41
|
expect(response.body).to eq response_body
|
39
42
|
end
|
40
43
|
|
41
44
|
raise ex if ex
|
42
45
|
end
|
43
46
|
|
44
|
-
it
|
47
|
+
it 'verifies client SSL certs when provided with a CA' do
|
45
48
|
ex = nil
|
46
49
|
|
47
50
|
handler = proc do |connection|
|
@@ -50,7 +53,9 @@ RSpec.describe Reel::Server::HTTPS do
|
|
50
53
|
expect(request.method).to eq 'GET'
|
51
54
|
expect(request.version).to eq '1.1'
|
52
55
|
expect(request.url).to eq example_path
|
56
|
+
|
53
57
|
connection.respond :ok, response_body
|
58
|
+
rescue => ex
|
54
59
|
end
|
55
60
|
end
|
56
61
|
|
@@ -60,15 +65,17 @@ RSpec.describe Reel::Server::HTTPS do
|
|
60
65
|
http.ca_file = self.ca_file
|
61
66
|
http.cert = OpenSSL::X509::Certificate.new self.client_cert
|
62
67
|
http.key = OpenSSL::PKey::RSA.new self.client_key
|
68
|
+
|
63
69
|
request = Net::HTTP::Get.new(endpoint.path)
|
64
70
|
response = http.request(request)
|
71
|
+
|
65
72
|
expect(response.body).to eq response_body
|
66
73
|
end
|
67
74
|
|
68
75
|
raise ex if ex
|
69
76
|
end
|
70
77
|
|
71
|
-
it
|
78
|
+
it %{fails to verify client certificates that aren't signed} do
|
72
79
|
ex = nil
|
73
80
|
|
74
81
|
handler = proc do |connection|
|
@@ -77,7 +84,9 @@ RSpec.describe Reel::Server::HTTPS do
|
|
77
84
|
expect(request.method).to eq 'GET'
|
78
85
|
expect(request.version).to eq '1.1'
|
79
86
|
expect(request.url).to eq example_path
|
87
|
+
|
80
88
|
connection.respond :ok, response_body
|
89
|
+
rescue => ex
|
81
90
|
end
|
82
91
|
end
|
83
92
|
|
@@ -87,7 +96,9 @@ RSpec.describe Reel::Server::HTTPS do
|
|
87
96
|
http.ca_file = self.ca_file
|
88
97
|
http.cert = OpenSSL::X509::Certificate.new self.client_cert_unsigned
|
89
98
|
http.key = OpenSSL::PKey::RSA.new self.client_key
|
99
|
+
|
90
100
|
request = Net::HTTP::Get.new(endpoint.path)
|
101
|
+
|
91
102
|
expect { http.request(request) }.to raise_error(OpenSSL::SSL::SSLError)
|
92
103
|
end
|
93
104
|
|
data/spec/reel/websocket_spec.rb
CHANGED
@@ -61,10 +61,12 @@ RSpec.describe Reel::WebSocket do
|
|
61
61
|
|
62
62
|
describe "WebSocket#next_message" do
|
63
63
|
it "triggers on the next sent message" do
|
64
|
+
skip "update to new Celluloid internal APIs"
|
65
|
+
|
64
66
|
with_websocket_pair do |client, websocket|
|
65
67
|
f = Celluloid::Future.new
|
66
68
|
websocket.on_message do |message|
|
67
|
-
f << Celluloid::
|
69
|
+
f << Celluloid::SuccessResponse.new(:on_message, message)
|
68
70
|
end
|
69
71
|
|
70
72
|
message = WebSocket::Message.new(example_message)
|
@@ -80,6 +82,8 @@ RSpec.describe Reel::WebSocket do
|
|
80
82
|
|
81
83
|
describe "WebSocket#read_every" do
|
82
84
|
it "automatically executes read" do
|
85
|
+
skip "update to new Celluloid internal APIs"
|
86
|
+
|
83
87
|
with_websocket_pair do |client, websocket|
|
84
88
|
class MyActor
|
85
89
|
include Celluloid
|
@@ -91,7 +95,7 @@ RSpec.describe Reel::WebSocket do
|
|
91
95
|
|
92
96
|
f = Celluloid::Future.new
|
93
97
|
websocket.on_message do |message|
|
94
|
-
f << Celluloid::
|
98
|
+
f << Celluloid::SuccessResponse.new(:on_message, message)
|
95
99
|
end
|
96
100
|
|
97
101
|
message = WebSocket::Message.new(example_message)
|
metadata
CHANGED
@@ -1,351 +1,166 @@
|
|
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.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tony Arcieri
|
8
|
-
|
9
|
-
autorequire:
|
8
|
+
autorequire:
|
10
9
|
bindir: bin
|
11
10
|
cert_chain: []
|
12
|
-
date:
|
11
|
+
date: 2016-02-14 00:00:00.000000000 Z
|
13
12
|
dependencies:
|
14
13
|
- !ruby/object:Gem::Dependency
|
14
|
+
name: celluloid
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- -
|
18
|
-
- !ruby/object:Gem::Version
|
19
|
-
version: 0.16.5.pre0
|
20
|
-
name: celluloid-io
|
21
|
-
prerelease: false
|
22
|
-
type: :runtime
|
23
|
-
version_requirements: !ruby/object:Gem::Requirement
|
24
|
-
requirements:
|
25
|
-
- - '>='
|
26
|
-
- !ruby/object:Gem::Version
|
27
|
-
version: 0.16.5.pre0
|
28
|
-
- !ruby/object:Gem::Dependency
|
29
|
-
requirement: !ruby/object:Gem::Requirement
|
30
|
-
requirements:
|
31
|
-
- - '>='
|
17
|
+
- - ">="
|
32
18
|
- !ruby/object:Gem::Version
|
33
|
-
version:
|
34
|
-
name: bundler
|
35
|
-
prerelease: false
|
19
|
+
version: 0.15.1
|
36
20
|
type: :runtime
|
37
|
-
version_requirements: !ruby/object:Gem::Requirement
|
38
|
-
requirements:
|
39
|
-
- - '>='
|
40
|
-
- !ruby/object:Gem::Version
|
41
|
-
version: '0'
|
42
|
-
- !ruby/object:Gem::Dependency
|
43
|
-
requirement: !ruby/object:Gem::Requirement
|
44
|
-
requirements:
|
45
|
-
- - '>='
|
46
|
-
- !ruby/object:Gem::Version
|
47
|
-
version: '0'
|
48
|
-
name: nenv
|
49
21
|
prerelease: false
|
50
|
-
type: :runtime
|
51
22
|
version_requirements: !ruby/object:Gem::Requirement
|
52
23
|
requirements:
|
53
|
-
- -
|
24
|
+
- - ">="
|
54
25
|
- !ruby/object:Gem::Version
|
55
|
-
version:
|
26
|
+
version: 0.15.1
|
56
27
|
- !ruby/object:Gem::Dependency
|
28
|
+
name: celluloid-io
|
57
29
|
requirement: !ruby/object:Gem::Requirement
|
58
30
|
requirements:
|
59
|
-
- -
|
31
|
+
- - ">="
|
60
32
|
- !ruby/object:Gem::Version
|
61
|
-
version:
|
62
|
-
name: dotenv
|
63
|
-
prerelease: false
|
33
|
+
version: 0.15.0
|
64
34
|
type: :runtime
|
65
|
-
version_requirements: !ruby/object:Gem::Requirement
|
66
|
-
requirements:
|
67
|
-
- - '>='
|
68
|
-
- !ruby/object:Gem::Version
|
69
|
-
version: '0'
|
70
|
-
- !ruby/object:Gem::Dependency
|
71
|
-
requirement: !ruby/object:Gem::Requirement
|
72
|
-
requirements:
|
73
|
-
- - '>='
|
74
|
-
- !ruby/object:Gem::Version
|
75
|
-
version: '0'
|
76
|
-
name: benchmark_suite
|
77
35
|
prerelease: false
|
78
|
-
type: :development
|
79
36
|
version_requirements: !ruby/object:Gem::Requirement
|
80
37
|
requirements:
|
81
|
-
- -
|
38
|
+
- - ">="
|
82
39
|
- !ruby/object:Gem::Version
|
83
|
-
version:
|
40
|
+
version: 0.15.0
|
84
41
|
- !ruby/object:Gem::Dependency
|
42
|
+
name: http
|
85
43
|
requirement: !ruby/object:Gem::Requirement
|
86
44
|
requirements:
|
87
|
-
- -
|
45
|
+
- - ">="
|
88
46
|
- !ruby/object:Gem::Version
|
89
|
-
version:
|
90
|
-
|
47
|
+
version: 0.6.0.pre
|
48
|
+
type: :runtime
|
91
49
|
prerelease: false
|
92
|
-
type: :development
|
93
50
|
version_requirements: !ruby/object:Gem::Requirement
|
94
51
|
requirements:
|
95
|
-
- -
|
52
|
+
- - ">="
|
96
53
|
- !ruby/object:Gem::Version
|
97
|
-
version:
|
54
|
+
version: 0.6.0.pre
|
98
55
|
- !ruby/object:Gem::Dependency
|
56
|
+
name: http_parser.rb
|
99
57
|
requirement: !ruby/object:Gem::Requirement
|
100
58
|
requirements:
|
101
|
-
- -
|
59
|
+
- - ">="
|
102
60
|
- !ruby/object:Gem::Version
|
103
|
-
version:
|
104
|
-
|
61
|
+
version: 0.6.0
|
62
|
+
type: :runtime
|
105
63
|
prerelease: false
|
106
|
-
type: :development
|
107
64
|
version_requirements: !ruby/object:Gem::Requirement
|
108
65
|
requirements:
|
109
|
-
- -
|
66
|
+
- - ">="
|
110
67
|
- !ruby/object:Gem::Version
|
111
|
-
version:
|
68
|
+
version: 0.6.0
|
112
69
|
- !ruby/object:Gem::Dependency
|
70
|
+
name: websocket-driver
|
113
71
|
requirement: !ruby/object:Gem::Requirement
|
114
72
|
requirements:
|
115
|
-
- -
|
73
|
+
- - ">="
|
116
74
|
- !ruby/object:Gem::Version
|
117
|
-
version:
|
118
|
-
|
75
|
+
version: 0.5.1
|
76
|
+
type: :runtime
|
119
77
|
prerelease: false
|
120
|
-
type: :development
|
121
78
|
version_requirements: !ruby/object:Gem::Requirement
|
122
79
|
requirements:
|
123
|
-
- -
|
80
|
+
- - ">="
|
124
81
|
- !ruby/object:Gem::Version
|
125
|
-
version:
|
82
|
+
version: 0.5.1
|
126
83
|
- !ruby/object:Gem::Dependency
|
84
|
+
name: rack
|
127
85
|
requirement: !ruby/object:Gem::Requirement
|
128
86
|
requirements:
|
129
|
-
- -
|
87
|
+
- - ">="
|
130
88
|
- !ruby/object:Gem::Version
|
131
89
|
version: '0'
|
132
|
-
|
90
|
+
type: :runtime
|
133
91
|
prerelease: false
|
134
|
-
type: :development
|
135
92
|
version_requirements: !ruby/object:Gem::Requirement
|
136
93
|
requirements:
|
137
|
-
- -
|
94
|
+
- - ">="
|
138
95
|
- !ruby/object:Gem::Version
|
139
96
|
version: '0'
|
140
97
|
- !ruby/object:Gem::Dependency
|
98
|
+
name: rake
|
141
99
|
requirement: !ruby/object:Gem::Requirement
|
142
100
|
requirements:
|
143
|
-
- -
|
101
|
+
- - ">="
|
144
102
|
- !ruby/object:Gem::Version
|
145
103
|
version: '0'
|
146
|
-
name: coveralls
|
147
|
-
prerelease: false
|
148
104
|
type: :development
|
149
|
-
version_requirements: !ruby/object:Gem::Requirement
|
150
|
-
requirements:
|
151
|
-
- - '>='
|
152
|
-
- !ruby/object:Gem::Version
|
153
|
-
version: '0'
|
154
|
-
- !ruby/object:Gem::Dependency
|
155
|
-
requirement: !ruby/object:Gem::Requirement
|
156
|
-
requirements:
|
157
|
-
- - '>='
|
158
|
-
- !ruby/object:Gem::Version
|
159
|
-
version: 0.17.0.pre12
|
160
|
-
name: celluloid
|
161
|
-
prerelease: false
|
162
|
-
type: :runtime
|
163
|
-
version_requirements: !ruby/object:Gem::Requirement
|
164
|
-
requirements:
|
165
|
-
- - '>='
|
166
|
-
- !ruby/object:Gem::Version
|
167
|
-
version: 0.17.0.pre12
|
168
|
-
- !ruby/object:Gem::Dependency
|
169
|
-
requirement: !ruby/object:Gem::Requirement
|
170
|
-
requirements:
|
171
|
-
- - '>='
|
172
|
-
- !ruby/object:Gem::Version
|
173
|
-
version: '0'
|
174
|
-
name: celluloid-essentials
|
175
105
|
prerelease: false
|
176
|
-
type: :development
|
177
106
|
version_requirements: !ruby/object:Gem::Requirement
|
178
107
|
requirements:
|
179
|
-
- -
|
108
|
+
- - ">="
|
180
109
|
- !ruby/object:Gem::Version
|
181
110
|
version: '0'
|
182
111
|
- !ruby/object:Gem::Dependency
|
112
|
+
name: rspec
|
183
113
|
requirement: !ruby/object:Gem::Requirement
|
184
114
|
requirements:
|
185
|
-
- -
|
115
|
+
- - ">="
|
186
116
|
- !ruby/object:Gem::Version
|
187
|
-
version:
|
188
|
-
name: celluloid-supervision
|
189
|
-
prerelease: false
|
117
|
+
version: 2.11.0
|
190
118
|
type: :development
|
191
|
-
version_requirements: !ruby/object:Gem::Requirement
|
192
|
-
requirements:
|
193
|
-
- - '>='
|
194
|
-
- !ruby/object:Gem::Version
|
195
|
-
version: '0'
|
196
|
-
- !ruby/object:Gem::Dependency
|
197
|
-
requirement: !ruby/object:Gem::Requirement
|
198
|
-
requirements:
|
199
|
-
- - '>='
|
200
|
-
- !ruby/object:Gem::Version
|
201
|
-
version: '0'
|
202
|
-
name: celluloid-pool
|
203
119
|
prerelease: false
|
204
|
-
type: :development
|
205
120
|
version_requirements: !ruby/object:Gem::Requirement
|
206
121
|
requirements:
|
207
|
-
- -
|
122
|
+
- - ">="
|
208
123
|
- !ruby/object:Gem::Version
|
209
|
-
version:
|
124
|
+
version: 2.11.0
|
210
125
|
- !ruby/object:Gem::Dependency
|
126
|
+
name: certificate_authority
|
211
127
|
requirement: !ruby/object:Gem::Requirement
|
212
128
|
requirements:
|
213
|
-
- -
|
129
|
+
- - ">="
|
214
130
|
- !ruby/object:Gem::Version
|
215
131
|
version: '0'
|
216
|
-
name: celluloid-fsm
|
217
|
-
prerelease: false
|
218
132
|
type: :development
|
219
|
-
version_requirements: !ruby/object:Gem::Requirement
|
220
|
-
requirements:
|
221
|
-
- - '>='
|
222
|
-
- !ruby/object:Gem::Version
|
223
|
-
version: '0'
|
224
|
-
- !ruby/object:Gem::Dependency
|
225
|
-
requirement: !ruby/object:Gem::Requirement
|
226
|
-
requirements:
|
227
|
-
- - '>='
|
228
|
-
- !ruby/object:Gem::Version
|
229
|
-
version: '0'
|
230
|
-
name: celluloid-extras
|
231
133
|
prerelease: false
|
232
|
-
type: :development
|
233
134
|
version_requirements: !ruby/object:Gem::Requirement
|
234
135
|
requirements:
|
235
|
-
- -
|
136
|
+
- - ">="
|
236
137
|
- !ruby/object:Gem::Version
|
237
138
|
version: '0'
|
238
139
|
- !ruby/object:Gem::Dependency
|
140
|
+
name: websocket_parser
|
239
141
|
requirement: !ruby/object:Gem::Requirement
|
240
142
|
requirements:
|
241
|
-
- -
|
242
|
-
- !ruby/object:Gem::Version
|
243
|
-
version: 4.0.0
|
244
|
-
name: timers
|
245
|
-
prerelease: false
|
246
|
-
type: :runtime
|
247
|
-
version_requirements: !ruby/object:Gem::Requirement
|
248
|
-
requirements:
|
249
|
-
- - ~>
|
250
|
-
- !ruby/object:Gem::Version
|
251
|
-
version: 4.0.0
|
252
|
-
- !ruby/object:Gem::Dependency
|
253
|
-
requirement: !ruby/object:Gem::Requirement
|
254
|
-
requirements:
|
255
|
-
- - '>='
|
256
|
-
- !ruby/object:Gem::Version
|
257
|
-
version: 0.1.2
|
258
|
-
name: rspec-logsplit
|
259
|
-
prerelease: false
|
260
|
-
type: :runtime
|
261
|
-
version_requirements: !ruby/object:Gem::Requirement
|
262
|
-
requirements:
|
263
|
-
- - '>='
|
264
|
-
- !ruby/object:Gem::Version
|
265
|
-
version: 0.1.2
|
266
|
-
- !ruby/object:Gem::Dependency
|
267
|
-
requirement: !ruby/object:Gem::Requirement
|
268
|
-
requirements:
|
269
|
-
- - '>='
|
270
|
-
- !ruby/object:Gem::Version
|
271
|
-
version: 0.6.0.pre
|
272
|
-
name: http
|
273
|
-
prerelease: false
|
274
|
-
type: :runtime
|
275
|
-
version_requirements: !ruby/object:Gem::Requirement
|
276
|
-
requirements:
|
277
|
-
- - '>='
|
278
|
-
- !ruby/object:Gem::Version
|
279
|
-
version: 0.6.0.pre
|
280
|
-
- !ruby/object:Gem::Dependency
|
281
|
-
requirement: !ruby/object:Gem::Requirement
|
282
|
-
requirements:
|
283
|
-
- - '>='
|
284
|
-
- !ruby/object:Gem::Version
|
285
|
-
version: 0.6.0
|
286
|
-
name: http_parser.rb
|
287
|
-
prerelease: false
|
288
|
-
type: :runtime
|
289
|
-
version_requirements: !ruby/object:Gem::Requirement
|
290
|
-
requirements:
|
291
|
-
- - '>='
|
292
|
-
- !ruby/object:Gem::Version
|
293
|
-
version: 0.6.0
|
294
|
-
- !ruby/object:Gem::Dependency
|
295
|
-
requirement: !ruby/object:Gem::Requirement
|
296
|
-
requirements:
|
297
|
-
- - '>='
|
298
|
-
- !ruby/object:Gem::Version
|
299
|
-
version: 0.5.1
|
300
|
-
name: websocket-driver
|
301
|
-
prerelease: false
|
302
|
-
type: :runtime
|
303
|
-
version_requirements: !ruby/object:Gem::Requirement
|
304
|
-
requirements:
|
305
|
-
- - '>='
|
306
|
-
- !ruby/object:Gem::Version
|
307
|
-
version: 0.5.1
|
308
|
-
- !ruby/object:Gem::Dependency
|
309
|
-
requirement: !ruby/object:Gem::Requirement
|
310
|
-
requirements:
|
311
|
-
- - '>='
|
143
|
+
- - ">="
|
312
144
|
- !ruby/object:Gem::Version
|
313
145
|
version: 0.1.6
|
314
|
-
|
146
|
+
type: :development
|
315
147
|
prerelease: false
|
316
|
-
type: :runtime
|
317
148
|
version_requirements: !ruby/object:Gem::Requirement
|
318
149
|
requirements:
|
319
|
-
- -
|
150
|
+
- - ">="
|
320
151
|
- !ruby/object:Gem::Version
|
321
152
|
version: 0.1.6
|
322
|
-
-
|
323
|
-
requirement: !ruby/object:Gem::Requirement
|
324
|
-
requirements:
|
325
|
-
- - '>='
|
326
|
-
- !ruby/object:Gem::Version
|
327
|
-
version: '0'
|
328
|
-
name: certificate_authority
|
329
|
-
prerelease: false
|
330
|
-
type: :development
|
331
|
-
version_requirements: !ruby/object:Gem::Requirement
|
332
|
-
requirements:
|
333
|
-
- - '>='
|
334
|
-
- !ruby/object:Gem::Version
|
335
|
-
version: '0'
|
336
|
-
description: A Celluloid::IO-powered multi-protocol HTTP, HTTPS, and Web Socket server
|
153
|
+
description: A Celluloid::IO-powered HTTP server
|
337
154
|
email:
|
338
155
|
- tony.arcieri@gmail.com
|
339
|
-
- code@extremist.digital
|
340
156
|
executables: []
|
341
157
|
extensions: []
|
342
158
|
extra_rdoc_files: []
|
343
159
|
files:
|
344
|
-
- .coveralls.yml
|
345
|
-
- .gitignore
|
346
|
-
- .
|
347
|
-
- .
|
348
|
-
- .travis.yml
|
160
|
+
- ".coveralls.yml"
|
161
|
+
- ".gitignore"
|
162
|
+
- ".rspec"
|
163
|
+
- ".travis.yml"
|
349
164
|
- CHANGES.md
|
350
165
|
- Gemfile
|
351
166
|
- Guardfile
|
@@ -376,7 +191,6 @@ files:
|
|
376
191
|
- lib/reel/server.rb
|
377
192
|
- lib/reel/server/http.rb
|
378
193
|
- lib/reel/server/https.rb
|
379
|
-
- lib/reel/server/unix.rb
|
380
194
|
- lib/reel/spy.rb
|
381
195
|
- lib/reel/stream.rb
|
382
196
|
- lib/reel/version.rb
|
@@ -390,35 +204,42 @@ files:
|
|
390
204
|
- spec/reel/https_server_spec.rb
|
391
205
|
- spec/reel/response/writer_spec.rb
|
392
206
|
- spec/reel/response_spec.rb
|
393
|
-
- spec/reel/unix_server_spec.rb
|
394
207
|
- spec/reel/websocket_spec.rb
|
395
208
|
- spec/spec_helper.rb
|
396
209
|
- spec/support/create_certs.rb
|
397
210
|
- spec/support/example_request.rb
|
398
|
-
- tasks/benchmarks.rake
|
399
211
|
- tasks/rspec.rake
|
400
|
-
- tasks/rubocop.rake
|
401
212
|
homepage: https://github.com/celluloid/reel
|
402
213
|
licenses: []
|
403
214
|
metadata: {}
|
404
|
-
post_install_message:
|
215
|
+
post_install_message:
|
405
216
|
rdoc_options: []
|
406
217
|
require_paths:
|
407
218
|
- lib
|
408
219
|
required_ruby_version: !ruby/object:Gem::Requirement
|
409
220
|
requirements:
|
410
|
-
- -
|
221
|
+
- - ">="
|
411
222
|
- !ruby/object:Gem::Version
|
412
223
|
version: '0'
|
413
224
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
414
225
|
requirements:
|
415
|
-
- -
|
226
|
+
- - ">="
|
416
227
|
- !ruby/object:Gem::Version
|
417
|
-
version:
|
228
|
+
version: '0'
|
418
229
|
requirements: []
|
419
|
-
rubyforge_project:
|
420
|
-
rubygems_version: 2.
|
421
|
-
signing_key:
|
230
|
+
rubyforge_project:
|
231
|
+
rubygems_version: 2.5.1
|
232
|
+
signing_key:
|
422
233
|
specification_version: 4
|
423
|
-
summary: A Reel good
|
424
|
-
test_files:
|
234
|
+
summary: A Reel good HTTP server
|
235
|
+
test_files:
|
236
|
+
- spec/fixtures/example.txt
|
237
|
+
- spec/reel/connection_spec.rb
|
238
|
+
- spec/reel/http_server_spec.rb
|
239
|
+
- spec/reel/https_server_spec.rb
|
240
|
+
- spec/reel/response/writer_spec.rb
|
241
|
+
- spec/reel/response_spec.rb
|
242
|
+
- spec/reel/websocket_spec.rb
|
243
|
+
- spec/spec_helper.rb
|
244
|
+
- spec/support/create_certs.rb
|
245
|
+
- spec/support/example_request.rb
|
data/.gitmodules
DELETED
data/lib/reel/server/unix.rb
DELETED
@@ -1,18 +0,0 @@
|
|
1
|
-
module Reel
|
2
|
-
class Server
|
3
|
-
class UNIX < Server
|
4
|
-
|
5
|
-
# Create a new Reel HTTPS server
|
6
|
-
#
|
7
|
-
# @option options [String] socket path to bind to
|
8
|
-
# @option options [Fixnum] backlog of requests to accept
|
9
|
-
#
|
10
|
-
# @return [Reel::Server::UNIX] Reel UNIX server actor
|
11
|
-
def initialize(socket_path, options={}, &callback)
|
12
|
-
server = Celluloid::IO::UNIXServer.new(socket_path)
|
13
|
-
options[:socket_path] = socket_path
|
14
|
-
super(server, options, &callback)
|
15
|
-
end
|
16
|
-
end
|
17
|
-
end
|
18
|
-
end
|
@@ -1,41 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
require 'net/http'
|
3
|
-
|
4
|
-
unless RUBY_PLATFORM == 'java'
|
5
|
-
|
6
|
-
RSpec.describe Reel::Server::UNIX do
|
7
|
-
let(:endpoint) { URI(example_url) }
|
8
|
-
let(:response_body) { "ohai thar" }
|
9
|
-
|
10
|
-
it 'allows connections over UNIX sockets' do
|
11
|
-
ex = nil
|
12
|
-
|
13
|
-
handler = proc do |connection|
|
14
|
-
begin
|
15
|
-
request = connection.request
|
16
|
-
expect( request.method ).to eq 'GET'
|
17
|
-
connection.respond :ok, self.response_body
|
18
|
-
end
|
19
|
-
end
|
20
|
-
|
21
|
-
Dir::Tmpname.create('reel-sock') do |path|
|
22
|
-
begin
|
23
|
-
server = Reel::Server::UNIX.new(path, &handler)
|
24
|
-
sock = Net::BufferedIO.new Celluloid::IO::UNIXSocket.new(path)
|
25
|
-
request = Net::HTTP::Get.new('/')
|
26
|
-
|
27
|
-
request.exec(sock, '1.1', path)
|
28
|
-
response = Net::HTTPResponse.read_new(sock)
|
29
|
-
response.reading_body(sock, request.response_body_permitted?) { }
|
30
|
-
|
31
|
-
expect(response.body).to eq(self.response_body)
|
32
|
-
ensure
|
33
|
-
server.terminate if server && server.alive?
|
34
|
-
end
|
35
|
-
end
|
36
|
-
|
37
|
-
raise ex if ex
|
38
|
-
end
|
39
|
-
end
|
40
|
-
|
41
|
-
end
|
data/tasks/benchmarks.rake
DELETED
@@ -1,16 +0,0 @@
|
|
1
|
-
require "timeout"
|
2
|
-
|
3
|
-
desc "Run Reel benchmarks"
|
4
|
-
task :benchmark do
|
5
|
-
begin
|
6
|
-
Timeout.timeout(120) do
|
7
|
-
glob = File.expand_path("../../benchmarks/*.rb", __FILE__)
|
8
|
-
Dir[glob].each { |benchmark| load benchmark }
|
9
|
-
end
|
10
|
-
rescue Exception, Timeout::Error => ex
|
11
|
-
puts "ERROR: Couldn't complete benchmark: #{ex.class}: #{ex}"
|
12
|
-
puts " #{ex.backtrace.join("\n ")}"
|
13
|
-
|
14
|
-
exit 1 unless ENV["CI"] # Hax for running benchmarks on Travis
|
15
|
-
end
|
16
|
-
end
|
data/tasks/rubocop.rake
DELETED