From f0ba4a2e4c476fa162e4bf976b323cbfb492dec5 Mon Sep 17 00:00:00 2001 From: Claudio Sacerdoti Coen Date: Thu, 19 Apr 2001 12:13:28 +0000 Subject: [PATCH] register method added --- helm/http_getter/http_getter.pl.in | 24 +++++++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-) diff --git a/helm/http_getter/http_getter.pl.in b/helm/http_getter/http_getter.pl.in index 2aa678e9f..e06a3a5e2 100755 --- a/helm/http_getter/http_getter.pl.in +++ b/helm/http_getter/http_getter.pl.in @@ -83,7 +83,7 @@ $myownurl =~ s/http:\/\/(.*):(.*)/$1/; ($myownurl) = gethostbyname($myownurl); $myownurl = "http://".$myownurl.":".$myownport; -tie(%map, 'DB_File', $uris_dbm.".db", O_RDONLY, 0664); +tie(%map, 'DB_File', $uris_dbm.".db", O_RDWR, 0664); print "Please contact me at: \n"; print "helm_dir: $helm_dir\n"; print "style_dir: $style_dir\n"; @@ -159,6 +159,24 @@ while (my $c = $d->accept) { answer($c,$ciccontent,"text/xml","x-gzip"); } } + } elsif ($http_method eq 'GET' and $http_path eq "/register") { + my $inputurl = $cgi->param('url'); + print "Register requested...\n"; + $map{$inputuri}=$inputurl; + + # Now let's clean the cache + my $cicfilename = $inputuri; + $cicfilename =~ s/cic:(.*)/$1/; + $cicfilename =~ s/theory:(.*)/$1/; + + print "Unlinking ".$helm_dir.$cicfilename.".xml[.gz]\n"; + unlink ($helm_dir.$cicfilename.".xml"); + unlink ($helm_dir.$cicfilename.".xml.gz"); + + kill(USR1,getppid()); # signal changes to parent + untie %map; + print "done\n"; + html_nice_answer($c,"Register done"); } elsif ($http_method eq 'GET' and $http_path eq "/resolve") { my $outputurl = $map{$inputuri}; $outputurl = "" if (not defined($outputurl)); @@ -637,7 +655,7 @@ sub helm_wget { sub update { untie %map; - tie(%map, 'DB_File', $uris_dbm.".db", O_RDONLY, 0664); + tie(%map, 'DB_File', $uris_dbm.".db", O_RDWR, 0664); } sub mk_urls_of_uris { @@ -685,6 +703,6 @@ sub mk_urls_of_uris { } untie(%urls_of_uris); - tie(%map, 'DB_File', $uris_dbm.".db", O_RDONLY, 0664); + tie(%map, 'DB_File', $uris_dbm.".db", O_RDWR, 0664); } -- 2.39.2