Re: Patch for CURLOPT_CONNECT_ONLY
Date: Wed, 22 Mar 2006 09:12:22 +0100 (CET)
On Wed, 22 Mar 2006, Nilesh wrote:
> I tried checking erros for each library API call and found that setting
> CONNECT_ONLY option itself fails.
> This is what I tried,
> if((res=curl_easy_setopt(curl, CURLOPT_CONNECT_ONLY, 1)) != CURLE_OK)
> printf("Error setting CURLOPT_CONNECT_ONLY[%d][%s]\n",
> CURLOPT_CONNECT_ONLY, curl_easy_strerror(res));
> /Getting following output,,
> /Error setting CURLOPT_CONNECT_ONLY[failed init]
I would say this hints about you having the correct headers at build-time but
using the wrong libcurl version at run-time.
>>> - With first perform I can check if connection can be established with
>>> - Only after successfull connection establishment, I can transfer data
>>> using same curl handle. Ofcourse while doing data transfer, connection may
>>> go down, that time perform call may fail which is fine.
>>> If not CONNECT_ONLY, what is the way I can get above implemented.
I would say that using CONNECT_ONLY for this case seems nothing but wrong.
You should simply do the POST (or whatever method you use). libcurl will
report back if it can't make the connection or if anything else fails. You
won't gain anything by first setting up a connection "manually" only to do a
second call to libcurl to do the actual transfer.
Unless I misunderstood what you want to do of course.
-- Commercial curl and libcurl Technical Support: http://haxx.se/curl.htmlReceived on 2006-03-22