cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: App dies at curl_easy_perform (possibly related to connect.c)

From: Dan Fandrich <dan_at_coneharvesters.com>
Date: Tue, 23 Nov 2010 22:57:35 -0800

On Tue, Nov 23, 2010 at 09:13:51PM -0800, M D wrote:
> I'm using curl 7.2.1, zlib 1.2.5, and openssl 0.9.8o for this app.

I hope that's a typo--version 7.2.1 dates from before the dawn of Man.
On what platform is this?

> VERBOSE output merely gives a message similar to the following:
>
>
> * About to connect() to secured.example.com port 443 (#0)
> * Trying xxx.xxx.xxx.xxx... * connected
> * Connected to secured.example.com (xxx.xxx.xxx.xxx) port 443 (#0)

And then what? You say the app dies. How? With a signal?

> Here are snippets of the relevant code:
>
>
> string strURL;
> CURLcode res;
> char* s;
> struct curl_slist *headerlist=NULL;
> static const char buf[] = "Expect:";
> CURL *curl;
> .
> .
> .
> curl = curl_easy_init();
> headerlist = curl_slist_append(headerlist, buf);
> curl_easy_setopt(curl, CURLOPT_HTTPHEADER, headerlist);
> curl_easy_setopt(curl, CURLOPT_POSTFIELDS, s);
> curl_easy_setopt(curl, CURLOPT_URL, strURL.c_str());
> curl_easy_setopt(curl, CURLOPT_POSTFIELDS, s);

You're providing CURLOPT_POSTFIELDS twice. I'm not sure what the behaviour
is going to be in that case.

> curl_easy_setopt(curl, CURLOPT_VERBOSE, 1);

Note that integers as curl_easy_setopt must be of type long, not int.

> res = curl_easy_perform(curl);
>
>
>
> Debugger seems to be pointing to line 461 of connect.c
>
>
> /*
> * verifyconnect() returns TRUE if the connect really has happened.
> */
> static bool verifyconnect(curl_socket_t sockfd, int *error)
> .
> .
> .
> if(0 != getsockopt(sockfd, SOL_SOCKET, SO_ERROR, (void *)&err, &errSize))

There doesn't seem to be anything on that line that could cause a signal
causing application abort. It would be useful to know exactly what the
problem is at this point.

> Are there any typical problems that would cause a problem like this? Alternatively, any tips on pinpointing what I'm doing wrong?

Nothing I can think of (unless you're using a 10 year old libcurl, of course).
A debugger should be able to give you more information about exactly what's
going wrong there.

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