Fix HTTP redirects when running under HTTP/S

This commit is contained in:
Oliver Gorwits
2013-10-24 05:55:19 +01:00
parent d1f3b89f43
commit e444efb004
4 changed files with 18 additions and 7 deletions

View File

@@ -1,10 +1,16 @@
2.019001 - 2013-10-08
2.019002 - 2013-10-24
[BUG FIXES]
* Fix HTTP redirects when running under HTTP/S
2.019001 - 2013-10-22
[BUG FIXES]
* Fix syntax error in Util/SNMP.pm
2.019000 - 2013-10-08
2.019000 - 2013-10-22
[ENHANCEMENTS]

View File

@@ -55,7 +55,9 @@ 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')->path;
header(Location => uri_for('/admin/jobqueue')->path);
return status(302);
};
}

View File

@@ -159,7 +159,8 @@ get '/device' => require_login sub {
});
if (!defined $dev) {
return redirect uri_for('/', {nosuchdevice => 1})->path_query;
header(Location => uri_for('/', {nosuchdevice => 1})->path_query);
return status(302);
}
params->{'tab'} ||= 'details';

View File

@@ -66,7 +66,8 @@ get '/search' => require_login sub {
if (not param('tab')) {
if (not $q) {
return redirect uri_for('/')->path;
header(Location => uri_for('/')->path);
return status(302);
}
# pick most likely tab for initial results
@@ -79,11 +80,12 @@ get '/search' => require_login sub {
if ($nd and $nd->count) {
if ($nd->count == 1) {
# redirect to device details for the one device
return redirect uri_for('/device', {
header(Location => uri_for('/device', {
tab => 'details',
q => ($nd->first->dns || $nd->first->ip),
f => '',
})->path_query;
})->path_query);
return status(302);
}
# multiple devices