[PATCH] Tests: clearing of pre-existing Content-Range headers

Eugene Grebenschikov e.grebenshchikov at f5.com
Wed Nov 16 05:55:40 UTC 2022


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-bounces at 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.grebenshchikov at 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 at nginx.org
> To unsubscribe send an email to nginx-devel-leave at nginx.org
> 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: nginx-tests.patch
Type: text/x-diff
Size: 2483 bytes
Desc: not available
URL: <http://mailman.nginx.org/pipermail/nginx-devel/attachments/20221115/dfe5e59e/attachment.bin>


More information about the nginx-devel mailing list