Name
easy:SetOpt_SeekFunction -- user callback for seeking in input stream
Synopsis
easy:SetOpt_SeekFunction(seek_callback[, userdata])
Function
Pass a callback function. 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 data has already been sent to the server and needs to be sent again. This may happen when doing an HTTP PUT or POST with a multi-pass authentication method, or when an existing HTTP connection is reused too late and the server closes the connection.

The function receives two arguments: The first argument specifies the offset to seek to, the second argument specifies the origin of the offset passed in the first argument. This will be one of the following special strings:

set
Offset is relative to beginning.
cur
Offset is relative to current position.
end
Offset is relative to ending.

If you pass the optional userdata argument, the value you pass in userdata will be passed to your callback function as a third parameter. The userdata parameter can be of any type.

The callback function must return #CURL_SEEKFUNC_OK (or nothing) on success, #CURL_SEEKFUNC_FAIL to cause the upload operation to fail or #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.

Inputs
seek_callback
input value
userdata
optional: user data to pass to callback function

Show TOC