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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: d60dfb15b20ee1fecdb60f7b1c5a316e846e85e1
4
- data.tar.gz: fd4ae6782aaae4aa8f546e80c1bfa8612311b07a
3
+ metadata.gz: 44aa1cfa32bf4e362a459a5f18377ac56db1f8c7
4
+ data.tar.gz: bbf8201bd08d1f803804bfde3857cea67b66d7fb
5
5
  SHA512:
6
- metadata.gz: 10db5d35285758e25858c79d15ce4811d61dd8695879bc10dcfbc4ea15dd1e22a6f76faa2b369c417f2cc0494067a7288b41f4c67e6af8e4377ad546849b9852
7
- data.tar.gz: a433060b188c505b934f7d7a6a46082ced480df6119c59a6fc3a951afb7afe6c4d694a2da1b344e2b11162692304ccf6fce28cf11b95aaf04d06665143329717
6
+ metadata.gz: 5fe52aa183298afe122e513a32782b04249af3024aedef8c30ed5ab59949bf73fd2b33341d957d2f39800c4b0b3e78f83ef9a279e9916ae58f9d7f585c64ed1a
7
+ data.tar.gz: 185e444d3044b97c939f94d8943039b3c5fcd6b5adb95a00c6cc044e8c003a489e9842270d4b95619b5fbd5472684134b839e12a061cb315729b8b82918dffc5
data/.rspec CHANGED
@@ -2,3 +2,4 @@
2
2
  --format documentation
3
3
  --backtrace
4
4
  --default_path spec
5
+ --order random
data/CHANGES.md CHANGED
@@ -1,4 +1,4 @@
1
- 0.4.0.pre4
1
+ 0.4.0.pre5
2
2
  ----------
3
3
  * Rack adapter moved to the reel-rack project
4
4
  * Pipelining support
@@ -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
@@ -17,7 +17,7 @@ module Reel
17
17
  self.status = status
18
18
 
19
19
  if body_or_headers.is_a?(Hash)
20
- headers = body_or_headers
20
+ headers = body_or_headers.dup
21
21
  @body = body
22
22
  else
23
23
  headers = {}
@@ -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 !defined?(JRUBY_VERSION)
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
@@ -1,4 +1,4 @@
1
1
  module Reel
2
- VERSION = "0.4.0.pre4"
2
+ VERSION = "0.4.0.pre5"
3
3
  CODENAME = "Garbo"
4
4
  end
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.pre4
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-06 00:00:00.000000000 Z
11
+ date: 2013-09-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: celluloid