[ipxe-devel] uri_encode and special characters.

Nicolas Sylvain nsylvain at gmail.com
Tue May 5 23:42:43 UTC 2015


hi,

I'd like to propose adding "+" and "/" to the list of characters to encode
in the query string of a URL.

There is already a comment that says that we should not encode "/", but I
think it might be wrong.

According to the RFC (http://tools.ietf.org/html/rfc3986) the "/" is a
reserved character.  The "Special Characters in URLs" section of
http://www.skorks.com/2010/05/what-every-developer-should-know-about-urls/
touches on this a bit as well.

This is biting me because I'm trying to fetch my boot image using a Google
Cloud Storage signed URL (
https://cloud.google.com/storage/docs/access-control#Assembling-the-URL)
and it says :

*URLencode the signature you created. (The Base64 encoded signature may
contain characters not legal in URLs (specifically + and /). These values
must be replaced by safe encodings (%2B and %2F, respectively)*.


Here's the patch, if you decide to accept it.

Thank you!

Nicolas

--- a/src/core/uri.c
+++ b/src/core/uri.c
@@ -138,10 +138,9 @@ static int uri_character_escaped ( char c, unsigned
int field ) {
                 * appears within paths.
                 */
                [URI_PATH]      = "#:@?",
-               /* Query: escape everything except '/', which
-                * sometimes appears within queries.
+               /* Query: escape everything.
                 */
-               [URI_QUERY]     = "#:@?",
+               [URI_QUERY]     = "/#:@?+",
                /* Fragment: escape everything */
                [URI_FRAGMENT]  = "/#:@?",
        };
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.ipxe.org/pipermail/ipxe-devel/attachments/20150505/102a9540/attachment.htm>


More information about the ipxe-devel mailing list