Skip to content

Commit 37c4a69

Browse files
committed
Tests: added proxy_limit_rate test with zero value.
1 parent bc6ba72 commit 37c4a69

File tree

1 file changed

+15
-1
lines changed

1 file changed

+15
-1
lines changed

proxy_limit_rate.t

+15-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ use Test::Nginx qw/ :DEFAULT http_content /;
2222
select STDERR; $| = 1;
2323
select STDOUT; $| = 1;
2424

25-
my $t = Test::Nginx->new()->has(qw/http proxy upstream_keepalive/)->plan(4);
25+
my $t = Test::Nginx->new()->has(qw/http proxy upstream_keepalive/)->plan(6);
2626

2727
$t->write_file_expand('nginx.conf', <<'EOF');
2828
@@ -54,6 +54,13 @@ http {
5454
add_trailer X-Msec $msec;
5555
}
5656
57+
location /unlimited {
58+
proxy_pass http://127.0.0.1:8080/data;
59+
proxy_limit_rate 0;
60+
add_header X-Msec $msec;
61+
add_trailer X-Msec $msec;
62+
}
63+
5764
location /keepalive {
5865
proxy_http_version 1.1;
5966
proxy_set_header Connection "";
@@ -77,6 +84,13 @@ my ($body, $t1, $t2) = get('/');
7784
cmp_ok($t2 - $t1, '>=', 1, 'proxy_limit_rate');
7885
is($body, 'X' x 40000, 'response body');
7986

87+
# unlimited
88+
89+
($body, $t1, $t2) = get('/unlimited');
90+
91+
is($t2 - $t1, 0, 'proxy_limit_rate unlimited');
92+
is($body, 'X' x 40000, 'response body unlimited');
93+
8094
# in case keepalive connection was saved with the delayed flag,
8195
# the read timer used to be a delay timer in the next request
8296

0 commit comments

Comments
 (0)