diff options
author | Jeroen van Wolffelaar <jeroen@wolffelaar.nl> | 2006-02-21 13:27:22 +0000 |
---|---|---|
committer | Jeroen van Wolffelaar <jeroen@wolffelaar.nl> | 2006-02-21 13:27:22 +0000 |
commit | 64d03fdf2db2ab82e6e762e7d81697d7fd051b2b (patch) | |
tree | 792221106a21ff61583446cc0ee1912664acb347 /cgi-bin | |
parent | e6999b858367d9d83e0fa2c32cddfd31b4416486 (diff) |
Fix a few warnings, be more strict in what we accept
Diffstat (limited to 'cgi-bin')
-rwxr-xr-x | cgi-bin/dispatcher.pl | 21 |
1 files changed, 12 insertions, 9 deletions
diff --git a/cgi-bin/dispatcher.pl b/cgi-bin/dispatcher.pl index f03c559..8d6fc16 100755 --- a/cgi-bin/dispatcher.pl +++ b/cgi-bin/dispatcher.pl @@ -59,19 +59,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 { |