cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: Seek function

From: Georg Lippitsch <georg.lippitsch_at_gmx.at>
Date: Tue, 8 Jan 2008 20:11:40 +0100

Here is another patch which is intended to add the following options to
curl_easy_setopt (Note applied and compiled with CVS from 2008-01-07, but in
the meantime things might have changed):

CURLOPT_SEEKFUNCTION

Function pointer that should match the following prototype: int function(void
*instream, curl_off_t offset, int origin); This function gets called by
libcurl for seeking to a certain position in the stream and can be used to
fast forward a file in a resumed upload (instead of reading all uploaded
bytes with normal read_function). It is also called to rewind a stream when
doing a HTTP PUT or POST with a multi-pass authentication method. The
function shall work like "fseek" or "lseek" and accepted SEEK_SET, SEEK_CUR
and SEEK_END as argument for origin, although (from 7.18.0) curl only passes
SEEK_SET.
Note: If you point this directly to "fseek" or "lseek", take care that that
data type for offset is not the same as defined in curl_off_t on many
systems!

CURLOPT_SEEKDATA

Data pointer to pass to the file read function. If you use the
CURLOPT_SEEKFUNCTION option, this is the pointer you'll get as input. If you
don't specify a seek callback, NULL is passed.

Received on 2008-01-08