]> matita.cs.unibo.it Git - helm.git/commitdiff
Dynamic patch to transform the URL returned by $d->url in the
authorClaudio Sacerdoti Coen <claudio.sacerdoticoen@unibo.it>
Mon, 5 Feb 2001 17:58:23 +0000 (17:58 +0000)
committerClaudio Sacerdoti Coen <claudio.sacerdoticoen@unibo.it>
Mon, 5 Feb 2001 17:58:23 +0000 (17:58 +0000)
complete one. The patch involves calling gethostbyname().
I don't know better solutions

helm/http_getter/http_getter.pl.in

index 0ea2c02e44456c8d6960e3816a1be7b0cb13e92e..e2ebb20d07ae52c7e25fda4b0e46f88fd3dbca02 100755 (executable)
@@ -63,7 +63,15 @@ use Compress::Zlib;
 
 my $d = new HTTP::Daemon LocalPort => 8081;
 my $myownurl = $d->url;
+
+# Let's patch the returned URL
 $myownurl =~ s/\/$//; # chop the final slash
+my $myownport = $myownurl;
+$myownport =~ s/http:\/\/(.*):(.*)/$2/;
+$myownurl  =~ s/http:\/\/(.*):(.*)/$1/;
+($myownurl) = gethostbyname($myownurl);
+$myownurl = "http://".$myownurl.":".$myownport;
+
 tie(%map, 'DB_File', $uris_dbm.".db", O_RDONLY, 0664);
 print "Please contact me at: <URL:", $myownurl."/", ">\n";
 print "helm_dir: $helm_dir\n";