Skip to content
Snippets Groups Projects
Commit 596a5b85 authored by Nigel Kukard's avatar Nigel Kukard
Browse files

Fixed issues with the URI being passed with query

parent 7a54a1c0
No related branches found
No related tags found
No related merge requests found
...@@ -25,6 +25,7 @@ use HTML::Entities; ...@@ -25,6 +25,7 @@ use HTML::Entities;
use HTTP::Response; use HTTP::Response;
use HTTP::Status qw(:constants :is status_message); use HTTP::Status qw(:constants :is status_message);
use POE qw(Component::Server::TCP Filter::HTTPD); use POE qw(Component::Server::TCP Filter::HTTPD);
use URI;
use opentrafficshaper::logger; use opentrafficshaper::logger;
...@@ -70,6 +71,7 @@ my $pages = { ...@@ -70,6 +71,7 @@ my $pages = {
}, },
'users' => { 'users' => {
'default' => \&opentrafficshaper::plugins::webserver::pages::users::default, 'default' => \&opentrafficshaper::plugins::webserver::pages::users::default,
'add' => \&opentrafficshaper::plugins::webserver::pages::users::add,
}, },
}; };
...@@ -114,8 +116,11 @@ sub handle_request ...@@ -114,8 +116,11 @@ sub handle_request
goto END; goto END;
} }
# We need to parse the URI nicely
my $requestURI = URI->new($request->uri);
# Split off the URL into a module and action # Split off the URL into a module and action
my (undef,$dmodule,$daction,@dparams) = split(/\//,$request->uri); my (undef,$dmodule,$daction,@dparams) = split(/\//,$requestURI->path);
# If any is blank, set it to the default # If any is blank, set it to the default
$dmodule = "index" if (!defined($dmodule)); $dmodule = "index" if (!defined($dmodule));
$daction = "default" if (!defined($daction)); $daction = "default" if (!defined($daction));
...@@ -231,7 +236,7 @@ EOF ...@@ -231,7 +236,7 @@ EOF
# <li><a href="#">Link</a></li> # <li><a href="#">Link</a></li>
# Loop with menu items # Loop with menu items
foreach my $item (keys %{$menu->{$section}}) { foreach my $item (keys %{$menu->{$section}}) {
my $link = $module . "/" . $menu->{$section}->{$item}; my $link = "/" . $module . "/" . $menu->{$section}->{$item};
# Sanitize slightly # Sanitize slightly
$link =~ s,/+$,,; $link =~ s,/+$,,;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment