]> matita.cs.unibo.it Git - helm.git/blobdiff - helm/graphs/tools/draw_graph.cgi
...
[helm.git] / helm / graphs / tools / draw_graph.cgi
index 9f24c7a071e7b95c416dd5bba5d7d8b3891b5fe0..24170593f8d97812d23f8c58ce6ee018672676fc 100755 (executable)
@@ -10,7 +10,10 @@ use FindBin;
 
 chdir $FindBin::Bin; # chdir to the directory of this perl script
 
-my $d = new HTTP::Daemon LocalPort => 8083;
+$drawgraphport = $ENV{'DRAW_GRAPH_PORT'} || $drawgraphport;
+
+my $d = new HTTP::Daemon LocalPort => $drawgraphport
+ or die "Error: port $drawgraphport not available.";
 print "Please contact me at: <URL:", $d->url, ">\n";
 
 $SIG{CHLD} = "IGNORE"; # do not accumulate defunct processes
@@ -22,7 +25,7 @@ while (my $c = $d->accept) {
             my $http_query = $r->url->equery;
             my $cgi = new CGI("$http_query");
             my $url = $cgi->param('url');
-           $url = uri_unescape($url).'&param.PID='.$$;
+           $url = $url.'&param.PID='.$$;
            print "URL: $url\n";
 
             my $ua = LWP::UserAgent->new;
@@ -41,6 +44,11 @@ while (my $c = $d->accept) {
            print "Returning GIF: $pid\n";
             $c->send_file_response("prova.$pid.gif");
            system("make PID=$pid clean ; rm -f prova0.$pid.dot");
+        } elsif ($r->method eq 'GET' && $r->url->path eq "/help"){
+           print "Help requested!\n";
+          my $response = new HTTP::Response;
+           $response->content("Graph Drawer Version: ???");
+           $c->send_response($response);
         } else {
             $c->send_error(RC_FORBIDDEN)
         }