cURL / Mailing Lists / curl-users / Single Mail

curl-users

url_fseek implementation for fopen example on curl

From: venkatesh u <venkat.uppar_at_gmail.com>
Date: Thu, 22 Oct 2009 06:01:42 +0530

Hi All,

Pls let me know any one worked on url_fseek implementation and provide me
sample code on it . I tried to write but I see it not moving or triggering
the SEEK callback itself . I am trying to use following solution . such
as below

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 to seek to a certain position in the input stream and can
be used to fast forward a file in a resumed upload (instead of reading all
uploaded bytes with the normal read function/callback). 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
(in 7.18.0) libcurl only passes SEEK_SET. The callback must return 0
(CURL_SEEKFUNC_OK) on success, 1 (CURL_SEEKFUNC_FAIL) to cause the upload
operation to fail or 2 (CURL_SEEKFUNC_CANTSEEK) to indicate that while the
seek failed, libcurl is free to work around the problem if possible. The
latter can sometimes be done by instead reading from the input or similar.
If you forward the input arguments directly to "fseek" or "lseek", note that
the data type for offset is not the same as defined for curl_off_t on many
systems! (Option added in 7.18.0)
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. (Option added in 7.18.0)
I have also written sample code for url_fseek , but which not working , pls
help with any solution or any suggestion and also attached the curl fopen
file with modification

with Regards
venkat

-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-users
FAQ: http://curl.haxx.se/docs/faq.html
Etiquette: http://curl.haxx.se/mail/etiquette.html

Received on 2009-10-22