cURL / Mailing Lists / curl-library / Single Mail


Re: Curl_readrewind and form data

From: Daniel Stenberg <>
Date: Mon, 30 Sep 2013 15:02:50 +0200 (CEST)

On Sun, 29 Sep 2013, Joshua Kwan wrote:

> Been a while, hope you remember me. :)

Hi again Joshua! My scripts tell me it was 3+ years ago since your previous
appareance here! =)

> We're using cURL these days to do a POST of form data. When combined with
> proxy authentication and ANYAUTH behavior, there's a bug with rewinding the
> input data. Here's some source snippets:

Yes, I believe this is due to a complete oversight of this problem by me when
CURLFORM_STREAM was introduced!

> When sending this using ANYAUTH and receiving a 407, we try again after
> setting the proper proxy credentials, but the file is already completely
> read from the first request and not rewound due to this code, so the
> attachment is blank. We thought it was because we don't have a SEEKFUNCTION,
> but defining it did not help because of the logic in Curl_readrewind.
> Is there any reason *not* to rewind the file in this situation?

No, the rewinding feature was introduced exactly for this kind of use case,
when the application handles the data and the protocol forces libcurl to send
the data more than once.

The oversight was that I didn't consider the CURLFORM_STREAM case and the need
to rewind that as well.

Would it work for you with calling the seekfunction for this?

List admin:
Received on 2013-09-30