Mercurial > hgrepos > Python2 > PyMuPDF
comparison mupdf-source/thirdparty/curl/docs/libcurl/opts/CURLOPT_SEEKFUNCTION.3 @ 2:b50eed0cc0ef upstream
ADD: MuPDF v1.26.7: the MuPDF source as downloaded by a default build of PyMuPDF 1.26.4.
The directory name has changed: no version number in the expanded directory now.
| author | Franz Glasner <fzglas.hg@dom66.de> |
|---|---|
| date | Mon, 15 Sep 2025 11:43:07 +0200 |
| parents | |
| children |
comparison
equal
deleted
inserted
replaced
| 1:1d09e1dec1d9 | 2:b50eed0cc0ef |
|---|---|
| 1 .\" ************************************************************************** | |
| 2 .\" * _ _ ____ _ | |
| 3 .\" * Project ___| | | | _ \| | | |
| 4 .\" * / __| | | | |_) | | | |
| 5 .\" * | (__| |_| | _ <| |___ | |
| 6 .\" * \___|\___/|_| \_\_____| | |
| 7 .\" * | |
| 8 .\" * Copyright (C) 1998 - 2017, Daniel Stenberg, <daniel@haxx.se>, et al. | |
| 9 .\" * | |
| 10 .\" * This software is licensed as described in the file COPYING, which | |
| 11 .\" * you should have received as part of this distribution. The terms | |
| 12 .\" * are also available at https://curl.haxx.se/docs/copyright.html. | |
| 13 .\" * | |
| 14 .\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell | |
| 15 .\" * copies of the Software, and permit persons to whom the Software is | |
| 16 .\" * furnished to do so, under the terms of the COPYING file. | |
| 17 .\" * | |
| 18 .\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY | |
| 19 .\" * KIND, either express or implied. | |
| 20 .\" * | |
| 21 .\" ************************************************************************** | |
| 22 .\" | |
| 23 .TH CURLOPT_SEEKFUNCTION 3 "16 Jun 2014" "libcurl 7.37.0" "curl_easy_setopt options" | |
| 24 .SH NAME | |
| 25 CURLOPT_SEEKFUNCTION \- user callback for seeking in input stream | |
| 26 .SH SYNOPSIS | |
| 27 .nf | |
| 28 #include <curl/curl.h> | |
| 29 | |
| 30 /* These are the return codes for the seek callbacks */ | |
| 31 #define CURL_SEEKFUNC_OK 0 | |
| 32 #define CURL_SEEKFUNC_FAIL 1 /* fail the entire transfer */ | |
| 33 #define CURL_SEEKFUNC_CANTSEEK 2 /* tell libcurl seeking can't be done, so | |
| 34 libcurl might try other means instead */ | |
| 35 | |
| 36 int seek_callback(void *userp, curl_off_t offset, int origin); | |
| 37 | |
| 38 CURLcode curl_easy_setopt(CURL *handle, CURLOPT_SEEKFUNCTION, seek_callback); | |
| 39 .SH DESCRIPTION | |
| 40 Pass a pointer to your callback function, which should match the prototype | |
| 41 shown above. | |
| 42 | |
| 43 This function gets called by libcurl to seek to a certain position in the | |
| 44 input stream and can be used to fast forward a file in a resumed upload | |
| 45 (instead of reading all uploaded bytes with the normal read | |
| 46 function/callback). It is also called to rewind a stream when data has already | |
| 47 been sent to the server and needs to be sent again. This may happen when doing | |
| 48 an HTTP PUT or POST with a multi-pass authentication method, or when an | |
| 49 existing HTTP connection is reused too late and the server closes the | |
| 50 connection. The function shall work like fseek(3) or lseek(3) and it gets | |
| 51 SEEK_SET, SEEK_CUR or SEEK_END as argument for \fIorigin\fP, although libcurl | |
| 52 currently only passes SEEK_SET. | |
| 53 | |
| 54 \fIuserp\fP is the pointer you set with \fICURLOPT_SEEKDATA(3)\fP. | |
| 55 | |
| 56 The callback function must return \fICURL_SEEKFUNC_OK\fP on success, | |
| 57 \fICURL_SEEKFUNC_FAIL\fP to cause the upload operation to fail or | |
| 58 \fICURL_SEEKFUNC_CANTSEEK\fP to indicate that while the seek failed, libcurl | |
| 59 is free to work around the problem if possible. The latter can sometimes be | |
| 60 done by instead reading from the input or similar. | |
| 61 | |
| 62 If you forward the input arguments directly to fseek(3) or lseek(3), note that | |
| 63 the data type for \fIoffset\fP is not the same as defined for curl_off_t on | |
| 64 many systems! | |
| 65 .SH DEFAULT | |
| 66 By default, this is NULL and unused. | |
| 67 .SH PROTOCOLS | |
| 68 HTTP, FTP, SFTP | |
| 69 .SH EXAMPLE | |
| 70 .nf | |
| 71 static int seek_cb(void *userp, curl_off_t offset, int origin) | |
| 72 { | |
| 73 struct data *d = (struct data *)userp; | |
| 74 lseek(our_fd, offset, origin); | |
| 75 return CURL_SEEKFUNC_OK; | |
| 76 } | |
| 77 | |
| 78 { | |
| 79 struct data seek_data; | |
| 80 curl_easy_setopt(CURL *handle, CURLOPT_SEEKFUNCTION, seek_cb); | |
| 81 curl_easy_setopt(CURL *handle, CURLOPT_SEEKDATA, &seek_data); | |
| 82 } | |
| 83 .fi | |
| 84 .SH AVAILABILITY | |
| 85 Added in 7.18.0 | |
| 86 .SH RETURN VALUE | |
| 87 Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if not. | |
| 88 .SH "SEE ALSO" | |
| 89 .BR CURLOPT_SEEKDATA "(3), " CURLOPT_IOCTLFUNCTION "(3), " |
