develooper Front page | perl.libwww | Postings from January 2001

Re: URI::Heuristic module not expanding partial url(s) containing a d ash

From:
Gisle Aas
Date:
January 9, 2001 12:48
Subject:
Re: URI::Heuristic module not expanding partial url(s) containing a d ash
Message ID:
lrofxgpi6k.fsf@caliper.ActiveState.com
"Khamphasouk, Chantha" <khamphas@cobaltgroup.com> writes:

> During use of the URI::Heuristic module, we encountered the module not
> expanding partial url(s) containing a dash.
> 	Example:
> 		Before expanding				After
> epxanding
> 		some-site					some-site
> 		some-site.com				some-site.com
> 
> Do you have any suggestions (as a work-around or solution) for this issue?

Try this patch:

Index: URI/Heuristic.pm
===================================================================
RCS file: /cvsroot/libwww-perl/uri/URI/Heuristic.pm,v
retrieving revision 4.11
diff -u -p -d -u -r4.11 Heuristic.pm
--- URI/Heuristic.pm	1999/03/20 07:34:27	4.11
+++ URI/Heuristic.pm	2001/01/09 20:44:07
@@ -145,7 +145,7 @@ sub uf_uristr ($)
 	$_ = "mailto:$_";
 
     } elsif (!/^[.+\-\w]+:/) {      # no scheme specified
-	if (s/^(\w+(?:\.\w+)*)([\/:\?\#]|$)/$2/) {
+	if (s/^([-\w]+(?:\.[-\w]+)*)([\/:\?\#]|$)/$2/) {
 	    my $host = $1;
 
 	    if ($host !~ /\./ && $host ne "localhost") {

Regards,
Gisle



nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About