cURL / Mailing Lists / curl-users / Single Mail

curl-users

Re: url encoding question

From: Daniel Stenberg <daniel-curl_at_haxx.se>
Date: Fri, 19 Dec 2003 08:44:17 +0100 (CET)

On Thu, 18 Dec 2003, David Byron wrote:

> Here's my situation. I need my URL to eventually be the url-encoded version
> of:
>
> http://www.foo.com/blah blah/nasty file name.asp?yucky data=5
>
> I already handle the ?yucky data=5 part by url-encoding it myself and then
> calling --data.
>
> So, I'm left with handling
>
> http://www.foo.com/blah blah/nasty file name.asp
>
> myself.
>
> I see all that nice url parsing code in lib/url.c and it seems like there's
> probably an easy place to call curl_escape there.
>
> Anyone know where that place is (in lib/url.c or maybe elsewhere)? If I can
> find it/them and send a patch, is there a good chance it'll get accepted?
> I'm guessing it would have to be via a new option so all the people that
> pass already-encoded urls won't have to change anything.

Yes, this subject is brought up from time to time. The last time I can recall
was debated on the curl-library list only a few weeks ago:

        http://curl.haxx.se/mail/lib-2003-12/0050.html

The short version of this is: no, we cannot escape an already put together
URL, as we cannot be sure what parts of it that would need escaping. Escaping
needs to be done _before_ the parts are put together to form a URL.

-- 
    Daniel Stenberg -- http://curl.haxx.se/ -- http://daniel.haxx.se/
   [[ Do not send mails to this email address. They won't reach me. ]]
-------------------------------------------------------
This SF.net email is sponsored by: IBM Linux Tutorials.
Become an expert in LINUX or just sharpen your skills.  Sign up for IBM's
Free Linux Tutorials.  Learn everything from the bash shell to sys admin.
Click now! http://ads.osdn.com/?ad_id=1278&alloc_id=3371&op=click
Received on 2003-12-19