| Included libraries | Package variables | General documentation | Methods |
| Package variables | Top |
| |
| @EXPORT_OK = qw(aleurl2file alefile2url aleurls2files alefiles2urls alecanonurl) |
| Included modules | Top |
| Clair::ALE::Wget::Hash |
| Clair::Utils::ALE(1) |
| Clair::Utils::ALE(2) qw ( %ALE_ENV ) |
| Exporter |
| URI::Escape |
| Inherit | Top |
| Exporter |
| Synopsis | Top |
| Description | Top |
| Methods | Top |
| alecanonurl | No description | Code |
| alefile2url | No description | Code |
| aleurl2file | No description | Code |
| alecanonurl | description | prev | next | Top |
sub alecanonurl
{
local($_)=@_;
my($prot,$host,$path);
unless (($prot,$host,$path) = m|^([^:]+)://([^/]+)/?([^\x00-\x1f\x7f-\xff]*)?$|)
{
warn "Invalid URL in aleurl2file: Couldn't parse URL.\n";
return undef;
}
if (!defined($path))
{
$path='';
}
if ($prot ne 'http')
{
warn "Invalid URL in aleurl2file: Only http protocol is recognized.\n";
return undef;
}
$host =~ s/:80$//;
$path=uri_escape($path,"\x00-\x1f\x7f-\xff\x20\"\<\>\@\[\\\]\^\`\{\|\}\~\%");
$_ = "${prot}://$host/$path";
s|/$||;
if ( -d aleurl2file($_) ) { $_ .= "/index.html" };
$_;} |
| alefile2url | description | prev | next | Top |
sub alefile2url
{
local($_)=@_;
my $hasher;
if ($dirhasher{$ALE_ENV{ALECACHE}})
{
$hasher = $dirhasher{$ALE_ENV{ALECACHE}};
}
else
{
$hasher = $dirhasher{$ALE_ENV{ALECACHE}} = Clair::ALE::Wget::Hash->new($ALE_ENV{ALECACHE});
}
$_ = $hasher->unhash($_);
if (!s#^($ALE_ENV{ALECACHE}|\.)/##)} |
| aleurl2file | description | prev | next | Top |
sub aleurl2file
{
local($_)=@_;
my($prot,$host,$path);
my $hasher;
if ($dirhasher{$ALE_ENV{ALECACHE}})
{
$hasher = $dirhasher{$ALE_ENV{ALECACHE}};
}
else
{
$hasher = $dirhasher{$ALE_ENV{ALECACHE}} = Clair::ALE::Wget::Hash->new($ALE_ENV{ALECACHE});
}
unless (($prot,$host,$path) = m|^([^:]+)://([^/]+)/?([^\x00-\x1f\x7f-\xff]*)?$|)
{
warn "Invalid URL in aleurl2file: Couldn't parse URL.\n";
return undef;
}
if (!defined($path))
{
$path='';
}
if ($prot ne 'http')
{
warn "Invalid URL in aleurl2file: Only http protocol is recognized.\n";
return undef;
}
$host =~ s/:80$//;
$_ = join('/',$ALE_ENV{ALECACHE},$hasher->hash($host),$host,uri_escape($path,"\x00-\x1f\x7f-\xff\x20\"\<\>\@\[\\\]\^\`\{\|\}\~\%"));
s|/$||;
$_;} |