cURL / Mailing Lists / curl-library / Single Mail

curl-library

curl_escape() and curl_unescape() mods

From: Combes, Chris M. <ccombes_at_northropgrumman.com>
Date: Mon, 08 Jul 2002 15:46:26 -0400

Hello,

Below is a diff for some changes to curl_escape()
and curl_unescape().

The issue that the changes address is that of converting
spaces to %20 (hex counterpart) instead of a '+'.
RFC 2396 defines that spaces should be converted to %20.

Also, I think that if curl_escape() is called on a
string, curl_unescape() should the return the
original string.

I welcome any comments.

Hopefully Daniel can incorporate when he gets
back from vacation.

Thanks,
Chris

/curl-7.9.8/lib/escape.c

51,52c51,53
<
< if(!(in >= 'a' && in <= 'z') &&

---
>     if(' ' == in)
>       ns[index++] = '+';
>     else if(!(in >= 'a' && in <= 'z') &&
85,87c86,88
<                            the "query part".
<                            RFC 2396, section 2.2 */
< 
---
>                            the "query part" where '+' should become ' '.
>                            RFC 2316, section 3.10 */
>   
90,91c91,93
< 
<  if(!querypart && ('?' == in)) {
---
>     if(querypart && ('+' == in))
>       in = ' ';
>     else if(!querypart && ('?' == in)) {
119,121d120
< 
< 
<
-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Oh, it's good to be a geek.
http://thinkgeek.com/sf
Received on 2002-07-08