cURL / Mailing Lists / curl-library / Single Mail


Re: Seek function

From: Georg Lippitsch <>
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):


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
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


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