X-Git-Url: http://matita.cs.unibo.it/gitweb/?a=blobdiff_plain;ds=sidebyside;f=helm%2Fhttp_getter%2Fhttp_getter.pl.in;h=fd72b75094014106160cd3a8ecae90176e8eb2ce;hb=9632260a013dabd108d9965d6faffd99246e1f47;hp=0ea2c02e44456c8d6960e3816a1be7b0cb13e92e;hpb=df36c646d6c414e26e76dbc854ee57839ca0807a;p=helm.git diff --git a/helm/http_getter/http_getter.pl.in b/helm/http_getter/http_getter.pl.in index 0ea2c02e4..fd72b7509 100755 --- a/helm/http_getter/http_getter.pl.in +++ b/helm/http_getter/http_getter.pl.in @@ -35,7 +35,7 @@ if (defined ($HELM_LIB_DIR)) { } # Let's override the configuration file -$styles_dir = $ENV{"HELM_STYLE_DIR"} if (defined ($ENV{"HELM_STYLE_DIR"})); +$style_dir = $ENV{"HELM_STYLE_DIR"} if (defined ($ENV{"HELM_STYLE_DIR"})); $dtd_dir = $ENV{"HELM_DTD_DIR"} if (defined ($ENV{"HELM_DTD_DIR"})); # : TODO temporary, move this setting to configuration file @@ -63,11 +63,19 @@ 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: \n"; print "helm_dir: $helm_dir\n"; -print "styles_dir: $styles_dir\n"; +print "style_dir: $style_dir\n"; print "dtd_dir: $dtd_dir\n"; print "urls_of_uris.db: $uris_dbm.db\n"; print "cache mode: $cachemode\n"; @@ -234,9 +242,24 @@ EOT } else { die "Could not find DTD!"; } - } elsif ($http_method eq 'GET' and $http_path eq "/getxslt") { + } elsif ($http_method eq 'GET' and $http_path eq "/getstyleconf") { + my $filename = $inputuri; + $filename = $style_dir."/config/".$filename; + if (stat($filename)) { + open(FD, $filename) or die "Cannot open $filename\n"; + $cont = ""; + while() { + s/DOCTYPE (.*) SYSTEM\s+"/DOCTYPE $1 SYSTEM "$myownurl\/getstyleconf?uri=/g; + $cont .= $_; + } + close(FD); + answer($c,$cont); + } else { + die "Could not find Style Configuration File!"; + } + } elsif ($http_method eq 'GET' and $http_path eq "/getxslt") { my $filename = $inputuri; - $filename = $styles_dir."/".$filename; + $filename = $style_dir."/".$filename; print "XSLT: $inputuri ==> ($filename)\n"; if (stat($filename)) { print "Using local copy\n";