Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
small optimization
  • Loading branch information
kraih committed Nov 25, 2012
1 parent 9fce95f commit 7761eaa
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/Mojo/URL.pm
Expand Up @@ -35,7 +35,7 @@ sub authority {
my $userinfo = $self->userinfo;
$authority .= url_escape($userinfo, '^A-Za-z0-9\-._~!$&\'()*+,;=:') . '@'
if $userinfo;
$authority .= lc($self->ihost || '');
$authority .= $self->ihost // '';
if (my $port = $self->port) { $authority .= ":$port" }

return $authority;
Expand Down Expand Up @@ -67,7 +67,7 @@ sub ihost {

# Check if host needs to be encoded
return undef unless my $host = $self->host;
return $host unless $host =~ /[^\x00-\x7f]/;
return lc $host unless $host =~ /[^\x00-\x7f]/;

# Encode
return join '.',
Expand Down
1 change: 1 addition & 0 deletions t/mojo/url.t
Expand Up @@ -10,6 +10,7 @@ my $url = Mojo::URL->new('HtTp://Kraih.Com');
is $url->scheme, 'HtTp', 'right scheme';
is $url->protocol, 'http', 'right protocol';
is $url->host, 'Kraih.Com', 'right host';
is $url->ihost, 'kraih.com', 'right internationalized host';
is "$url", 'http://kraih.com', 'right format';

# Advanced
Expand Down

0 comments on commit 7761eaa

Please sign in to comment.