[gdal-dev] CPLEscapeString URL - encoding characters that don't need to be encoded

Timothy Astle tastle at caris.com
Thu Jun 19 08:17:28 PDT 2014


I've provided a patch and some context in this ticket.

http://trac.osgeo.org/gdal/ticket/5526

Thank you for your feedback!


Tim


On 18/06/2014 2:02 PM, Timothy Astle wrote:
> Yes, that could be possible.
>
> Aweb server should try to URL decode anything that has been encoded, 
> that is, any %xx token.
>
> But I have hit one server that doesn't do this, and that's why I'm 
> here. It doesn't seem to be doing any decoding. :(
>
>
> Tim
>
>
> On 18/06/2014 10:18 AM, Even Rouault wrote:
>> Le mercredi 18 juin 2014 14:47:47, Timothy Astle a écrit :
>>> I was thinking something like the following:
>>>
>>>                if( (pszInput[iIn] >= 'a' && pszInput[iIn] <= 'z')
>>>
>>>                    || (pszInput[iIn] >= 'A' && pszInput[iIn] <= 'Z')
>>>                    || (pszInput[iIn] >= '0' && pszInput[iIn] <= '9')
>>>
>>> -                || pszInput[iIn] == '_' || pszInput[iIn] == '.' )
>>> +                || pszInput[iIn] == '$' && pszInput[iIn] == '-'
>>> +                || pszInput[iIn] == '_' || pszInput[iIn] == '.'
>>> +                || pszInput[iIn] == '+' && pszInput[iIn] == '!'
>>> +                || pszInput[iIn] == '*' && pszInput[iIn] == '\''
>>> +                || pszInput[iIn] == '(' && pszInput[iIn] == ')'
>>> +                || pszInput[iIn] == '"' && pszInput[iIn] == ',' )
>>>
>>> which follows the list of special characters that may be used unencoded
>>> within a URL.
>>>
>>>      Thus, only alphanumerics, the special characters "$-_.+!*'(),", and
>>>      reserved characters used for their reserved purposes may be used
>>>      unencoded within a URL.
>>>
>>> That list is mutually exclusive from the list you cited as being a
>>> concern, which I agree with.
>> Looks reasonable, although I anticipate we might hit server bugs if changing
>> that...
>>
>>> Tim
>>>
>>> On 17/06/2014 6:24 PM, Even Rouault wrote:
>>>> Le lundi 16 juin 2014 14:20:59, Timothy Astle a écrit :
>>>>> Hi all,
>>>>>
>>>>> Does anyone know why CPLEscapeString
>>>>> (https://svn.osgeo.org/gdal/trunk/gdal/port/cpl_string.cpp) character
>>>>> encodes characters that are valid as-is according to
>>>>> http://www.ietf.org/rfc/rfc1738.txt?
>>>>>
>>>>> I just hit a situation where I noticed the WMS driver is converting
>>>>> hyphens to %2D for layer names.  The 3rd party server doesn't handle it
>>>>> (but it should) and this caught my attention.
>>>>>
>>>>> Any thoughts?  Is it just a case where a patch would be welcome?
>>>> Tim,
>>>>
>>>> What would your patch do ? Implement the following from RFC1738 ? :
>>>>
>>>> "Thus, only alphanumerics, the special characters "$-_.+!*'(),", and
>>>> reserved characters used for their reserved purposes may be used
>>>> unencoded within a URL."
>>>>
>>>> Well, actually I think it should still encode the reserved characters
>>>> (";",
>>>>
>>>>    "/", "?", ":", "@", "=" and "&"), since valid use cases of
>>>>    CPLEscapeString(,
>>>>
>>>> CPLES_URL) might be do make sure that they are encoded.
>>>>
>>>> Even
>
> -- 
> Tim Astle
> Development Manager
> Web Technologies
>
> *CARIS* <http://www.caris.com>
> 115 Waggoners Lane
> Fredericton, New Brunswick
> Canada    E3B 2L4
> Tel: +1.506.458.8533     Fax: +1.506.459.3849
> www.caris.com <http://www.caris.com>
>
> *Connect with CARIS*
> Twitter <http://www.twitter.com/CARIS_GIS> | LinkedIn 
> <http://www.linkedin.com/groups?mostPopular=&gid=3217878> | Facebook 
> <https://www.facebook.com/pages/CARIS-The-Marine-GIS-Experts/123907500987669?v=app_4949752878> 
> | Google+ 
> <https://plus.google.com/b/114389770462919844434/114389770462919844434/posts> 
> | YouTube <http://www.youtube.com/user/CARISGIS>
>
> Download your free copy of CARIS Easy View today!
> www.caris.com/easyview <http://www.caris.com/easyview>
>
> _________________________________________________________________________
> This email and any files transmitted with it are confidential and 
> intended only for the addressee(s). If you are not the intended 
> recipient(s) please notify us by email reply. You should not use, 
> disclose, distribute or copy this communication if received in error.
>
> Any views or opinions expressed in this email are solely those of the 
> author and do not necessarily represent those of the company. No 
> binding contract will result from this email until such time as a 
> written document is signed on behalf of the company.
>

-- 
Tim Astle
Development Manager
Web Technologies

*CARIS* <http://www.caris.com>
115 Waggoners Lane
Fredericton, New Brunswick
Canada    E3B 2L4
Tel: +1.506.458.8533     Fax: +1.506.459.3849
www.caris.com <http://www.caris.com>

*Connect with CARIS*
Twitter <http://www.twitter.com/CARIS_GIS> | LinkedIn 
<http://www.linkedin.com/groups?mostPopular=&gid=3217878> | Facebook 
<https://www.facebook.com/pages/CARIS-The-Marine-GIS-Experts/123907500987669?v=app_4949752878> 
| Google+ 
<https://plus.google.com/b/114389770462919844434/114389770462919844434/posts> 
| YouTube <http://www.youtube.com/user/CARISGIS>

Download your free copy of CARIS Easy View today!
www.caris.com/easyview <http://www.caris.com/easyview>

_________________________________________________________________________
This email and any files transmitted with it are confidential and 
intended only for the addressee(s). If you are not the intended 
recipient(s) please notify us by email reply. You should not use, 
disclose, distribute or copy this communication if received in error.

Any views or opinions expressed in this email are solely those of the 
author and do not necessarily represent those of the company. No binding 
contract will result from this email until such time as a written 
document is signed on behalf of the company.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/gdal-dev/attachments/20140619/aa3edee7/attachment.html>


More information about the gdal-dev mailing list