[Libguestfs] URI Handling Patch

Richard W.M. Jones rjones at redhat.com
Mon Jun 29 18:14:55 UTC 2015


On Mon, Jun 29, 2015 at 05:57:38PM +0000, Gabriel Hartmann wrote:
> +Snesha Foss <sneshaf at microsoft.com> who is taking over this work.
> 
> It definitely looks like adding the query string to every path is just
> wrong.
> 
> I'm not sure I understand why we'd want to parse, deconstruct key value
> pairs and then reconstruct the query string from these values and append
> them to the path selectively.  This seems like added complexity for a
> benefit I don't understand.

Yes, you're probably right that we shouldn't do that.  However an
extra query string parameter (as an OString) would still be needed to
the add_drive call.

> I think in all http and https cases appending the query string is
> required.  It is part of the file path.  I think possibly having a flag for
> turning on and off query string appending would be a good idea for
> protocols where this is not the case.

There's what happens at the C API level (which is what I'm talking
about here), and what guestfish does when it separately parses up
URIs.

I think there is value in keeping the path and query separate because
they require different escaping, or perhaps more accurate to say,
currently we escape '?' in the path part, and changing that would
break the API for existing users.

Guestfish complicates everything by parsing the query for one
parameter (?socket=...) although that parameter is not used by the
http protocol backend.

> The question I asked in the previous e-mail, which still needs to be
> answered no matter what scheme is ultimately chosen, is this:
> 
> Under what circumstances should the query string be appended to the path?

If there are two separate parameters (path, optional query string) to
guestfs_add_drive then I hope it's clear when - you'd append the query
string when the query string is passed by the caller.

Rich.

-- 
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
Read my programming and virtualization blog: http://rwmj.wordpress.com
virt-df lists disk usage of guests without needing to install any
software inside the virtual machine.  Supports Linux and Windows.
http://people.redhat.com/~rjones/virt-df/




More information about the Libguestfs mailing list