# HG changeset patch # User Eugene Grebenschikov <e.grebenshchi...@f5.com> # Date 1666307094 25200 # Thu Oct 20 16:04:54 2022 -0700 # Node ID 20ef9719316bdee06a6faf731bf76c1777bc98ba # Parent 4f282294d8aec6fc20d6d68690bdf800629ad606 Tests: clearing of pre-existing Content-Range headers
diff -r 4f282294d8ae -r 20ef9719316b range.t --- a/range.t Wed Oct 19 10:27:19 2022 -0700 +++ b/range.t Thu Oct 20 16:04:54 2022 -0700 @@ -21,7 +21,7 @@ select STDERR; $| = 1; select STDOUT; $| = 1; -my $t = Test::Nginx->new()->has(qw/http charset/)->plan(41); +my $t = Test::Nginx->new()->has(qw/http charset proxy cache/)->plan(44); $t->write_file_expand('nginx.conf', <<'EOF'); @@ -39,6 +39,9 @@ 58 59; # X -> Y } + proxy_cache_path %%TESTDIR%%/cache levels=1:2 + keys_zone=NAME:1m; + server { listen 127.0.0.1:8080; server_name localhost; @@ -55,6 +58,18 @@ location /t4.html { max_ranges 0; } + + location /t5.html { + proxy_pass http://127.0.0.1:8080/stub; + proxy_cache NAME; + proxy_cache_valid 200 1m; + } + + location /stub { + add_header Content-Range stub; + add_header Accept-Ranges bytes; + return 200 "SEE-THIS"; + } } } @@ -154,6 +169,20 @@ unlike(http_get_range('/t4.html', 'Range: bytes=0-9'), qr/ 206 /, 'max_ranges zero'); +# clearing of pre-existing Content-Range headers + +TODO: { +local $TODO = 'not yet' unless $t->has_version('1.23.1'); + +like(http_get_range('/t5.html', 'Range: bytes=0-4'), + qr/ 206 (?!.*stub)/s, 'content range cleared - range request'); +like(http_get_range('/t5.html', 'Range: bytes=0-2,4-'), + qr/ 206 (?!.*stub)/s, 'content range cleared - multipart'); +like(http_get_range('/t5.html', 'Range: bytes=1000-'), + qr/ 416 (?!.*stub)/s, 'content range cleared - not satisfable'); + +} + ############################################################################### sub http_get_range {
_______________________________________________ nginx-devel mailing list -- nginx-devel@nginx.org To unsubscribe send an email to nginx-devel-le...@nginx.org