[pve-devel] r4844 - pve-manager/pve2/lib/PVE
svn-commits at proxmox.com
svn-commits at proxmox.com
Fri Jun 25 14:00:46 CEST 2010
Author: dietmar
Date: 2010-06-25 12:00:46 +0000 (Fri, 25 Jun 2010)
New Revision: 4844
Modified:
pve-manager/pve2/lib/PVE/REST.pm
Log:
disable proxy loops
Modified: pve-manager/pve2/lib/PVE/REST.pm
===================================================================
--- pve-manager/pve2/lib/PVE/REST.pm 2010-06-25 11:24:26 UTC (rev 4843)
+++ pve-manager/pve2/lib/PVE/REST.pm 2010-06-25 12:00:46 UTC (rev 4844)
@@ -88,6 +88,8 @@
$ua->default_header('cookie' => "${cookie_name}=$ticket") if $ticket;
+ $ua->default_header('PVEDisableProxy' => 'true');
+
my $uri = URI->new();
if ($host eq 'localhost') {
@@ -217,6 +219,12 @@
my $res = rest_handler($method, $r->uri, $ticket, $params);
if ($res->{proxy}) {
+ if ($r->headers_in->{'PVEDisableProxy'}) {
+ my $code = FORBIDDEN;
+ $r->status($code);
+ $r->status_line("$code proxy loop detected - aborted");
+ return $res->{status};
+ }
return proxy_handler($r, $res->{proxy}, $method, $r->uri, $ticket, $params);
}
@@ -230,7 +238,7 @@
}
if ($res->{message}) {
- $r->status_line("$res $res->{message}");
+ $r->status_line("$res->{status} $res->{message}");
}
send_response($r, $res->{data});
More information about the pve-devel
mailing list