comparison proxy_unfinished.t @ 397:847ea345becb

Tests: removed TODO and try_run() checks for legacy versions.
author Sergey Kandaurov <pluknet@nginx.com>
date Mon, 05 May 2014 11:46:01 +0400
parents 915ef26ac6eb
children 2cd00179f4b2
comparison
equal deleted inserted replaced
396:5eb0df61f371 397:847ea345becb
96 ############################################################################### 96 ###############################################################################
97 97
98 http_get('/cache/length'); 98 http_get('/cache/length');
99 like(http_get('/cache/length'), qr/MISS/, 'unfinished not cached'); 99 like(http_get('/cache/length'), qr/MISS/, 'unfinished not cached');
100 100
101 TODO: {
102 local $TODO = 'not yet' unless $t->has_version('1.5.3');
103
104 # chunked encoding has enough information to don't cache a response, 101 # chunked encoding has enough information to don't cache a response,
105 # much like with Content-Length available 102 # much like with Content-Length available
106 103
107 http_get('/cache/chunked'); 104 http_get('/cache/chunked');
108 like(http_get('/cache/chunked'), qr/MISS/, 'unfinished chunked'); 105 like(http_get('/cache/chunked'), qr/MISS/, 'unfinished chunked');
109
110 }
111
112 TODO: {
113 local $TODO = 'not yet' unless $t->has_version('1.5.3');
114 106
115 # make sure there is no final chunk in unfinished responses 107 # make sure there is no final chunk in unfinished responses
116 108
117 like(http_get_11('/length'), qr/unfinished(?!.*\x0d\x0a?0\x0d\x0a?)/s, 109 like(http_get_11('/length'), qr/unfinished(?!.*\x0d\x0a?0\x0d\x0a?)/s,
118 'length no final chunk'); 110 'length no final chunk');
119 like(http_get_11('/chunked'), qr/unfinished(?!.*\x0d\x0a?0\x0d\x0a?)/s, 111 like(http_get_11('/chunked'), qr/unfinished(?!.*\x0d\x0a?0\x0d\x0a?)/s,
120 'chunked no final chunk'); 112 'chunked no final chunk');
121 113
122 }
123
124 # but there is final chunk in complete responses 114 # but there is final chunk in complete responses
125 115
126 like(http_get_11('/length/ok'), qr/finished.*\x0d\x0a?0\x0d\x0a?/s, 116 like(http_get_11('/length/ok'), qr/finished.*\x0d\x0a?0\x0d\x0a?/s,
127 'length final chunk'); 117 'length final chunk');
128 like(http_get_11('/chunked/ok'), qr/finished.*\x0d\x0a?0\x0d\x0a?/s, 118 like(http_get_11('/chunked/ok'), qr/finished.*\x0d\x0a?0\x0d\x0a?/s,
129 'chunked final chunk'); 119 'chunked final chunk');
130 120
131 TODO: {
132 local $TODO = 'not yet' unless $t->has_version('1.5.3');
133
134 # the same with proxy_buffering set to off 121 # the same with proxy_buffering set to off
135 122
136 like(http_get_11('/un/length'), qr/unfinished(?!.*\x0d\x0a?0\x0d\x0a?)/s, 123 like(http_get_11('/un/length'), qr/unfinished(?!.*\x0d\x0a?0\x0d\x0a?)/s,
137 'unbuffered length no final chunk'); 124 'unbuffered length no final chunk');
138 like(http_get_11('/un/chunked'), qr/unfinished(?!.*\x0d\x0a?0\x0d\x0a?)/s, 125 like(http_get_11('/un/chunked'), qr/unfinished(?!.*\x0d\x0a?0\x0d\x0a?)/s,
139 'unbuffered chunked no final chunk'); 126 'unbuffered chunked no final chunk');
140 127
141 }
142
143 like(http_get_11('/un/length/ok'), qr/finished.*\x0d\x0a?0\x0d\x0a?/s, 128 like(http_get_11('/un/length/ok'), qr/finished.*\x0d\x0a?0\x0d\x0a?/s,
144 'unbuffered length final chunk'); 129 'unbuffered length final chunk');
145 like(http_get_11('/un/chunked/ok'), qr/finished.*\x0d\x0a?0\x0d\x0a?/s, 130 like(http_get_11('/un/chunked/ok'), qr/finished.*\x0d\x0a?0\x0d\x0a?/s,
146 'unbuffered chunked final chunk'); 131 'unbuffered chunked final chunk');
147 132
150 like(http_get('/big', sleep => 0.1), qr/unfinished/s, 'big unfinished'); 135 like(http_get('/big', sleep => 0.1), qr/unfinished/s, 'big unfinished');
151 like(http_get('/big/ok', sleep => 0.1), qr/finished/s, 'big finished'); 136 like(http_get('/big/ok', sleep => 0.1), qr/finished/s, 'big finished');
152 like(http_get('/un/big', sleep => 0.1), qr/unfinished/s, 'big unfinished un'); 137 like(http_get('/un/big', sleep => 0.1), qr/unfinished/s, 'big unfinished un');
153 like(http_get('/un/big/ok', sleep => 0.1), qr/finished/s, 'big finished un'); 138 like(http_get('/un/big/ok', sleep => 0.1), qr/finished/s, 'big finished un');
154 139
155 TODO: {
156 local $TODO = 'not yet' unless $t->has_version('1.5.3');
157
158 # if disk buffering fails for some reason, there should be 140 # if disk buffering fails for some reason, there should be
159 # no final chunk 141 # no final chunk
160 142
161 chmod(0000, $t->testdir() . '/proxy_temp'); 143 chmod(0000, $t->testdir() . '/proxy_temp');
162 like(http_get_11('/proxy/big.html', sleep => 0.5), 144 like(http_get_11('/proxy/big.html', sleep => 0.5),
163 qr/X(?!.*\x0d\x0a?0\x0d\x0a?)|finished/s, 'no proxy temp'); 145 qr/X(?!.*\x0d\x0a?0\x0d\x0a?)|finished/s, 'no proxy temp');
164
165 }
166 146
167 ############################################################################### 147 ###############################################################################
168 148
169 sub http_get_11 { 149 sub http_get_11 {
170 my ($uri, %extra) = @_; 150 my ($uri, %extra) = @_;