Re: Issue - necessary data rewind wasn't possible

2013-12-11 Thread Daniel Stenberg

On Wed, 11 Dec 2013, sachin dravid wrote:


Curl logs:
===
-connection died retrying a fresh connect
-necessary data rewind wasn't possible
===

Sometimes it gets success in retry but sometimes it fails with
necessary data rewind wasn't possible.

Can anyone explain reason for this and how to handle it?


Use CURLOPT_SEEKFUNCTION to set a callback that allows seeking back in the 
stream to allow libcurl to resend data.


  http://curl.haxx.se/libcurl/c/curl_easy_setopt.html#CURLOPTSEEKFUNCTION

One of the observation is that I am getting this error with SSL(https). 
Without SSL it is working fine.


At times libcurl needs to resend data it already sent in a POST/PUT request, 
and if it can't rewind that data on its own you need to provide a way for it 
to do it.


--

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


Re: Issue - necessary data rewind wasn't possible

2013-12-11 Thread sachin dravid
Thanks for the help!!

I have one more question on this. In this situation I am getting
CURLE_OK. Because the connection has broken, I don't have HTTP code as
well.
I can make a retry on this particular case from my application, but if
I get CURLE_OK how does my application recognize it?

Could you please tell me how can my application recognize for retry in
this case?
Also, if possible kindly send me some reference example of
CURLOPT_SEEKFUNCTION, as I am not able to find it on WWW.

Thanks,
Sachin


On Wed, Dec 11, 2013 at 8:35 PM, Daniel Stenberg dan...@haxx.se wrote:
 On Wed, 11 Dec 2013, sachin dravid wrote:

 Curl logs:
 ===
 -connection died retrying a fresh connect
 -necessary data rewind wasn't possible
 ===

 Sometimes it gets success in retry but sometimes it fails with
 necessary data rewind wasn't possible.

 Can anyone explain reason for this and how to handle it?


 Use CURLOPT_SEEKFUNCTION to set a callback that allows seeking back in the
 stream to allow libcurl to resend data.

   http://curl.haxx.se/libcurl/c/curl_easy_setopt.html#CURLOPTSEEKFUNCTION


 One of the observation is that I am getting this error with SSL(https).
 Without SSL it is working fine.


 At times libcurl needs to resend data it already sent in a POST/PUT request,
 and if it can't rewind that data on its own you need to provide a way for it
 to do it.

 --

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



-- 
Thanks and Regards,
Sachin Dravid
---
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette:  http://curl.haxx.se/mail/etiquette.html


RE: Issue - necessary data rewind wasn't possible

2013-12-11 Thread Yehezkel Horowitz
I have one more question on this. In this situation I am getting CURLE_OK. 
Because the connection has broken, I don't have HTTP code as well.
I can make a retry on this particular case from my application, but if I get 
CURLE_OK how does my application recognize it?

Could you please tell me how can my application recognize for retry in this 
case?
You should use CURLOPT_IOCTLFUNCTION and you will be called with 
CURLIOCMD_RESTARTREAD.

HTH
Yehezkel Horowitz

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