After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 703776 - URI scheme does not support digit character
URI scheme does not support digit character
Status: RESOLVED FIXED
Product: libsoup
Classification: Core
Component: API
2.43.x
Other Linux
: Normal normal
: ---
Assigned To: libsoup-maint@gnome.bugs
libsoup-maint@gnome.bugs
Depends on:
Blocks:
 
 
Reported: 2013-07-08 09:54 UTC by Paul HENRYS
Modified: 2013-07-13 15:58 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Patch (879 bytes, patch)
2013-07-08 09:54 UTC, Paul HENRYS
needs-work Details | Review

Description Paul HENRYS 2013-07-08 09:54:27 UTC
Created attachment 248597 [details] [review]
Patch

When creating a new URI with soup_uri_new() with a specific scheme with numbers inside (e.g.: v4l2), it fails to create the URI.
In soup_uri_new_with_base(), it only support alphabetic character as it uses the function g_ascii_isalpha. In the patch in attachment, I added the use of g_ascii_isalnum() to support digits.
This should be compliant with RFC3986 as described in appendix A:

scheme        = ALPHA *( ALPHA / DIGIT / "+" / "-" / "." )
Comment 1 Dan Winship 2013-07-08 14:05:03 UTC
Comment on attachment 248597 [details] [review]
Patch

Oops. Wonder how I missed that.

>-	/* Find scheme: initial [a-z+.-]* substring until ":" */
>+	/* Find scheme: initial [a-z0-9+.-]* substring until ":" */
> 	p = uri_string;
>-	while (p < end && (g_ascii_isalpha (*p) ||
>+	while (p < end && (g_ascii_isalpha (*p) || g_ascii_isalnum (*p) ||

"isalpha || isalnum" is redundant; you only need the latter. But this patch isn't quite right: the first character has to be ALPHA, not a number or symbol.
Comment 2 Paul HENRYS 2013-07-08 14:45:52 UTC
Read to fast about isalnum, it's indeed redundant and indeed the patch is wrong if the first character has to be alpha.
Thx for the remarks. Let me know if you provide a fix for this or if you want me to provide one.

Cheers
Comment 3 Dan Winship 2013-07-13 15:58:52 UTC
fixed in master