curl-library
Re: At (@) in user or password
From: Daniel Stenberg <daniel_at_haxx.se>
Date: Thu, 3 Apr 2003 08:50:24 +0200 (CEST)
Date: Thu, 3 Apr 2003 08:50:24 +0200 (CEST)
On Wed, 2 Apr 2003, Andy Cedilnik wrote:
> Simple question. I want to use:
> ::curl_easy_setopt(curl,CURLOPT_URL, someurl.c_str());
>
> So I create someurl:
>
> someurl = "ftp://"
> someurl += username;
> someurl += ":";
> someurl += password;
> someurl += "@"
> someurl += hostname;
> someurl += remotedir;
>
> Now, when username or password contain @, the whole thing fails. Curl is
> attempting to use <part of password>@hostname as the hostname.
>
> So, do I escape @? Maybe something like %40?
Yes, username and password should both be URL encoded. You can use
curl_escape() to do it.
-- Daniel Stenberg -- curl, cURL, Curl, CURL. Groks URLs. ------------------------------------------------------- This SF.net email is sponsored by: ValueWeb: Dedicated Hosting for just $79/mo with 500 GB of bandwidth! No other company gives more support or power for your dedicated server http://click.atdmt.com/AFF/go/sdnxxaff00300020aff/direct/01/Received on 2003-04-03