Hi everyone. I'm coding a wikipedia bot in C99. My code does the following calls in sequence.

curl_easy_setopt ( curl, CURLOPT_USERAGENT , szuseragent ) ;
curl_easy_setopt ( curl , CURLOPT_VERBOSE , uiverbose ) ;
curl_easy_setopt ( curl, CURLOPT_NOPROGRESS , uipm ) ;
curl_easy_setopt ( curl, CURLOPT_COOKIEFILE, "" ) ;
curl_slist_append ( *pheaderlist , sznohundredcontinue ) ;
curl_easy_setopt ( curl, CURLOPT_HTTPHEADER , *pheaderlist ) ;
curl_easy_setopt ( curl, CURLOPT_URL , szURL ) ;
curl_easy_setopt ( curl, CURLOPT_WRITEFUNCTION, Writecallback ) ;
curl_easy_setopt ( curl, CURLOPT_WRITEHEADER, &headerchunk ) ;
curl_easy_setopt ( curl, CURLOPT_WRITEDATA, &bodychunk ) ;
curl_easy_setopt ( curl, CURLOPT_HTTPPOST , firstptr ) ;

curl_formadd (...)
curl_formadd (...)
curl_formadd (...)

curl_easy_perform ( curl ) ;

Now, if curl_easy_perform fails due to certain recoverable errors (HTTP 503, Wikipedia is lagging, etc) I call curl_easy_perform up to 9 more times, sleeping for 60 seconds in between each call. Yet, if the first call fails, the next 9 times invariably each fail within a fraction of a second. I think it's because one or more of the setup functions need to be called again.

1. Of all the curl_easy_setopt() calls above preceding the curl_easy_perform () , am I right in thinking that they only need to be called once and that repeated calls to curl_easy_perform () will not cause libcurl to "forget" those settings ?

2.  For the curl_formadd() functions, do they need to be called again?

3. Part of the reason why I'm asking is that I can't figure out a way to see what libcurl is sending to Wikipedia. I can see the reply easily enough by printing out the data buffers. Is there a way for me to see what libcurl is sending?

Richard




-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette:  http://curl.haxx.se/mail/etiquette.html

Reply via email to