Checkuser case unsensitive for URL only & Improve unit test (1667)
This commit is contained in:
parent
165c59c882
commit
f1cb8d236e
|
@ -282,14 +282,14 @@ sub display {
|
||||||
sub _urlFormat {
|
sub _urlFormat {
|
||||||
my ( $self, $url ) = @_;
|
my ( $self, $url ) = @_;
|
||||||
|
|
||||||
$url = 'http://' . $url unless ( $url =~ m#^https?://[^/]*.*# );
|
$url = 'http://' . $url unless ( $url =~ m#^https?://[^/]*.*#i );
|
||||||
my ( $proto, $vhost, $appuri ) = $url =~ m#^(https?://)([^/]*)(.*)#;
|
my ( $proto, $vhost, $appuri ) = $url =~ m#^(https?://)([^/]*)(.*)#i;
|
||||||
my ($port) = $vhost =~ m#^.+(:\d+)$#;
|
my ($port) = $vhost =~ m#^.+(:\d+)$#;
|
||||||
$port ||= '';
|
$port ||= '';
|
||||||
$vhost =~ s/:\d+$//;
|
$vhost =~ s/:\d+$//;
|
||||||
$vhost .= $self->conf->{domain} unless ( $vhost =~ /\./ );
|
$vhost .= $self->conf->{domain} unless ( $vhost =~ /\./ );
|
||||||
$appuri ||= '/';
|
#$appuri ||= '/';
|
||||||
return "$proto$vhost$port$appuri";
|
return lc ("$proto$vhost$port") . "$appuri";
|
||||||
}
|
}
|
||||||
|
|
||||||
sub _userDatas {
|
sub _userDatas {
|
||||||
|
|
|
@ -123,7 +123,7 @@ count(1);
|
||||||
|
|
||||||
# Request with good VH & user
|
# Request with good VH & user
|
||||||
$query =~
|
$query =~
|
||||||
s/url=http%3A%2F%2Ftry.example.com/url=http%3A%2F%2Ftest1.example.com/;
|
s#url=http%3A%2F%2Ftry.example.com#url=hTTp%3A%2F%2FTest1.exAmple.cOm/UriTesT#;
|
||||||
|
|
||||||
ok(
|
ok(
|
||||||
$res = $client->_post(
|
$res = $client->_post(
|
||||||
|
@ -141,7 +141,7 @@ count(1);
|
||||||
expectForm( $res, undef, '/checkuser', 'user', 'url' );
|
expectForm( $res, undef, '/checkuser', 'user', 'url' );
|
||||||
ok( $res->[2]->[0] =~ m%<span trspan="checkUser">%, 'Found trspan="checkUser"' )
|
ok( $res->[2]->[0] =~ m%<span trspan="checkUser">%, 'Found trspan="checkUser"' )
|
||||||
or explain( $res->[2]->[0], 'trspan="checkUser"' );
|
or explain( $res->[2]->[0], 'trspan="checkUser"' );
|
||||||
ok( $res->[2]->[0] =~ m%value="http://test1.example.com/"%, 'Found well formatted url' )
|
ok( $res->[2]->[0] =~ m%value="http://test1.example.com/UriTesT"%, 'Found well formatted url' )
|
||||||
or explain( $res->[2]->[0], 'Well formatted url' );
|
or explain( $res->[2]->[0], 'Well formatted url' );
|
||||||
count(2);
|
count(2);
|
||||||
|
|
||||||
|
@ -178,7 +178,7 @@ count(11);
|
||||||
|
|
||||||
# Request with short VH url & user
|
# Request with short VH url & user
|
||||||
$query =~
|
$query =~
|
||||||
s/url=http%3A%2F%2Ftest1.example.com/url=http%3A%2F%2Ftest1:1234/;
|
s#url=http%3A%2F%2Ftest1.example.com%2FUriTesT#url=http%3A%2F%2Ftest1:1234#;
|
||||||
|
|
||||||
ok(
|
ok(
|
||||||
$res = $client->_post(
|
$res = $client->_post(
|
||||||
|
@ -196,7 +196,7 @@ count(1);
|
||||||
expectForm( $res, undef, '/checkuser', 'user', 'url' );
|
expectForm( $res, undef, '/checkuser', 'user', 'url' );
|
||||||
ok( $res->[2]->[0] =~ m%<span trspan="checkUser">%, 'Found trspan="checkUser"' )
|
ok( $res->[2]->[0] =~ m%<span trspan="checkUser">%, 'Found trspan="checkUser"' )
|
||||||
or explain( $res->[2]->[0], 'trspan="checkUser"' );
|
or explain( $res->[2]->[0], 'trspan="checkUser"' );
|
||||||
ok( $res->[2]->[0] =~ m%value="http://test1.example.com:1234/"%, 'Found well formatted url' )
|
ok( $res->[2]->[0] =~ m%value="http://test1.example.com:1234"%, 'Found well formatted url' )
|
||||||
or explain( $res->[2]->[0], 'Well formatted url' );
|
or explain( $res->[2]->[0], 'Well formatted url' );
|
||||||
count(2);
|
count(2);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user