diff --git a/Netdisco/Changes b/Netdisco/Changes index f4c86751..c62ea26f 100644 --- a/Netdisco/Changes +++ b/Netdisco/Changes @@ -8,6 +8,7 @@ [BUG FIXES] * Update NodeWireless entries which match both MAC and SSID found, only + * Fix SSL-proxy behaviour by using only path+query in links (W. Gould) 2.017000 - 2013-09-23 diff --git a/Netdisco/lib/App/Netdisco/Manual/WritingPlugins.pod b/Netdisco/lib/App/Netdisco/Manual/WritingPlugins.pod index 2d37fad7..2befd384 100644 --- a/Netdisco/lib/App/Netdisco/Manual/WritingPlugins.pod +++ b/Netdisco/lib/App/Netdisco/Manual/WritingPlugins.pod @@ -307,18 +307,18 @@ App::Netdisco: =item C -A base url which links to the Node tab of the Search page, together with the -correct default search options set. +A path and query string which links to the Node tab of the Search page, +together with the correct default search options set. =item C -A base url which links to the Device tab of the Search page, together with the -correct default search options set. +A path and query string which links to the Device tab of the Search page, +together with the correct default search options set. =item C -A base url which links to the Ports tab of the Device page, together with -the correct default column view options set. +A path and query sting which links to the Ports tab of the Device page, +together with the correct default column view options set. =item C diff --git a/Netdisco/lib/App/Netdisco/Web.pm b/Netdisco/lib/App/Netdisco/Web.pm index fdf3c4f4..22430c0e 100644 --- a/Netdisco/lib/App/Netdisco/Web.pm +++ b/Netdisco/lib/App/Netdisco/Web.pm @@ -48,6 +48,7 @@ if (setting('extra_web_plugins') and ref [] eq ref setting('extra_web_plugins')) # workaround for https://github.com/PerlDancer/Dancer/issues/935 hook after_error_render => sub { setting('layout' => 'main') }; +# this hook should be loaded _after_ all plugins hook 'before_template' => sub { my $tokens = shift; @@ -61,6 +62,10 @@ hook 'before_template' => sub { # access to logged in user's roles $tokens->{user_has_role} = sub { user_has_role(@_) }; + # fix Plugin Template Variables to be only path+query + $tokens->{$_} = $tokens->{$_}->path_query + for qw/search_node search_device device_ports/; + # allow very long lists of ports $Template::Directive::WHILE_MAX = 10_000; diff --git a/Netdisco/lib/App/Netdisco/Web/AdminTask.pm b/Netdisco/lib/App/Netdisco/Web/AdminTask.pm index c9b7278b..3a600d2a 100644 --- a/Netdisco/lib/App/Netdisco/Web/AdminTask.pm +++ b/Netdisco/lib/App/Netdisco/Web/AdminTask.pm @@ -55,7 +55,7 @@ foreach my $jobtype (keys %jobs_all, keys %jobs) { if exists $jobs{$jobtype} and not param('device'); add_job($jobtype, param('device'), param('extra')); - redirect uri_for('/admin/jobqueue')->as_string; + redirect uri_for('/admin/jobqueue')->path; }; } diff --git a/Netdisco/lib/App/Netdisco/Web/Device.pm b/Netdisco/lib/App/Netdisco/Web/Device.pm index 4e66ac27..f5853f92 100644 --- a/Netdisco/lib/App/Netdisco/Web/Device.pm +++ b/Netdisco/lib/App/Netdisco/Web/Device.pm @@ -159,7 +159,7 @@ get '/device' => require_login sub { }); if (!defined $dev) { - return redirect uri_for('/', {nosuchdevice => 1})->as_string(); + return redirect uri_for('/', {nosuchdevice => 1})->path_query; } params->{'tab'} ||= 'details'; diff --git a/Netdisco/lib/App/Netdisco/Web/Search.pm b/Netdisco/lib/App/Netdisco/Web/Search.pm index 376a5a9c..d20510e3 100644 --- a/Netdisco/lib/App/Netdisco/Web/Search.pm +++ b/Netdisco/lib/App/Netdisco/Web/Search.pm @@ -66,7 +66,7 @@ get '/search' => require_login sub { if (not param('tab')) { if (not $q) { - return redirect uri_for('/')->as_string; + return redirect uri_for('/')->path; } # pick most likely tab for initial results @@ -83,7 +83,7 @@ get '/search' => require_login sub { tab => 'details', q => ($nd->first->dns || $nd->first->ip), f => '', - })->as_string; + })->path; } # multiple devices