[mod_user] add test cases to check handling of encoded ~ as %7E (#2124)

git-svn-id: svn://svn.lighttpd.net/lighttpd/branches/lighttpd-1.4.x@2881 152afb58-edef-0310-8abb-c4023f1b3aa9
svn/tags/lighttpd-1.4.33
Stefan Bühler 10 years ago
parent 12c4a40b28
commit f0a2c0f293

@ -8,7 +8,7 @@ BEGIN {
use strict;
use IO::Socket;
use Test::More tests => 5;
use Test::More tests => 7;
use LightyTest;
my $tf = LightyTest->new();
@ -25,6 +25,13 @@ EOF
$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 404 } ];
ok($tf->handle_http($t) == 0, 'valid user');
$t->{REQUEST} = ( <<EOF
GET /%7Efoobar/ HTTP/1.0
EOF
);
$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 404 } ];
ok($tf->handle_http($t) == 0, 'valid user with url-encoded ~ as %7E');
$t->{REQUEST} = ( <<EOF
GET /~jan HTTP/1.0
EOF
@ -32,6 +39,13 @@ EOF
$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 301, 'Location' => 'http://'.$tf->{HOSTNAME}.':'.$tf->{PORT}.'/~jan/' } ];
ok($tf->handle_http($t) == 0, 'valid user + redirect');
$t->{REQUEST} = ( <<EOF
GET /%7Ejan HTTP/1.0
EOF
);
$t->{RESPONSE} = [ { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 301, 'Location' => 'http://'.$tf->{HOSTNAME}.':'.$tf->{PORT}.'/~jan/' } ];
ok($tf->handle_http($t) == 0, 'valid user with url encoded ~ as %7E + redirect');
$t->{REQUEST} = ( <<EOF
GET /~jan HTTP/1.0
Host: www.example.org

Loading…
Cancel
Save