[pve-devel] r6007 - in pve-manager/pve2: . debian lib/PVE
svn-commits at proxmox.com
svn-commits at proxmox.com
Mon May 23 11:28:40 CEST 2011
Author: dietmar
Date: 2011-05-23 11:28:40 +0200 (Mon, 23 May 2011)
New Revision: 6007
Modified:
pve-manager/pve2/ChangeLog
pve-manager/pve2/debian/control.in
pve-manager/pve2/lib/PVE/APIDaemon.pm
Log:
use CGI instead of HTTP::Request::Params
Modified: pve-manager/pve2/ChangeLog
===================================================================
--- pve-manager/pve2/ChangeLog 2011-05-23 06:20:05 UTC (rev 6006)
+++ pve-manager/pve2/ChangeLog 2011-05-23 09:28:40 UTC (rev 6007)
@@ -1,3 +1,7 @@
+2011-05-23 Proxmox Support Team <support at proxmox.com>
+
+ * lib/PVE/APIDaemon.pm (send_error): use CGI instead of HTTP::Request::Params
+
2011-03-24 Proxmox Support Team <support at proxmox.com>
* www/manager/index.pl: include the CSRF prevention token in the
Modified: pve-manager/pve2/debian/control.in
===================================================================
--- pve-manager/pve2/debian/control.in 2011-05-23 06:20:05 UTC (rev 6006)
+++ pve-manager/pve2/debian/control.in 2011-05-23 09:28:40 UTC (rev 6007)
@@ -3,7 +3,7 @@
Section: admin
Priority: optional
Architecture: all
-Depends: perl5, libtimedate-perl, apache2-mpm-prefork, libauthen-pam-perl, libintl-perl, rsync, libapache2-request-perl, libjson-perl, libdigest-sha1-perl, vncterm, qemu-server (>= 1.1-1), libwww-perl, wget, libnet-dns-perl, vlan, ifenslave-2.6 (>= 1.1.0-10), liblinux-inotify2-perl, debconf (>= 0.5) | debconf-2.0, netcat-traditional, pve-cluster, libpve-common-perl, libpve-storage-perl, libterm-readline-gnu-perl, libhttp-request-params-perl, libpve-access-control, libio-socket-ssl-perl, libfilesys-df-perl, libfile-readbackwards-perl
+Depends: perl5, libtimedate-perl, apache2-mpm-prefork, libauthen-pam-perl, libintl-perl, rsync, libapache2-request-perl, libjson-perl, libdigest-sha1-perl, vncterm, qemu-server (>= 1.1-1), libwww-perl, wget, libnet-dns-perl, vlan, ifenslave-2.6 (>= 1.1.0-10), liblinux-inotify2-perl, debconf (>= 0.5) | debconf-2.0, netcat-traditional, pve-cluster, libpve-common-perl, libpve-storage-perl, libterm-readline-gnu-perl, libpve-access-control, libio-socket-ssl-perl, libfilesys-df-perl, libfile-readbackwards-perl
Conflicts: netcat-openbsd
Maintainer: Proxmox Support Team <support at proxmox.com>
Description: The Proxmox Virtual Environment
Modified: pve-manager/pve2/lib/PVE/APIDaemon.pm
===================================================================
--- pve-manager/pve2/lib/PVE/APIDaemon.pm 2011-05-23 06:20:05 UTC (rev 6006)
+++ pve-manager/pve2/lib/PVE/APIDaemon.pm 2011-05-23 09:28:40 UTC (rev 6007)
@@ -13,7 +13,7 @@
use IO::Select;
use HTTP::Daemon;
use HTTP::Status qw(:constants);
-use HTTP::Request::Params;
+use CGI;
use Data::Dumper; # fixme: remove
use PVE::REST;
use JSON;
@@ -209,6 +209,30 @@
DELETE => 1,
};
+my $extract_params = sub {
+ my ($r, $method) = @_;
+
+ # NOTE: HTTP::Request::Params return undef instead of ''
+ #my $parser = HTTP::Request::Params->new({req => $r});
+ #my $params = $parser->params;
+
+ my $post_params = {};
+
+ if ($method eq 'PUT' || $method eq 'POST') {
+ $post_params = CGI->new($r->content())->Vars;
+ }
+
+ my $query_params = CGI->new($r->url->query)->Vars;
+
+ my $params = $post_params || {};
+
+ foreach my $k (keys %{$query_params}) {
+ $params->{$k} = $query_params->{$k};
+ }
+
+ return $params;
+};
+
sub handle_requests {
my ($self, $rpcenv) = @_;
@@ -264,8 +288,7 @@
my $ticket = PVE::REST::extract_auth_cookie($cookie);
- my $parser = HTTP::Request::Params->new({req => $r});
- my $params = $parser->params;
+ my $params = &$extract_params($r, $method);
my $clientip = $headers->header('PVEClientIP');
More information about the pve-devel
mailing list