curl-library
Re: Patch for CURLOPT_CONNECT_ONLY
From: Nilesh <nilesh_at_kenati.com>
Date: Tue, 21 Mar 2006 12:20:40 +0530
Date: Tue, 21 Mar 2006 12:20:40 +0530
Has anybody got any idea about this ?
-- Nilesh Nilesh wrote: > > >>> Also if I can get working example for this option, that will be >>> helpful. >> >> >> >> I would like that too, for inclusion in the package. > > > Following is what I am trying to do to test CONNECT_ONLY option. ( I > used simplepost.c example with small modification ) > > /int main(void) > { > CURL *curl; > CURLcode res; > long last_sock=0; > > char *postthis="moo mooo moo moo"; > > curl = curl_easy_init(); > if(curl) { > * curl_easy_setopt(curl, CURLOPT_URL, "http://testwebserver"); > curl_easy_setopt(curl, CURLOPT_CONNECT_ONLY, 1); > > res = curl_easy_perform(curl); > res = curl_easy_getinfo(curl, CURLINFO_LASTSOCKET, &last_sock); > printf("Return code frm curl_easy_getinfo [%d][%s]\n", res, > curl_easy_strerror(res)); // this gives res=43 > printf("curl_easy_getinfo returned CURLINFO_LASTSOCKET [%ld]\n", > last_sock); // last_sock is still 0 > if(CURLE_OK == res) > { > printf("curl_easy_getinfo returned CURLINFO_LASTSOCKET > [%ld]\n", last_sock); > } > * > curl_easy_setopt(curl, CURLOPT_POSTFIELDS, postthis); > > /* if we don't provide POSTFIELDSIZE, libcurl will strlen() by > itself */ > curl_easy_setopt(curl, CURLOPT_POSTFIELDSIZE, strlen(postthis)); > > res = curl_easy_perform(curl); > > /* always cleanup */ > curl_easy_cleanup(curl); > } > return 0; > } > / > Getting following output: > > */Return code frm curl_easy_getinfo [43][a libcurl function was given > a bad argument] > curl_easy_getinfo returned CURLINFO_LASTSOCKET [0] > / > *Can you help me to understand how CONNECT_ONLY be used ? > > Thanks, > Nilesh > > > > > >Received on 2006-03-21