RE: curl_easy_perform hangs when trying to read response headers
Date: Tue, 11 Nov 2008 12:29:13 +0530
On Mon, 10 Nov 2008, Ambarish Mitra wrote:
> I am trying to get the HTTP response from a simple servlet, but the
> hangs at curl_easy_perform, and does not come out of it even if the
> has completed.
So the regular curl tool hangs on this URL too?
--- AM: No, it doesnt. And I have found out my error in the code. (I should have paid more attention to the curl_easy_setopt manpages first...sigh). My intention was to do a zero-data POST, so I did "curl_easy_setopt(hCurl,CURLOPT_POST);" okay, but forgot to set CURLOPT_POSTFIELDSIZE to 0. Essentially, this meant (I think) that the CURL framework expected a user-defined callback function to create the post data, which never happened. So, it blocked after dispatching the request. Now, I have: curl_easy_setopt(hCurl,CURLOPT_POST); curl_easy_setopt(hCurl,CURLOPT_POSTFIELDSIZE, 0); and the program works well. This was well documented in the man pages. Thanks for pointing me to the right direction of using the command line "curl" tool. DISCLAIMER ========== This e-mail may contain privileged and confidential information which is the property of Persistent Systems Ltd. It is intended only for the use of the individual or entity to which it is addressed. If you are not the intended recipient, you are not authorized to read, retain, copy, print, distribute or use this message. If you have received this communication in error, please notify the sender and delete all copies of this message. Persistent Systems Ltd. does not accept any liability for virus infected mails.Received on 2008-11-11