[libvirt] [PATCH 13/19] util: buffer: Properly URLencode strings

Ján Tomko jtomko at redhat.com
Thu Oct 24 14:37:48 UTC 2019


On Thu, Oct 24, 2019 at 03:56:31PM +0200, Peter Krempa wrote:
>According to rfc3986:
>

Ah, it's been a while since I read that.

>2.3.  Unreserved Characters
>
>   Characters that are allowed in a URI but do not have a reserved
>   purpose are called unreserved.  These include uppercase and lowercase
>   letters, decimal digits, hyphen, period, underscore, and tilde.
>
>      unreserved  = ALPHA / DIGIT / "-" / "." / "_" / "~"
>
>   URIs that differ in the replacement of an unreserved character with
>   its corresponding percent-encoded US-ASCII octet are equivalent: they
>   identify the same resource.  However, URI comparison implementations
>   do not always perform normalization prior to comparison (see Section
>   6).  For consistency, percent-encoded octets in the ranges of ALPHA
>   (%41-%5A and %61-%7A), DIGIT (%30-%39), hyphen (%2D), period (%2E),
>   underscore (%5F), or tilde (%7E) should not be created by URI
>   producers and, when found in a URI, should be decoded to their
>   corresponding unreserved characters by URI normalizers.
>
>Thus we must not include few other characters which don't match
>c_isalpha to conform to the rules.
>
>Signed-off-by: Peter Krempa <pkrempa at redhat.com>
>---
> src/util/virbuffer.c | 14 ++++++++++++--
> tests/viruritest.c   |  2 +-
> 2 files changed, 13 insertions(+), 3 deletions(-)
>

Reviewed-by: Ján Tomko <jtomko at redhat.com>

Jano
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 488 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20191024/29ba9f44/attachment-0001.sig>


More information about the libvir-list mailing list