cURL / Mailing Lists / curl-library / Single Mail

curl-library

RE: UTF8_CONVERSION_ERROR_NEGATIVE failure

From: Gross, Tim (Utility Computing Architect) <tim.gross_at_hp.com>
Date: Mon, 21 Sep 2009 18:46:49 +0000

Daniel,
I think I have figured out the problem. I do the following, prior to the curl_easy_perform() call:

   char *temp_url = new char[100];
   strcpy(temp_url, "http://myserver.com/whatever.cgi");
   cURLres = curl_easy_setopt(m_curl, CURLOPT_URL, temp_url);
   free(temp_url);

From the documentation for curl_easy_setopt(), it appears that the third parameter (in my code temp_url) is copied and therefore it is safe to deallocate it after the call to curl_easy_setopt(). But this yields the failure that I described in my initial message. It seems the problem is that the url is not valid when I invoke the curl_easy_perform() API.

Furthermore, when I comment out the "free(temp_url)" statement, it is successful. This is contrary to the documentation, but seems to be the fix. Can you confirm this?

I am using version 7.19.4 on RHEL 5.1. I download the RPM.

Thanks,
Tim.

-----Original Message-----
From: curl-library-bounces_at_cool.haxx.se [mailto:curl-library-bounces_at_cool.haxx.se] On Behalf Of Daniel Stenberg
Sent: Monday, September 21, 2009 12:24 AM
To: libcurl development
Subject: Re: UTF8_CONVERSION_ERROR_NEGATIVE failure

On Sun, 20 Sep 2009, Gross, Tim (Utility Computing Architect) wrote:

> When I do a curl_easy_perform(), it always fails.
>
> res = curl_easy_perform(m_curl);
>
> if(res != CURLE_OK)
> {
> printf("Detailed CURL error: %s\n",sDetailedErrorInfo);
> }
>
> Sometimes this prints out UTF8_CONVERSION_ERROR_NEGATIVE and sometimes
> it has garbage characters in it. Has anybody seen this before?

What libcurl version on what OS? Did you build the lib yourself or did you get a prebuilt version from somewhere?

How is 'sDetailedErrorInfo' populated?

-- 
  / daniel.haxx.se
Received on 2009-09-21