unicorn 0.5.3 → 0.5.4
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG +1 -0
- data/lib/unicorn/http_request.rb +4 -9
- data/test/unit/test_upload.rb +23 -0
- data/unicorn.gemspec +3 -3
- metadata +7 -7
data/CHANGELOG
CHANGED
data/lib/unicorn/http_request.rb
CHANGED
@@ -87,15 +87,10 @@ module Unicorn
|
|
87
87
|
remain = content_length - http_body.length
|
88
88
|
|
89
89
|
# must read more data to complete body
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
@body = Tempfile.new(Const::UNICORN_TMP_BASE)
|
95
|
-
@body.binmode
|
96
|
-
@body.sync = true
|
97
|
-
@body.syswrite(http_body)
|
98
|
-
end
|
90
|
+
@body = remain < Const::MAX_BODY ? StringIO.new : Tempfile.new('')
|
91
|
+
@body.binmode
|
92
|
+
@body.sync = true
|
93
|
+
@body.syswrite(http_body)
|
99
94
|
|
100
95
|
# Some clients (like FF1.0) report 0 for body and then send a body.
|
101
96
|
# This will probably truncate them but at least the request goes through
|
data/test/unit/test_upload.rb
CHANGED
@@ -50,6 +50,29 @@ class UploadTest < Test::Unit::TestCase
|
|
50
50
|
assert_equal @sha1.hexdigest, resp[:sha1]
|
51
51
|
end
|
52
52
|
|
53
|
+
def test_put_trickle_small
|
54
|
+
@count, @bs = 2, 128
|
55
|
+
start_server(@sha1_app)
|
56
|
+
assert_equal 256, length
|
57
|
+
sock = TCPSocket.new(@addr, @port)
|
58
|
+
hdr = "PUT / HTTP/1.0\r\nContent-Length: #{length}\r\n\r\n"
|
59
|
+
@count.times do
|
60
|
+
buf = @random.sysread(@bs)
|
61
|
+
@sha1.update(buf)
|
62
|
+
hdr << buf
|
63
|
+
sock.syswrite(hdr)
|
64
|
+
hdr = ''
|
65
|
+
sleep 0.6
|
66
|
+
end
|
67
|
+
read = sock.read.split(/\r\n/)
|
68
|
+
assert_equal "HTTP/1.1 200 OK", read[0]
|
69
|
+
resp = eval(read.grep(/^X-Resp: /).first.sub!(/X-Resp: /, ''))
|
70
|
+
assert_equal length, resp[:size]
|
71
|
+
assert_equal 0, resp[:pos]
|
72
|
+
assert_equal @sha1.hexdigest, resp[:sha1]
|
73
|
+
assert_equal StringIO, resp[:class]
|
74
|
+
end
|
75
|
+
|
53
76
|
def test_tempfile_unlinked
|
54
77
|
spew_path = lambda do |env|
|
55
78
|
if orig = env['HTTP_X_OLD_PATH']
|
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.5.
|
5
|
+
s.version = "0.5.4"
|
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-04-
|
9
|
+
s.date = %q{2009-04-23}
|
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/
|
23
|
+
s.test_files = ["test/unit/test_configurator.rb", "test/unit/test_response.rb", "test/unit/test_request.rb", "test/unit/test_signals.rb", "test/unit/test_upload.rb", "test/unit/test_http_parser.rb", "test/unit/test_socket_helper.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.5.
|
4
|
+
version: 0.5.4
|
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-04-
|
12
|
+
date: 2009-04-23 00:00:00 -07:00
|
13
13
|
default_executable:
|
14
14
|
dependencies: []
|
15
15
|
|
@@ -211,11 +211,11 @@ signing_key:
|
|
211
211
|
specification_version: 2
|
212
212
|
summary: A small fast HTTP library and server for Rack applications.
|
213
213
|
test_files:
|
214
|
-
- test/unit/test_request.rb
|
215
|
-
- test/unit/test_http_parser.rb
|
216
|
-
- test/unit/test_server.rb
|
217
|
-
- test/unit/test_response.rb
|
218
214
|
- test/unit/test_configurator.rb
|
219
|
-
- test/unit/
|
215
|
+
- test/unit/test_response.rb
|
216
|
+
- test/unit/test_request.rb
|
220
217
|
- test/unit/test_signals.rb
|
218
|
+
- test/unit/test_upload.rb
|
219
|
+
- test/unit/test_http_parser.rb
|
221
220
|
- test/unit/test_socket_helper.rb
|
221
|
+
- test/unit/test_server.rb
|