X-Git-Url: https://git.deb.at/?a=blobdiff_plain;f=cgi-bin%2Fdispatcher.pl;h=3dca95cfdbaa5d4843cfd5a6fe2333671594de45;hb=47c93cb066364b11f0b216589ddc68671435b060;hp=f03c55970aee3ebc5cd4d6e3702d30a3dc026fad;hpb=d9c10aaf0bb03bfb75404f9041967b9f91012bdb;p=deb%2Fpackages.git diff --git a/cgi-bin/dispatcher.pl b/cgi-bin/dispatcher.pl index f03c559..3dca95c 100755 --- a/cgi-bin/dispatcher.pl +++ b/cgi-bin/dispatcher.pl @@ -19,8 +19,7 @@ use DB_File; use Benchmark ':hireswallclock'; use Deb::Versions; -use Packages::Config qw( $DBDIR $ROOT $SEARCH_CGI $SEARCH_PAGE - @SUITES @SECTIONS @ARCHIVES @ARCHITECTURES ); +use Packages::Config qw( $DBDIR $ROOT @SUITES @SECTIONS @ARCHIVES @ARCHITECTURES ); use Packages::CGI; use Packages::DB; use Packages::Search qw( :all ); @@ -59,19 +58,22 @@ $Packages::CGI::debug = $debug; my $what_to_do = 'show'; my $source = 0; if (my $path = $input->path_info() || $input->param('PATH_INFO')) { - my @components = grep { $_ } map { lc $_ } split /\/+/, $path; + my @components = grep { $_ } map { lc $_ } split /\//, $path; - debug( "components[0]=$components[0]", 2 ); - if ($components[0] eq 'search') { - shift @components; - $what_to_do = 'search'; - } - if ($components[0] eq 'source') { + debug( "components[0]=$components[0]", 2 ) if @components>0; + if (@components > 0 and $components[0] eq 'source') { shift @components; $input->param( 'source', 1 ); } - if (@components == 0) { - # we just hope we get the information through our parameters... + if (@components > 0 and $components[0] eq 'search') { + shift @components; + $what_to_do = 'search'; + # Done + fatal_error( "search doesn't take any more path elements" ) + if @components > 0; + } elsif (@components == 0) { + fatal_error( "We're supposed to display the homepage here, instead of + getting dispatch.pl" ); } elsif (@components == 1) { $what_to_do = 'search'; } else {