]> matita.cs.unibo.it Git - helm.git/commitdiff
When downloading stylesheets, substitutes all relative URLs with
authorClaudio Sacerdoti Coen <claudio.sacerdoticoen@unibo.it>
Mon, 5 Feb 2001 16:41:01 +0000 (16:41 +0000)
committerClaudio Sacerdoti Coen <claudio.sacerdoticoen@unibo.it>
Mon, 5 Feb 2001 16:41:01 +0000 (16:41 +0000)
absolute URLs through a very bad heuristic (regular expression)

helm/http_getter/http_getter.pl.in

index b1ec80aeb972c3a0dc7941f8da67a2b0574deb68..1c7359b6c885c6c0c79665b63b5fe5cff4e0185c 100755 (executable)
@@ -62,9 +62,12 @@ use Compress::Zlib;
 #CSC: altra roba da sistemare segnata con CSC
 
 my $d = new HTTP::Daemon LocalPort => 8081;
+my $myownurl = $d->url;
+$myownurl =~ s/\/$//; # chop the final slash
 tie(%map, 'DB_File', $uris_dbm.".db", O_RDONLY, 0664);
-print "Please contact me at: <URL:", $d->url, ">\n";
+print "Please contact me at: <URL:", $myownurl."/", ">\n";
 print "helm_dir: $helm_dir\n";
+print "styles_dir: $styles_dir\n";
 print "dtd_dir: $dtd_dir\n";
 print "urls_of_uris.db: $uris_dbm.db\n";
 print "cache mode: $cachemode\n";
@@ -234,7 +237,13 @@ EOT
                print "Using local copy\n";
                open(FD, $filename) or die "Cannot open $filename\n";
                $cont = "";
-               while(<FD>) { $cont .= $_; }
+               while(<FD>) {
+                # Vary bad heuristic for substituion of absolute URLs
+                # for relative ones
+                s/xsl:import\s+href="/xsl:import href="$myownurl\/getxslt?uri=/g ;
+                s/xsl:include\s+href="/xsl:include href="$myownurl\/getxslt?uri=/g ;
+                $cont .= $_;
+               }
                close(FD);
                answer($c,$cont);
             } else {