On 03/20/2012 11:33 AM, Daniel P. Berrange wrote:
From: "Daniel P. Berrange" <berrange(a)redhat.com>
Avoid the need for each driver to parse query parameters itself
by storing them directly in the virURIPtr struct. The parsing
code is a copy of that from src/util/qparams.c The latter will
be removed in a later patch
* src/util/viruri.h: Add query params to virURIPtr
* src/util/viruri.c: Parse query parameters when creating virURIPtr
* tests/viruritest.c: Expand test to cover params
---
src/libvirt_private.syms | 1 +
src/util/viruri.c | 139 ++++++++++++++++++++++++++++++++++++++++++++++
src/util/viruri.h | 15 +++++
tests/viruritest.c | 46 +++++++++++++---
4 files changed, 193 insertions(+), 8 deletions(-)
This patch does not round-trip queries that include % escapes. The old
qparamtest.c tried to roundtrip foo=one%20two (the literal value of 'one
two' when not URI-encoded); but now virURIFormat re-escapes the % into
one%2520two. I caught this with my attempt to enhance viruritest to the
same level as qparamtest, but didn't want to spend any further time in
fixing viruri.c.
https://www.redhat.com/archives/libvir-list/2012-March/msg01043.html
--
Eric Blake eblake(a)redhat.com +1-919-301-3266
Libvirt virtualization library
http://libvirt.org