[xml] [PATCH 0/2] uri: Don't spoil addresses when formatting them
- From: Martin Kletzander <mkletzan redhat com>
- To: xml gnome org
- Subject: [xml] [PATCH 0/2] uri: Don't spoil addresses when formatting them
- Date: Mon, 29 Sep 2014 10:09:57 +0200
[resending because it appears that my previous posting haven't reached
the list]
Since commit 8eb55d782a2b9afacc7938694891cc6fad7b42a5, when you parse
and save an URI that has no server (or similar) part, two slashes
after the 'schema:' get lost. It means 'uri:///noserver' is turned
into 'uri:/noserver'.
This can break some applicatication that rely on those slashes to be
in (e.g. libvirt). This micro-series proposes 2 different approaches
to fixing this that have one slight difference. Approach 1 adds a
field "slashes_used" into the xmlURI structure that is set to 1 if and
only if double slashes were skipped when parsing. The other approach
simply checks whether path is absolute (starting with '/' and adds
those two slashes when that condition is true.
The difference is that the second approach changes 'uri:/only/path' to
'uri:///only/path', but doesn't fiddle with the structure insides.
The probelm is caused by adaptations in RFC 3986 being ambiguously
implemented in uri.c; for example after skipping "//", the parsing can
follow almost the same rules or for example after skipping first '/'
in the path the code can be exactly the same but there are more
functions for that. Nevertheless this series aims to fix the issue
caused by commit 8eb55d782a2b9afacc7938694891cc6fad7b42a5 and leaves
these cleanups to be done as a follow-up patch later on.
I'm Cc'ing the author of 8eb55d782a2b9afacc7938694891cc6fad7b42a5 in
order for him to be able to check this patch and let me (us) know
whether the approaches proposed here are also usable as a fix for
their use case.
Martin Kletzander (2):
Revert "xmlSaveUri() incorrectly recomposes URIs with rootless paths"
uri: don't force double slashes with rootless paths
uri.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
--
2.1.1
[
Date Prev][Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]