From 522162260eb7dff98f051b2164c2e55e1420d0fc Mon Sep 17 00:00:00 2001 From: "Hadaq@styx" Date: Thu, 10 Oct 2013 18:16:32 +0200 Subject: [PATCH] changed get.pl to support httpi --- xml-db/get.pl | 25 +++++++++++++++++++------ 1 file changed, 19 insertions(+), 6 deletions(-) diff --git a/xml-db/get.pl b/xml-db/get.pl index 9bbf374..4530549 100755 --- a/xml-db/get.pl +++ b/xml-db/get.pl @@ -9,7 +9,6 @@ use Date::Format; use Pod::Usage; use Getopt::Long; use File::chdir; -use FindBin qw($RealBin); use Storable qw(lock_retrieve); use Text::TabularDisplay; use feature "switch"; @@ -22,17 +21,31 @@ my $isbrowser = 0; my ($file,$netaddr,$name, $style); $ENV{'DAQOPSERVER'}="localhost:7" unless (defined $ENV{'DAQOPSERVER'}); + + ############################### #### Check if browser or command line ############################### if(defined $ENV{'QUERY_STRING'}) { - $isbrowser = 1; - ($file,$netaddr,$name,$style) = split("-",$ENV{'QUERY_STRING'}); - $file = "$RealBin/cache/$file.entity"; - use CGI::Carp qw(fatalsToBrowser); - print "Content-type: text/html\n\n"; + if($ENV{'SERVER_SOFTWARE'} =~ /HTTPi/i) { + $isbrowser = 1; + ($file,$netaddr,$name,$style) = split("-",$ENV{'QUERY_STRING'}); + $file = "htdocs/xml-db/cache/$file.entity"; + use CGI::Carp qw(fatalsToBrowser); + } + else { +# use FindBin qw($RealBin); + my $RealBin = "."; + $isbrowser = 1; + ($file,$netaddr,$name,$style) = split("-",$ENV{'QUERY_STRING'}); + $file = "$RealBin/cache/$file.entity"; + use CGI::Carp qw(fatalsToBrowser); + print "Content-type: text/html\n\n"; + } } else { +# use FindBin qw($RealBin); + my $RealBin = "."; Getopt::Long::Configure(qw(gnu_getopt)); GetOptions( 'help|h' => \$help, -- 2.43.0