Changeset 1257:05b2033f5377 in nginx-tests


Ignore:
Timestamp:
12/06/17 16:31:20 (9 days ago)
Author:
Sergey Kandaurov <pluknet@…>
Branch:
default
Message:

Tests: msie_refresh generic tests.

File:
1 moved

Legend:

Unmodified
Added
Removed
  • msie_refresh.t

    r1251 r1257  
    44# (C) Nginx, Inc.
    55
    6 # Test for msie_refresh in subrequests.
     6# Test for msie_refresh.
    77
    88###############################################################################
     
    2323select STDOUT; $| = 1;
    2424
    25 my $t = Test::Nginx->new()->has(qw/http rewrite ssi/)->plan(1)
     25my $t = Test::Nginx->new()->has(qw/http rewrite ssi/)->plan(5)
    2626        ->write_file_expand('nginx.conf', <<'EOF');
    2727
     
    4040        server_name  localhost;
    4141
     42        msie_refresh on;
     43
    4244        location / {
     45            return 301 text;
     46        }
     47
     48        location /space {
     49            return 301 "space ";
     50        }
     51
     52        location /error_page {
     53            return 301;
     54            error_page 301 text;
     55        }
     56
     57        location /off {
     58            msie_refresh off;
     59            return 301 text;
     60        }
     61
     62        location /ssi {
    4363            ssi on;
    44         }
    45         location /ssi {
    46             msie_refresh on;
    47             return 301;
    4864        }
    4965    }
     
    5268EOF
    5369
    54 $t->write_file('index.html', 'X<!--#include virtual="/ssi.html" -->X');
     70$t->write_file('ssi.html', 'X<!--#include virtual="/" -->X');
    5571$t->run();
    5672
    5773###############################################################################
    5874
    59 my $r = get('/', 'User-Agent: MSIE foo');
    60 unlike($r, qr/\x0d\x0a?0\x0d\x0a?\x0d\x0a?\w/, 'only final chunk');
     75like(get('/'), qr/Refresh.*URL=text"/, 'msie refresh');
     76like(get('/space'), qr/URL=space%20"/, 'msie refresh escaped url');
     77like(get('/error_page'), qr/URL=text"/, 'msie refresh error page');
     78
     79unlike(get('/off'), qr/Refresh/, 'msie refresh disabled');
     80
     81unlike(get('/ssi.html'), qr/^0\x0d\x0a?\x0d\x0a?\w/m, 'only final chunk');
    6182
    6283###############################################################################
     
    6889Host: localhost
    6990Connection: close
    70 $extra
     91User-Agent: MSIE foo
    7192
    7293EOF
Note: See TracChangeset for help on using the changeset viewer.