Mercurial > hg > nginx-tests
diff proxy_extra_data.t @ 1638:6128590b0d46
Tests: tests for "zero size buf" alerts in unbuffered proxying.
Starting with nginx 1.19.1, non-buffered simple proxying of responses
with expected length 0 but some extra data might result in zero size
buffers being generated and "zero size buf" alerts in writer (ticket #2117).
Tests for a similar bug in FastCGI proxying are in 1586:e145509cc6eb.
author | Maxim Dounin <mdounin@mdounin.ru> |
---|---|
date | Mon, 11 Jan 2021 21:32:34 +0300 |
parents | 463d6863d360 |
children | 6c323c672a86 |
line wrap: on
line diff
--- a/proxy_extra_data.t Tue Dec 29 20:21:18 2020 +0300 +++ b/proxy_extra_data.t Mon Jan 11 21:32:34 2021 +0300 @@ -23,7 +23,7 @@ select STDOUT; $| = 1; my $t = Test::Nginx->new() - ->has(qw/http proxy cache rewrite addition/)->plan(20) + ->has(qw/http proxy cache rewrite addition/)->plan(22) ->write_file_expand('nginx.conf', <<'EOF'); %%TEST_GLOBALS%% @@ -131,6 +131,26 @@ like(http_get('/head/short'), qr/SEE-THIS(?!.*:after)/s, 'head too short cached'); + +# "zero size buf" alerts (ticket #2117) + +TODO: { +local $TODO = 'not yet' unless $t->has_version('1.19.1'); + +like(http_get('/zero'), qr/200 OK(?!.*NOT-THIS)/s, 'zero size'); + +} + +TODO: { +local $TODO = 'not yet'; + +like(http_get('/unbuf/zero'), qr/200 OK(?!.*NOT-THIS)/s, + 'unbuffered zero size'); + +} + +$t->todo_alerts() if $t->has_version('1.19.1'); + ############################################################################### sub http_daemon { @@ -168,6 +188,12 @@ $c->print("Content-Length: 8\n\n"); $c->print("SEE-THIS-BUT-NOT-THIS\n"); + } elsif ($uri eq '/zero') { + $c->print("HTTP/1.1 200 OK\n"); + $c->print("Content-Type: text/html\n"); + $c->print("Content-Length: 0\n\n"); + $c->print("NOT-THIS\n"); + } elsif ($uri eq '/short') { $c->print("HTTP/1.1 200 OK\n"); $c->print("Content-Type: text/html\n");