unicorn 0.2.2 → 0.2.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/CHANGELOG +1 -0
- data/lib/unicorn.rb +0 -1
- data/lib/unicorn/const.rb +1 -1
- data/lib/unicorn/http_request.rb +1 -0
- data/lib/unicorn/socket.rb +0 -7
- data/test/unit/test_upload.rb +26 -0
- data/unicorn.gemspec +3 -3
- metadata +5 -5
data/CHANGELOG
CHANGED
data/lib/unicorn.rb
CHANGED
data/lib/unicorn/const.rb
CHANGED
data/lib/unicorn/http_request.rb
CHANGED
data/lib/unicorn/socket.rb
CHANGED
@@ -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
|
data/test/unit/test_upload.rb
CHANGED
@@ -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.
|
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-
|
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/
|
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.
|
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-
|
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
|