cURL / Mailing Lists / curl-library / Single Mail

curl-library

Misterious URL behavior when using local variables to pass it

From: Paulo Garcia <paulo.astuser_at_gmail.com>
Date: Tue, 23 Nov 2010 16:54:57 -0500

Hi,
I'm creating a C++ application (Windows 7 32 bits/VS 2010) and I'm
having an interesting behavior.

Basically I'm trying to grab files from depositfile.com directly. If I
set my URL like this:

char localUrl[MAX_FILEPATH];
sprintf(localUrl,"http://depositfiles.com%s", redirection);
curl_easy_setopt(handle, CURLOPT_URL, localUrl);
res = curl_easy_perform(handle);

I get an error "400 Bad Request".

But, if I send exactly the same URL as constant, like this:

curl_easy_setopt(handle, CURLOPT_URL,
"http://depositfiles.com/en/files/6kpdasddasa3svf");

I get the right page!

I have checked the content of localUrl before calling the
curl_easy_perform() function, and it is exactly the same (using
debug).

I cannot see what's wrong.

Any ideas?

Thanks in advance!

--
--------------------------------------------
Paulo
-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette:  http://curl.haxx.se/mail/etiquette.html
Received on 2010-11-24