Hello, After discussion with Sergey Kandaurov, it was decided to seperate these tests into a separate file.
On Sat, Oct 22, 2022 at 01:12:38AM +0300, Maxim Dounin wrote: > EXTERNAL MAIL: nginx-devel-boun...@nginx.org > > Hello! > > On Fri, Oct 21, 2022 at 07:55:34AM -0700, Eugene Grebenschikov via > nginx-devel wrote: > > > # 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 > > https://nam02.safelinks.protection.outlook.com/?url=http%3A%2F%2F127.0.0.1%3A8080%2Fstub&data=05%7C01%7CE.Grebenshchikov%40F5.com%7C75b12c2462eb4c66e65a08dab3b17cfc%7Cdd3dfd2f6a3b40d19be0bf8327d81c50%7C0%7C0%7C638019872151212686%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=BREK%2FOZHJwWoZwZvFBV4hvZVgh1tK9Fi0QwkeiO5QB4%3D&reserved=0; > > + 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 { > > It might be a good idea to keep this separate from the basic range > filter tests. E.g., in a separate file, similarly to > range_charset.t tests. Or in a generic test file for tests with > proxying, that is, combined with range_charset.t. > > This approach ensures that even a stripped-down nginx version, > such as one compiled with "--without-http_proxy_module", can be > properly tested by the test suite. > > -- > Maxim Dounin > https://nam02.safelinks.protection.outlook.com/?url=http%3A%2F%2Fmdounin.ru%2F&data=05%7C01%7CE.Grebenshchikov%40F5.com%7C75b12c2462eb4c66e65a08dab3b17cfc%7Cdd3dfd2f6a3b40d19be0bf8327d81c50%7C0%7C0%7C638019872151369224%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=fLPhy9hfvrkq9KOGYN8hEKo7015dkHE1jxZ2gb6pq3k%3D&reserved=0 > _______________________________________________ > nginx-devel mailing list -- nginx-devel@nginx.org > To unsubscribe send an email to nginx-devel-le...@nginx.org >
# HG changeset patch # User Eugene Grebenschikov <e.grebenshchi...@f5.com> # Date 1668577517 28800 # Tue Nov 15 21:45:17 2022 -0800 # Node ID f9be09ba3198568642afd5107e0ab40faa3b3c11 # Parent 01fcc82a435aedd41ed3c23dbf7252371652cc7a Tests: clearing of pre-existing Content-Range headers. diff -r 01fcc82a435a -r f9be09ba3198 range_clearing.t --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/range_clearing.t Tue Nov 15 21:45:17 2022 -0800 @@ -0,0 +1,87 @@ +#!/usr/bin/perl + +# (C) Eugene Grebenschikov +# (C) Sergey Kandaurov +# (C) Nginx, Inc. + +# Tests for clearing of pre-existing Content-Range headers. + +############################################################################### + +use warnings; +use strict; + +use Test::More; + +BEGIN { use FindBin; chdir($FindBin::Bin); } + +use lib 'lib'; +use Test::Nginx; + +############################################################################### + +select STDERR; $| = 1; +select STDOUT; $| = 1; + +my $t = Test::Nginx->new()->has(qw/http rewrite proxy cache/) + ->write_file_expand('nginx.conf', <<'EOF'); + +%%TEST_GLOBALS%% + +daemon off; + +events { +} + +http { + %%TEST_GLOBALS_HTTP%% + + proxy_cache_path %%TESTDIR%%/cache levels=1:2 keys_zone=NAME:1m; + + server { + listen 127.0.0.1:8080; + server_name localhost; + + location / { + 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"; + } + } +} + +EOF + +$t->run()->plan(3); + +############################################################################### + +local $TODO = 'not yet' unless $t->has_version('1.23.1'); + +like(http_get_range('/', 'Range: bytes=0-4'), + qr/ 206 (?!.*stub)/s, 'content range cleared - range request'); +like(http_get_range('/', 'Range: bytes=0-2,4-'), + qr/ 206 (?!.*stub)/s, 'content range cleared - multipart'); +like(http_get_range('/', 'Range: bytes=1000-'), + qr/ 416 (?!.*stub)/s, 'content range cleared - not satisfable'); + +############################################################################### + +sub http_get_range { + my ($url, $extra) = @_; + return http(<<EOF); +GET $url HTTP/1.1 +Host: localhost +Connection: close +$extra + +EOF +} + +###############################################################################
_______________________________________________ nginx-devel mailing list -- nginx-devel@nginx.org To unsubscribe send an email to nginx-devel-le...@nginx.org