curl / Mailing Lists / curl-library / Single Mail

curl-library

Re: Question: Send data with redirection and without SEEK_FUNCTION

From: Andrew Lambert via curl-library <curl-library_at_cool.haxx.se>
Date: Mon, 4 Feb 2019 22:38:28 -0800

On 2/1/2019 5:52 AM, Felipe Kersting via curl-library wrote:
> Hello developers,
>
> I have the following problem:
>
> I'm using libcurl to send a large chunk of data to a server, using a URL
> that always redirects me to the real endpoint via a reponse with 307
> HTTP status + Location. I have set my CURLOPT_READFUNCTION callback to
> properly fetch my data, and when CURLOPT_SEEKFUNCTION is also set, my
> request works. The data is sent succesfully.
>
> However, depending on the size of the data, I can't provide the
> SEEK_FUNCTION to libcurl, because the data can't fit in the local
> storage. So, my idea is to send the data dynamically using the
> READ_FUNCTION. The problem is that, when I don't provide the
> SEEK_FUNCTION, my request fails with the following error:
> curl_easy_perform() failed: Send failed since rewinding of the data
> stream failed
>
> I think the redirection is also helping to make things worse.
>
> Is there a workaround here? Is it possible to send a large chunk of data
> without the SEEK function?
>
> Thank you!
> Felipe
>
> -------------------------------------------------------------------
> Unsubscribe: https://cool.haxx.se/list/listinfo/curl-library
> Etiquette: https://curl.haxx.se/mail/etiquette.html
>

Try returning CURL_SEEKFUNC_CANTSEEK (-2) from the SEEK_FUNCTION.

Regards,
Andrew Lambert
-------------------------------------------------------------------
Unsubscribe: https://cool.haxx.se/list/listinfo/curl-library
Etiquette: https://curl.haxx.se/mail/etiquette.html
Received on 2019-02-05