📄 curl_easy_setopt.3
字号:
pass FALSE (zero) to this option, it will not try using EPSV, only plain PASV.If the server is an IPv6 host, this option will have no effect as of 7.12.3..IP CURLOPT_FTP_CREATE_MISSING_DIRSPass a long. If the value is non-zero, curl will attempt to create any remotedirectory that it fails to CWD into. CWD is the command that changes workingdirectory. (Added in 7.10.7)This setting also applies to SFTP-connections. curl will attempt to createthe remote directory if it can't obtain a handle to the target-location. Thecreation will fail if a file of the same name as the directory to createalready exists or lack of permissions prevents creation. (Added in 7.16.3).IP CURLOPT_FTP_RESPONSE_TIMEOUTPass a long. Causes curl to set a timeout period (in seconds) on the amountof time that the server is allowed to take in order to generate a responsemessage for a command before the session is considered hung. While curl iswaiting for a response, this value overrides \fICURLOPT_TIMEOUT\fP. It isrecommended that if used in conjunction with \fICURLOPT_TIMEOUT\fP, you set\fICURLOPT_FTP_RESPONSE_TIMEOUT\fP to a value smaller than\fICURLOPT_TIMEOUT\fP. (Added in 7.10.8).IP CURLOPT_FTP_ALTERNATIVE_TO_USERPass a char * as parameter, pointing to a string which will be used toauthenticate if the usual FTP "USER user" and "PASS password" negotiationfails. This is currently only known to be required when connecting toTumbleweed's Secure Transport FTPS server using client certificates forauthentication. (Added in 7.15.5).IP CURLOPT_FTP_SKIP_PASV_IPPass a long. If set to a non-zero value, it instructs libcurl to not use theIP address the server suggests in its 227-response to libcurl's PASV commandwhen libcurl connects the data connection. Instead libcurl will re-use thesame IP address it already uses for the control connection. But it will usethe port number from the 227-response. (Added in 7.14.2)This option has no effect if PORT, EPRT or EPSV is used instead of PASV..IP CURLOPT_USE_SSLPass a long using one of the values from below, to make libcurl use yourdesired level of SSL for the ftp transfer. (Added in 7.11.0)(This option was known as CURLOPT_FTP_SSL up to 7.16.4, and the constantswere known as CURLFTPSSL_*).RS.IP CURLUSESSL_NONEDon't attempt to use SSL..IP CURLUSESSL_TRYTry using SSL, proceed as normal otherwise..IP CURLUSESSL_CONTROLRequire SSL for the control connection or fail with \fICURLE_USE_SSL_FAILED\fP..IP CURLUSESSL_ALLRequire SSL for all communication or fail with \fICURLE_USE_SSL_FAILED\fP..RE.IP CURLOPT_FTPSSLAUTHPass a long using one of the values from below, to alter how libcurl issues\&"AUTH TLS" or "AUTH SSL" when FTP over SSL is activated (see\fICURLOPT_FTP_SSL\fP). (Added in 7.12.2).RS.IP CURLFTPAUTH_DEFAULTAllow libcurl to decide.IP CURLFTPAUTH_SSLTry "AUTH SSL" first, and only if that fails try "AUTH TLS".IP CURLFTPAUTH_TLSTry "AUTH TLS" first, and only if that fails try "AUTH SSL".RE.IP CURLOPT_FTP_SSL_CCCIf enabled, this option makes libcurl use CCC (Clear Command Channel). Itshuts down the SSL/TLS layer after authenticating. The rest of thecontrol channel communication will be unencrypted. This allows NAT routersto follow the FTP transaction. Pass a long using one of the values below.(Added in 7.16.1).RS.IP CURLFTPSSL_CCC_NONEDon't attempt to use CCC..IP CURLFTPSSL_CCC_PASSIVEDo not initiate the shutdown, but wait for the server to do it. Do not senda reply..IP CURLFTPSSL_CCC_ACTIVEInitiate the shutdown and wait for a reply..RE.IP CURLOPT_FTP_ACCOUNTPass a pointer to a zero-terminated string (or NULL to disable). When an FTPserver asks for "account data" after user name and password has been provided,this data is sent off using the ACCT command. (Added in 7.13.0).IP CURLOPT_FTP_FILEMETHODPass a long that should have one of the following values. This option controlswhat method libcurl should use to reach a file on a FTP(S) server. Theargument should be one of the following alternatives:.RS.IP CURLFTPMETHOD_MULTICWDlibcurl does a single CWD operation for each path part in the given URL. Fordeep hierarchies this means very many commands. This is how RFC1738 says itshould be done. This is the default but the slowest behavior..IP CURLFTPMETHOD_NOCWDlibcurl does no CWD at all. libcurl will do SIZE, RETR, STOR etc and give afull path to the server for all these commands. This is the fastest behavior..IP CURLFTPMETHOD_SINGLECWDlibcurl does one CWD with the full target directory and then operates on thefile \&"normally" (like in the multicwd case). This is somewhat more standardscompliant than 'nocwd' but without the full penalty of 'multicwd'..RE.SH PROTOCOL OPTIONS.IP CURLOPT_TRANSFERTEXTA non-zero parameter tells the library to use ASCII mode for ftp transfers,instead of the default binary transfer. For win32 systems it does not set thestdout to binary mode. This option can be usable when transferring text databetween systems with different views on certain characters, such as newlinesor similar.libcurl does not do a complete ASCII conversion when doing ASCII transfersover FTP. This is a known limitation/flaw that nobody has rectified. libcurlsimply sets the mode to ascii and performs a standard transfer..IP CURLOPT_PROXY_TRANSFER_MODEPass a long. If the value is set to 1 (one), it tells libcurl to set thetransfer mode (binary or ASCII) for FTP transfers done via an HTTP proxy, byappending ;type=a or ;type=i to the URL. Without this setting, or it beingset to 0 (zero, the default), \fICURLOPT_TRANSFERTEXT\fP has no effect whendoing FTP via a proxy. Beware that not all proxies support this feature.(Added in 7.18.0).IP CURLOPT_CRLFConvert Unix newlines to CRLF newlines on transfers..IP CURLOPT_RANGEPass a char * as parameter, which should contain the specified range youwant. It should be in the format "X-Y", where X or Y may be left out. HTTPtransfers also support several intervals, separated with commas as in\fI"X-Y,N-M"\fP. Using this kind of multiple intervals will cause the HTTPserver to send the response document in pieces (using standard MIME separationtechniques). Pass a NULL to this option to disable the use of ranges.Ranges work on HTTP, FTP and FILE (since 7.18.0) transfers only..IP CURLOPT_RESUME_FROMPass a long as parameter. It contains the offset in number of bytes that youwant the transfer to start from. Set this option to 0 to make the transferstart from the beginning (effectively disabling resume). For FTP, set thisoption to -1 to make the transfer start from the end of the target file(useful to continue an interrupted upload)..IP CURLOPT_RESUME_FROM_LARGEPass a curl_off_t as parameter. It contains the offset in number of bytes thatyou want the transfer to start from. (Added in 7.11.0).IP CURLOPT_CUSTOMREQUESTPass a pointer to a zero terminated string as parameter. It will be usedinstead of GET or HEAD when doing an HTTP request, or instead of LIST or NLSTwhen doing an ftp directory listing. This is useful for doing DELETE or othermore or less obscure HTTP requests. Don't do this at will, make sure yourserver supports the command first.Note that libcurl will still act and assume the keyword it would use if youdidn't set your custom one is the one in use and it will act according tothat. Thus, changing this to a HEAD when libcurl otherwise would do a GETmight cause libcurl to act funny, and similar. To switch to a proper HEAD, use\fICURLOPT_NOBODY\fP, to switch to a proper POST, use \fICURLOPT_POST\fP or\fICURLOPT_POSTFIELDS\fP and so on.Restore to the internal default by setting this to NULL.Many people have wrongly used this option to replace the entire request withtheir own, including multiple headers and POST contents. While that might workin many cases, it will cause libcurl to send invalid requests and it couldpossibly confuse the remote server badly. Use \fICURLOPT_POST\fP and\fICURLOPT_POSTFIELDS\fP to set POST data. Use \fICURLOPT_HTTPHEADER\fP toreplace or extend the set of headers sent by libcurl. Use\fICURLOPT_HTTP_VERSION\fP to change HTTP version..IP CURLOPT_FILETIMEPass a long. If it is a non-zero value, libcurl will attempt to get themodification date of the remote document in this operation. This requires thatthe remote server sends the time or replies to a time querying command. The\fIcurl_easy_getinfo(3)\fP function with the \fICURLINFO_FILETIME\fP argumentcan be used after a transfer to extract the received time (if any)..IP CURLOPT_NOBODYA non-zero parameter tells the library to not include the body-part in theoutput. This is only relevant for protocols that have separate header and bodyparts. On HTTP(S) servers, this will make libcurl do a HEAD request.To change request to GET, you should use \fICURLOPT_HTTPGET\fP. Change requestto POST with \fICURLOPT_POST\fP etc..IP CURLOPT_INFILESIZEWhen uploading a file to a remote site, this option should be used to telllibcurl what the expected size of the infile is. This value should be passedas a long. See also \fICURLOPT_INFILESIZE_LARGE\fP.For uploading using SCP, this option or \fICURLOPT_INFILESIZE_LARGE\fP ismandatory.Note that this option does not limit how much data libcurl will actually send,as that is controlled entirely by what the read callback returns..IP CURLOPT_INFILESIZE_LARGEWhen uploading a file to a remote site, this option should be used to telllibcurl what the expected size of the infile is. This value should be passedas a curl_off_t. (Added in 7.11.0)For uploading using SCP, this option or \fICURLOPT_INFILESIZE\fP is mandatory.Note that this option does not limit how much data libcurl will actually send,as that is controlled entirely by what the read callback returns..IP CURLOPT_UPLOADA non-zero parameter tells the library to prepare for an upload. The\fICURLOPT_READDATA\fP and \fICURLOPT_INFILESIZE\fP or\fICURLOPT_INFILESIZE_LARGE\fP options are also interesting for uploads. Ifthe protocol is HTTP, uploading means using the PUT request unless you telllibcurl otherwise.Using PUT with HTTP 1.1 implies the use of a "Expect: 100-continue" header.You can disable this header with \fICURLOPT_HTTPHEADER\fP as usual.If you use PUT to a HTTP 1.1 server, you can upload data without knowing thesize before starting the transfer if you use chunked encoding. You enable thisby adding a header like "Transfer-Encoding: chunked" with\fICURLOPT_HTTPHEADER\fP. With HTTP 1.0 or without chunked transfer, you mustspecify the size..IP CURLOPT_MAXFILESIZEPass a long as parameter. This allows you to specify the maximum size (inbytes) of a file to download. If the file requested is larger than this value,the transfer will not start and CURLE_FILESIZE_EXCEEDED will be returned.The file size is not always known prior to download, and for such files thisoption has no effect even if the file transfer ends up being larger than thisgiven limit. This concerns both FTP and HTTP transfers..IP CURLOPT_MAXFILESIZE_LARGEPass a curl_off_t as parameter. This allows you to specify the maximum size(in bytes) of a file to download. If the file requested is larger than thisvalue, the transfer will not start and \fICURLE_FILESIZE_EXCEEDED\fP will bereturned. (Added in 7.11.0)The file size is not always known prior to download, and for such files thisoption has no effect even if the file transfer ends up being larger than thisgiven limit. This concerns both FTP and HTTP transfers..IP CURLOPT_TIMECONDITIONPass a long as parameter. This defines how the \fICURLOPT_TIMEVALUE\fP timevalue is treated. You can set this parameter to \fICURL_TIMECOND_IFMODSINCE\fPor \fICURL_TIMECOND_IFUNMODSINCE\fP. This feature applies to HTTP and FTP.The last modification time of a file is not always known and in such instancesthis feature will have no effect even if the given time condition would havenot been met..IP CURLOPT_TIMEVALUEPass a long as parameter. This should be the time in seconds since 1 jan 1970,and the time will be used in a condition as specified with\fICURLOPT_TIMECONDITION\fP..SH CONNECTION OPTIONS.IP CURLOPT_TIMEOUTPass a long as parameter containing the maximum time in seconds that you allowthe libcurl transfer operation to take. Normally, name lookups can take aconsiderable time and limiting operations to less than a few minutes riskaborting perfectly normal operations. This option will cause curl to use theSIGALRM to enable time-outing system calls.In unix-like systems, this might cause signals to be used unless\fICURLOPT_NOSIGNAL\fP is set..IP CURLOPT_TIMEOUT_MSLike \fICURLOPT_TIMEOUT\fP but takes number of milliseconds instead.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -