reel 0.4.0.pre4 → 0.4.0.pre5
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/.rspec +1 -0
- data/CHANGES.md +1 -1
- data/lib/reel/connection.rb +8 -7
- data/lib/reel/response.rb +1 -1
- data/lib/reel/response_writer.rb +10 -4
- data/lib/reel/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 44aa1cfa32bf4e362a459a5f18377ac56db1f8c7
|
4
|
+
data.tar.gz: bbf8201bd08d1f803804bfde3857cea67b66d7fb
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5fe52aa183298afe122e513a32782b04249af3024aedef8c30ed5ab59949bf73fd2b33341d957d2f39800c4b0b3e78f83ef9a279e9916ae58f9d7f585c64ed1a
|
7
|
+
data.tar.gz: 185e444d3044b97c939f94d8943039b3c5fcd6b5adb95a00c6cc044e8c003a489e9842270d4b95619b5fbd5472684134b839e12a061cb315729b8b82918dffc5
|
data/.rspec
CHANGED
data/CHANGES.md
CHANGED
data/lib/reel/connection.rb
CHANGED
@@ -41,13 +41,6 @@ module Reel
|
|
41
41
|
self
|
42
42
|
end
|
43
43
|
|
44
|
-
# Reset the current request state
|
45
|
-
def reset_request(state = :ready)
|
46
|
-
@request_state = state
|
47
|
-
@current_request = nil
|
48
|
-
@parser.reset
|
49
|
-
end
|
50
|
-
|
51
44
|
def readpartial(size = @buffer_size)
|
52
45
|
raise StateError, "can't read in the '#{@request_state}' request state" unless @request_state == :ready
|
53
46
|
@parser.readpartial(size)
|
@@ -171,5 +164,13 @@ module Reel
|
|
171
164
|
raise StateError, "socket has already been hijacked" unless @socket
|
172
165
|
@socket
|
173
166
|
end
|
167
|
+
|
168
|
+
# Reset the current request state
|
169
|
+
def reset_request(state = :ready)
|
170
|
+
@request_state = state
|
171
|
+
@current_request = nil
|
172
|
+
@parser.reset
|
173
|
+
end
|
174
|
+
private :reset_request
|
174
175
|
end
|
175
176
|
end
|
data/lib/reel/response.rb
CHANGED
data/lib/reel/response_writer.rb
CHANGED
@@ -1,8 +1,8 @@
|
|
1
1
|
module Reel
|
2
2
|
class Response
|
3
3
|
class Writer
|
4
|
-
|
5
4
|
CRLF = "\r\n"
|
5
|
+
|
6
6
|
def initialize(socket, connection)
|
7
7
|
@socket = socket
|
8
8
|
@connection = connection
|
@@ -13,6 +13,8 @@ module Reel
|
|
13
13
|
chunk_header = chunk.bytesize.to_s(16)
|
14
14
|
@socket << chunk_header + CRLF
|
15
15
|
@socket << chunk + CRLF
|
16
|
+
rescue IOError, Errno::EPIPE, Errno::ECONNRESET => ex
|
17
|
+
raise Reel::SocketError, ex.to_s
|
16
18
|
end
|
17
19
|
|
18
20
|
# Finish the response and reset the response state to header
|
@@ -32,13 +34,17 @@ module Reel
|
|
32
34
|
@socket << response.body
|
33
35
|
when IO
|
34
36
|
begin
|
35
|
-
if
|
36
|
-
IO.copy_stream(response.body, @socket)
|
37
|
-
else
|
37
|
+
if defined?(JRUBY_VERSION) && JRUBY_VERSION <= "1.6.7"
|
38
38
|
# JRuby 1.6.7 doesn't support IO.copy_stream :(
|
39
39
|
while data = response.body.read(4096)
|
40
40
|
@socket << data
|
41
41
|
end
|
42
|
+
else
|
43
|
+
# Use OS sendfile via IO.copy_stream
|
44
|
+
# FIXME: should use Celluloid::IO.copy_stream and allow these
|
45
|
+
# calls to be multiplexed through Celluloid::IO's reactor
|
46
|
+
# Until then we need a thread for each of these responses
|
47
|
+
Celluloid.defer { IO.copy_stream(response.body, @socket) }
|
42
48
|
end
|
43
49
|
ensure
|
44
50
|
response.body.close
|
data/lib/reel/version.rb
CHANGED
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.4.0.
|
4
|
+
version: 0.4.0.pre5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tony Arcieri
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-09-
|
11
|
+
date: 2013-09-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: celluloid
|