[pve-devel] [PATCH 2/2] rest : handle application/x-spice-configuration response format

Dietmar Maurer dietmar at proxmox.com
Mon Jun 24 10:41:34 CEST 2013


> +    } elsif ($format eq 'spiceconfig') {
> +	$ct = 'application/x-spice-configuration;charset=UTF-8';
> +	if ($data && ref($data) && ref($data->{data})) {
> +	    $raw = "[virt-viewer]\n";
> +	    $raw .= "title=$data->{data}->{title}\n" if $data->{data}->{title};
> +	    $raw .= "type=$data->{data}->{type}\n" if $data->{data}->{type};
> +	    $raw .= "host=$data->{data}->{host}\n" if $data->{data}->{host};
> +	    $raw .= "port=$data->{data}->{port}\n" if $data->{data}->{port};
> +	    $raw .= "password=$data->{data}->{password}\n" if $data->{data}-
> >{password};
> +	    $raw .= "proxy=$data->{data}->{proxy}\n" if $data->{data}->{proxy};

Maybe we can use a simply loop here? something like:

foreach my $key (keys %{$data->{data}}) {
	$raw .= "$key=$data->{data}->{$key}\n"; 
}

What do you think?




More information about the pve-devel mailing list