Sergey Kandaurov
November 17, 2022 12:36PM
On Tue, Nov 15, 2022 at 09:55:40PM -0800, Eugene Grebenschikov via nginx-devel wrote:
> Hello,
>
> After discussion with Sergey Kandaurov, it was decided to seperate these tests
> into a separate file.
>
[..]

> >
> > 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

> # HG changeset patch
> # User Eugene Grebenschikov <e.grebenshchikov@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
> +}
> +
> +###############################################################################

Good for me.
_______________________________________________
nginx-devel mailing list -- nginx-devel@nginx.org
To unsubscribe send an email to nginx-devel-leave@nginx.org
Subject Author Views Posted

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

Eugene Grebenschikov via nginx-devel 433 October 21, 2022 10:58AM

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

Maxim Dounin 109 October 21, 2022 06:14PM

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

Eugene Grebenschikov via nginx-devel 72 November 16, 2022 12:58AM

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

Sergey Kandaurov 105 November 17, 2022 12:36PM



Sorry, you do not have permission to post/reply in this forum.

Online Users

Guests: 208
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready