1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
|
--- a/test/unit/test_tee_input.rb 2012-12-27 16:58:26.363046370 -0500
+++ b/test/unit/test_tee_input.rb 2012-12-27 16:57:47.608044611 -0500
@@ -4,7 +4,7 @@
require 'digest/sha1'
require 'unicorn'
-class TeeInput < Unicorn::TeeInput
+class MyTeeInput < Unicorn::TeeInput
attr_accessor :tmp, :len
end
@@ -31,7 +31,7 @@
def test_gets_long
r = init_request("hello", 5 + (4096 * 4 * 3) + "#$/foo#$/".size)
- ti = TeeInput.new(@rd, r)
+ ti = MyTeeInput.new(@rd, r)
status = line = nil
pid = fork {
@rd.close
@@ -52,7 +52,7 @@
def test_gets_short
r = init_request("hello", 5 + "#$/foo".size)
- ti = TeeInput.new(@rd, r)
+ ti = MyTeeInput.new(@rd, r)
status = line = nil
pid = fork {
@rd.close
@@ -71,7 +71,7 @@
def test_small_body
r = init_request('hello')
- ti = TeeInput.new(@rd, r)
+ ti = MyTeeInput.new(@rd, r)
assert_equal 0, @parser.content_length
assert @parser.body_eof?
assert_equal StringIO, ti.tmp.class
@@ -85,7 +85,7 @@
def test_read_with_buffer
r = init_request('hello')
- ti = TeeInput.new(@rd, r)
+ ti = MyTeeInput.new(@rd, r)
buf = ''
rv = ti.read(4, buf)
assert_equal 'hell', rv
@@ -100,7 +100,7 @@
def test_big_body
r = init_request('.' * Unicorn::Const::MAX_BODY << 'a')
- ti = TeeInput.new(@rd, r)
+ ti = MyTeeInput.new(@rd, r)
assert_equal 0, @parser.content_length
assert @parser.body_eof?
assert_kind_of File, ti.tmp
@@ -112,7 +112,7 @@
a, b = 300, 3
r = init_request('.' * b, 300)
assert_equal 300, @parser.content_length
- ti = TeeInput.new(@rd, r)
+ ti = MyTeeInput.new(@rd, r)
pid = fork {
@wr.write('.' * 197)
sleep 1 # still a *potential* race here that would make the test moot...
@@ -126,7 +126,7 @@
def test_big_body_multi
r = init_request('.', Unicorn::Const::MAX_BODY + 1)
- ti = TeeInput.new(@rd, r)
+ ti = MyTeeInput.new(@rd, r)
assert_equal Unicorn::Const::MAX_BODY, @parser.content_length
assert ! @parser.body_eof?
assert_kind_of File, ti.tmp
@@ -165,7 +165,7 @@
@wr.write("0\r\n\r\n")
}
@wr.close
- ti = TeeInput.new(@rd, @parser)
+ ti = MyTeeInput.new(@rd, @parser)
assert_nil @parser.content_length
assert_nil ti.len
assert ! @parser.body_eof?
@@ -204,7 +204,7 @@
end
@wr.write("0\r\n\r\n")
}
- ti = TeeInput.new(@rd, @parser)
+ ti = MyTeeInput.new(@rd, @parser)
assert_nil @parser.content_length
assert_nil ti.len
assert ! @parser.body_eof?
@@ -234,7 +234,7 @@
@wr.write("Hello: World\r\n\r\n")
}
@wr.close
- ti = TeeInput.new(@rd, @parser)
+ ti = MyTeeInput.new(@rd, @parser)
assert_nil @parser.content_length
assert_nil ti.len
assert ! @parser.body_eof?
@@ -256,7 +256,7 @@
assert_equal "", buf
@wr.write("9\r\nabcde")
- ti = TeeInput.new(@rd, @parser)
+ ti = MyTeeInput.new(@rd, @parser)
assert_nil @parser.content_length
assert_equal "abcde", ti.read(9)
assert ! @parser.body_eof?
|