unicorn 0.2.2 → 0.2.3

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGELOG CHANGED
@@ -1,3 +1,4 @@
1
+ v0.2.3 - Unlink Tempfiles after use (they were closed, just not unlinked)
1
2
  v0.2.2 - small bug fixes, fix Rack multi-value headers (Set-Cookie:)
2
3
  v0.2.1 - Fix broken Manifest that cause unicorn_rails to not be bundled
3
4
  v0.2.0 - unicorn_rails launcher script.
data/lib/unicorn.rb CHANGED
@@ -106,7 +106,6 @@ module Unicorn
106
106
  @listeners.delete_if do |io|
107
107
  if dead_names.include?(sock_name(io))
108
108
  @io_purgatory.delete_if { |pio| pio.fileno == io.fileno }
109
- destroy_safely(io)
110
109
  true
111
110
  else
112
111
  false
data/lib/unicorn/const.rb CHANGED
@@ -68,7 +68,7 @@ module Unicorn
68
68
  REQUEST_URI='REQUEST_URI'.freeze
69
69
  REQUEST_PATH='REQUEST_PATH'.freeze
70
70
 
71
- UNICORN_VERSION="0.2.2".freeze
71
+ UNICORN_VERSION="0.2.3".freeze
72
72
 
73
73
  UNICORN_TMP_BASE="unicorn".freeze
74
74
 
@@ -25,6 +25,7 @@ module Unicorn
25
25
  @parser.reset
26
26
  @params.clear
27
27
  @body.close rescue nil
28
+ @body.close! rescue nil
28
29
  @body = nil
29
30
  end
30
31
 
@@ -62,13 +62,6 @@ module Unicorn
62
62
  end
63
63
  end
64
64
 
65
- def destroy_safely(io)
66
- if io.respond_to?(:path) && File.stat(io.path).ino == io.stat.ino
67
- File.unlink(io.path) rescue nil
68
- end
69
- io.close rescue nil
70
- end
71
-
72
65
  # creates a new server, socket. address may be a HOST:PORT or
73
66
  # an absolute path to a UNIX socket. address can even be a Socket
74
67
  # object in which case it is immediately returned
@@ -50,6 +50,32 @@ class UploadTest < Test::Unit::TestCase
50
50
  assert_equal @sha1.hexdigest, resp[:sha1]
51
51
  end
52
52
 
53
+ def test_tempfile_unlinked
54
+ spew_path = lambda do |env|
55
+ if orig = env['HTTP_X_OLD_PATH']
56
+ assert orig != env['rack.input'].path
57
+ end
58
+ assert_equal length, env['rack.input'].size
59
+ [ 200, @hdr.merge('X-Tempfile-Path' => env['rack.input'].path), [] ]
60
+ end
61
+ start_server(spew_path)
62
+ sock = TCPSocket.new(@addr, @port)
63
+ sock.syswrite("PUT / HTTP/1.0\r\nContent-Length: #{length}\r\n\r\n")
64
+ @count.times { sock.syswrite(' ' * @bs) }
65
+ path = sock.read[/^X-Tempfile-Path: (\S+)/, 1]
66
+ sock.close
67
+
68
+ # send another request to ensure we hit the next request
69
+ sock = TCPSocket.new(@addr, @port)
70
+ sock.syswrite("PUT / HTTP/1.0\r\nX-Old-Path: #{path}\r\n" \
71
+ "Content-Length: #{length}\r\n\r\n")
72
+ @count.times { sock.syswrite(' ' * @bs) }
73
+ path2 = sock.read[/^X-Tempfile-Path: (\S+)/, 1]
74
+ sock.close
75
+ assert path != path2
76
+
77
+ assert ! File.exist?(path)
78
+ end
53
79
 
54
80
  def test_put_keepalive_truncates_small_overwrite
55
81
  start_server(@sha1_app)
data/unicorn.gemspec CHANGED
@@ -2,11 +2,11 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = %q{unicorn}
5
- s.version = "0.2.2"
5
+ s.version = "0.2.3"
6
6
 
7
7
  s.required_rubygems_version = Gem::Requirement.new(">= 1.2") if s.respond_to? :required_rubygems_version=
8
8
  s.authors = ["Eric Wong"]
9
- s.date = %q{2009-03-22}
9
+ s.date = %q{2009-03-25}
10
10
  s.description = %q{A small fast HTTP library and server for Rack applications.}
11
11
  s.email = %q{normalperson@yhbt.net}
12
12
  s.executables = ["unicorn", "unicorn_rails"]
@@ -20,7 +20,7 @@ Gem::Specification.new do |s|
20
20
  s.rubyforge_project = %q{unicorn}
21
21
  s.rubygems_version = %q{1.3.1}
22
22
  s.summary = %q{A small fast HTTP library and server for Rack applications.}
23
- s.test_files = ["test/unit/test_configurator.rb", "test/unit/test_server.rb", "test/unit/test_upload.rb", "test/unit/test_response.rb", "test/unit/test_http_parser.rb", "test/unit/test_request.rb"]
23
+ s.test_files = ["test/unit/test_configurator.rb", "test/unit/test_response.rb", "test/unit/test_request.rb", "test/unit/test_upload.rb", "test/unit/test_http_parser.rb", "test/unit/test_server.rb"]
24
24
 
25
25
  if s.respond_to? :specification_version then
26
26
  current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: unicorn
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.2
4
+ version: 0.2.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Eric Wong
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-03-22 00:00:00 -07:00
12
+ date: 2009-03-25 00:00:00 -07:00
13
13
  default_executable:
14
14
  dependencies: []
15
15
 
@@ -124,8 +124,8 @@ specification_version: 2
124
124
  summary: A small fast HTTP library and server for Rack applications.
125
125
  test_files:
126
126
  - test/unit/test_configurator.rb
127
- - test/unit/test_server.rb
128
- - test/unit/test_upload.rb
129
127
  - test/unit/test_response.rb
130
- - test/unit/test_http_parser.rb
131
128
  - test/unit/test_request.rb
129
+ - test/unit/test_upload.rb
130
+ - test/unit/test_http_parser.rb
131
+ - test/unit/test_server.rb