]> mj.ucw.cz Git - pciids.git/blobdiff - PciIds/Html/Handler.pm
Fix odd links
[pciids.git] / PciIds / Html / Handler.pm
index aa3887619f84f98643f7c55aadc436062f898c9f..f9ca889e5dd2830b303ac5e642ab7f2a3fd89911 100644 (file)
@@ -1,3 +1,21 @@
+#      PciIds web database
+#      Copyright (C) 2008 Michal Vaner (vorner@ucw.cz)
+#
+#      This program is free software; you can redistribute it and/or modify
+#      it under the terms of the GNU General Public License as published by
+#      he Free Software Foundation; either version 2 of the License, or
+#      (at your option) any later version.
+#
+#      This program is distributed in the hope that it will be useful,
+#      but WITHOUT ANY WARRANTY; without even the implied warranty of
+#      MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+#
+#      GNU General Public License for more details.
+#
+#      You should have received a copy of the GNU General Public License
+#      along with this program; if not, write to the Free Software
+#      Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+
 package PciIds::Html::Handler;
 use strict;
 use warnings;
@@ -62,10 +80,11 @@ my %handlers = (
 sub handler( $$ ) {
        my( $req, $hasSSL ) = @_;
        my $args = parseArgs( $req->args() );
-       return HTTPRedirect( $req, $req->uri()."index.html" ) if( $req->uri() eq '/' && ( !defined $args->{'action'} || $args->{'action'} ne 'help' ) );
+       return HTTPRedirect( $req, protoName( $hasSSL ).'://'.$req->hostname().'/index.html' ) if( $req->uri() eq '/' && ( !defined $args->{'action'} || ( $args->{'action'} ne 'help' && $args->{'action'} ne 'jump' ) ) );
        return DECLINED if( $req->uri() =~ /^\/((static)\/|robots.txt|index.html)/ );
        my $action = $args->{'action'};
        $action = '' unless( defined $action );
+       return HTTPRedirect( $req, protoName( $hasSSL ).'://'.$req->hostname().'/' ) if $req->uri() =~ /^\/(read|mods)\/?$/  && ( $action eq '' || $action eq 'list' );
        my $method = $handlers{$req->method()};
        return HTTP_METHOD_NOT_ALLOWED unless( defined $method );#Can't handle this method
        my $sub = $method->{$action};