Skip to content

Commit

Permalink
slashstyle cleanup for URI scheme thing.
Browse files Browse the repository at this point in the history
  • Loading branch information
jamiemccarthy committed Jul 1, 2003
1 parent 4f82c19 commit 86e8eba
Showing 1 changed file with 9 additions and 8 deletions.
17 changes: 9 additions & 8 deletions Slash/Utility/Data/Data.pm
Expand Up @@ -1509,15 +1509,16 @@ sub fudgeurl {
my $scheme = undef;
$scheme = $uri->scheme if $uri && $uri->can("scheme");

# modify scheme:/ to scheme:// for $schemes defined below
# need to recreate $uri after doing so to make userinfo
# clearing work for something like http:/foo.com...@bar.com
my $schemes_to_mod = { http=>1, https=>1, ftp=>1 };
if ($scheme && $schemes_to_mod->{$scheme}) {
$url = $uri->canonical->as_string;
$url =~ s|^$scheme:/([^/])|$scheme://$1|;
$uri = new URI $url;
}

# modify scheme:/ to scheme:// for $schemes defined below
# need to recreate $uri after doing so to make userinfo
# clearing work for something like http:/foo.com...@bar.com

my $schemes_to_mod = {http=>1,https=>1,ftp=>1};
$url = $uri->canonical->as_string;
$url=~s|^$scheme:/([^/])|$scheme://$1| if $schemes_to_mod->{$scheme};
$uri = new URI $url;
if ($uri && !$scheme && $uri->can("authority") && $uri->authority) {
# The URI has an authority but no scheme, e.g. "//sitename.com/".
# URI.pm doesn't always handle this well. E.g. host() returns
Expand Down

0 comments on commit 86e8eba

Please sign in to comment.