unicorn 3.3.0 → 3.3.1
Sign up to get free protection for your applications and to get access to all the features.
- data/GIT-VERSION-GEN +1 -1
- data/lib/unicorn/const.rb +2 -2
- data/lib/unicorn/http_response.rb +0 -1
- data/lib/unicorn/http_server.rb +1 -0
- data/t/t0018-write-on-close.sh +23 -0
- data/t/write-on-close.ru +11 -0
- data/test/unit/test_response.rb +9 -9
- metadata +6 -4
data/GIT-VERSION-GEN
CHANGED
data/lib/unicorn/const.rb
CHANGED
@@ -7,8 +7,8 @@
|
|
7
7
|
# improve things much compared to constants.
|
8
8
|
module Unicorn::Const
|
9
9
|
|
10
|
-
# The current version of Unicorn, currently 3.3.
|
11
|
-
UNICORN_VERSION = "3.3.
|
10
|
+
# The current version of Unicorn, currently 3.3.1
|
11
|
+
UNICORN_VERSION = "3.3.1"
|
12
12
|
|
13
13
|
# default TCP listen host address (0.0.0.0, all interfaces)
|
14
14
|
DEFAULT_HOST = "0.0.0.0"
|
data/lib/unicorn/http_server.rb
CHANGED
@@ -0,0 +1,23 @@
|
|
1
|
+
#!/bin/sh
|
2
|
+
. ./test-lib.sh
|
3
|
+
t_plan 4 "write-on-close tests for funky response-bodies"
|
4
|
+
|
5
|
+
t_begin "setup and start" && {
|
6
|
+
unicorn_setup
|
7
|
+
unicorn -D -c $unicorn_config write-on-close.ru
|
8
|
+
unicorn_wait_start
|
9
|
+
}
|
10
|
+
|
11
|
+
t_begin "write-on-close response body succeeds" && {
|
12
|
+
test xGoodbye = x"$(curl -sSf http://$listen/)"
|
13
|
+
}
|
14
|
+
|
15
|
+
t_begin "killing succeeds" && {
|
16
|
+
kill $unicorn_pid
|
17
|
+
}
|
18
|
+
|
19
|
+
t_begin "check stderr" && {
|
20
|
+
check_stderr
|
21
|
+
}
|
22
|
+
|
23
|
+
t_done
|
data/t/write-on-close.ru
ADDED
data/test/unit/test_response.rb
CHANGED
@@ -27,7 +27,7 @@ class ResponseTest < Test::Unit::TestCase
|
|
27
27
|
def test_response_headers
|
28
28
|
out = StringIO.new
|
29
29
|
http_response_write(out, 200, {"X-Whatever" => "stuff"}, ["cool"])
|
30
|
-
assert out.closed?
|
30
|
+
assert ! out.closed?
|
31
31
|
|
32
32
|
assert out.length > 0, "output didn't have data"
|
33
33
|
end
|
@@ -35,7 +35,7 @@ class ResponseTest < Test::Unit::TestCase
|
|
35
35
|
def test_response_string_status
|
36
36
|
out = StringIO.new
|
37
37
|
http_response_write(out,'200', {}, [])
|
38
|
-
assert out.closed?
|
38
|
+
assert ! out.closed?
|
39
39
|
assert out.length > 0, "output didn't have data"
|
40
40
|
assert_equal 1, out.string.split(/\r\n/).grep(/^Status: 200 OK/).size
|
41
41
|
end
|
@@ -43,7 +43,7 @@ class ResponseTest < Test::Unit::TestCase
|
|
43
43
|
def test_response_200
|
44
44
|
io = StringIO.new
|
45
45
|
http_response_write(io, 200, {}, [])
|
46
|
-
assert io.closed?
|
46
|
+
assert ! io.closed?
|
47
47
|
assert io.length > 0, "output didn't have data"
|
48
48
|
end
|
49
49
|
|
@@ -51,7 +51,7 @@ class ResponseTest < Test::Unit::TestCase
|
|
51
51
|
code = 400
|
52
52
|
io = StringIO.new
|
53
53
|
http_response_write(io, code, {}, [])
|
54
|
-
assert io.closed?
|
54
|
+
assert ! io.closed?
|
55
55
|
lines = io.string.split(/\r\n/)
|
56
56
|
assert_match(/.* Bad Request$/, lines.first,
|
57
57
|
"wrong default reason phrase")
|
@@ -60,7 +60,7 @@ class ResponseTest < Test::Unit::TestCase
|
|
60
60
|
def test_rack_multivalue_headers
|
61
61
|
out = StringIO.new
|
62
62
|
http_response_write(out,200, {"X-Whatever" => "stuff\nbleh"}, [])
|
63
|
-
assert out.closed?
|
63
|
+
assert ! out.closed?
|
64
64
|
assert_match(/^X-Whatever: stuff\r\nX-Whatever: bleh\r\n/, out.string)
|
65
65
|
end
|
66
66
|
|
@@ -69,7 +69,7 @@ class ResponseTest < Test::Unit::TestCase
|
|
69
69
|
def test_status_header_added
|
70
70
|
out = StringIO.new
|
71
71
|
http_response_write(out,200, {"X-Whatever" => "stuff"}, [])
|
72
|
-
assert out.closed?
|
72
|
+
assert ! out.closed?
|
73
73
|
assert_equal 1, out.string.split(/\r\n/).grep(/^Status: 200 OK/i).size
|
74
74
|
end
|
75
75
|
|
@@ -80,7 +80,7 @@ class ResponseTest < Test::Unit::TestCase
|
|
80
80
|
out = StringIO.new
|
81
81
|
header_hash = {"X-Whatever" => "stuff", 'StaTus' => "666" }
|
82
82
|
http_response_write(out,200, header_hash, [])
|
83
|
-
assert out.closed?
|
83
|
+
assert ! out.closed?
|
84
84
|
assert_equal 1, out.string.split(/\r\n/).grep(/^Status: 200 OK/i).size
|
85
85
|
assert_equal 1, out.string.split(/\r\n/).grep(/^Status:/i).size
|
86
86
|
end
|
@@ -91,7 +91,7 @@ class ResponseTest < Test::Unit::TestCase
|
|
91
91
|
body.rewind
|
92
92
|
out = StringIO.new
|
93
93
|
http_response_write(out,200, {}, body)
|
94
|
-
assert out.closed?
|
94
|
+
assert ! out.closed?
|
95
95
|
assert body.closed?
|
96
96
|
assert_match(expect_body, out.string.split(/\r\n/).last)
|
97
97
|
end
|
@@ -99,7 +99,7 @@ class ResponseTest < Test::Unit::TestCase
|
|
99
99
|
def test_unknown_status_pass_through
|
100
100
|
out = StringIO.new
|
101
101
|
http_response_write(out,"666 I AM THE BEAST", {}, [] )
|
102
|
-
assert out.closed?
|
102
|
+
assert ! out.closed?
|
103
103
|
headers = out.string.split(/\r\n\r\n/).first.split(/\r\n/)
|
104
104
|
assert %r{\AHTTP/\d\.\d 666 I AM THE BEAST\z}.match(headers[0])
|
105
105
|
status = headers.grep(/\AStatus:/i).first
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: unicorn
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 9
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 3
|
8
8
|
- 3
|
9
|
-
-
|
10
|
-
version: 3.3.
|
9
|
+
- 1
|
10
|
+
version: 3.3.1
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Unicorn hackers
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2011-01-
|
18
|
+
date: 2011-01-07 00:00:00 +00:00
|
19
19
|
default_executable:
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|
@@ -270,6 +270,7 @@ files:
|
|
270
270
|
- t/t0015-configurator-internals.sh
|
271
271
|
- t/t0016-trust-x-forwarded-false.sh
|
272
272
|
- t/t0017-trust-x-forwarded-true.sh
|
273
|
+
- t/t0018-write-on-close.sh
|
273
274
|
- t/t0100-rack-input-tests.sh
|
274
275
|
- t/t0116-client_body_buffer_size.sh
|
275
276
|
- t/t0116.ru
|
@@ -281,6 +282,7 @@ files:
|
|
281
282
|
- t/t9000-preread-input.sh
|
282
283
|
- t/test-lib.sh
|
283
284
|
- t/test-rails3.sh
|
285
|
+
- t/write-on-close.ru
|
284
286
|
- test/aggregate.rb
|
285
287
|
- test/benchmark/README
|
286
288
|
- test/benchmark/dd.ru
|