⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 curl_easy_setopt.3

📁 harvest是一个下载html网页得机器人
💻 3
📖 第 1 页 / 共 3 页
字号:
directory, instead of doing a full directory listing that would include filesizes, dates etc.This causes an FTP NLST command to be sent.  Beware that some FTP servers listonly files in their response to NLST; they might not include subdirectoriesand symbolic links..TP.B CURLOPT_FTPAPPENDA non-zero parameter tells the library to append to the remote file instead ofoverwrite it. This is only useful when uploading to a ftp site..TP.B CURLOPT_FTP_USE_EPRTPass a long. If the value is non-zero, it tells curl to use the EPRT (andLPRT) command when doing active FTP downloads (which is enabled byCURLOPT_FTPPORT). Using EPRT means that it will first attempt to use EPRT andthen LPRT before using PORT, but if you pass FALSE (zero) to this option, itwill not try using EPRT or LPRT, only plain PORT. (Added in 7.10.5).TP.B CURLOPT_FTP_USE_EPSVPass a long. If the value is non-zero, it tells curl to use the EPSV commandwhen doing passive FTP downloads (which it always does by default). Using EPSVmeans that it will first attempt to use EPSV before using PASV, but if youpass FALSE (zero) to this option, it will not try using EPSV, only plain PASV..TP.B 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).TP.B 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.  Note that while curl is waiting for a response, this value overrides CURLOPT_TIMEOUT. It is recommended that if used in conjunction with CURLOPT_TIMEOUT, you set CURLOPT_FTP_RESPONSE_TIMEOUT to a value smaller than CURLOPT_TIMEOUT.(Added in 7.10.8).PP.SH PROTOCOL OPTIONS.TP 0.4i.B CURLOPT_TRANSFERTEXTA non-zero parameter tells the library to use ASCII mode for ftp transfers,instead of the default binary transfer. For LDAP transfers it gets the data inplain text instead of HTML and for win32 systems it does not set the stdout tobinary mode. This option can be usable when transferring text data betweensystems with different views on certain characters, such as newlines orsimilar..TP.B CURLOPT_CRLFConvert Unix newlines to CRLF newlines on transfers..TP.B 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)..TP.B CURLOPT_RESUME_FROMPass a long as parameter. It contains the offset in number of bytes that youwant the transfer to start from..TP.B CURLOPT_CUSTOMREQUESTPass a pointer to a zero terminated string as parameter. It will be userinstead of GET or HEAD when doing a 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: many people have wrongly used this option to replace the entire requestwith their own, including multiple headers and POST contents. While that mightwork in many cases, it will cause libcurl to send invalid requests and itcould possibly 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..TP.B 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)..TP.B 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..TP.B CURLOPT_INFILESIZEWhen uploading a file to a remote site, this option should be used to telllibcurl what the expected size of the infile is..TP.B CURLOPT_UPLOADA non-zero parameter tells the library to prepare for an upload. TheCURLOPT_READDATA and CURLOPT_INFILESIZE are also interesting for uploads..TP.B 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.NOTE: The file size is not always known prior to download, and for such filesthis option has no effect even if the file transfer ends up being larger thanthis given limit. This concerns both FTP and HTTP transfers..PP.SH CONNECTION OPTIONS.TP 0.4i.B 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.\fBNOTE:\fP this is not recommended to use in unix multi-threaded programs, asit uses signals unless CURLOPT_NOSIGNAL (see above) is set..TP.B CURLOPT_LOW_SPEED_LIMITPass a long as parameter. It contains the transfer speed in bytes per secondthat the transfer should be below during CURLOPT_LOW_SPEED_TIME seconds forthe library to consider it too slow and abort..TP.B CURLOPT_LOW_SPEED_TIMEPass a long as parameter. It contains the time in seconds that the transfershould be below the CURLOPT_LOW_SPEED_LIMIT for the library to consider it tooslow and abort..TP.B CURLOPT_MAXCONNECTSPass a long. The set number will be the persistent connection cache size. Theset amount will be the maximum amount of simultaneously open connections thatlibcurl may cache. Default is 5, and there isn't much point in changing thisvalue unless you are perfectly aware of how this work and changes libcurl'sbehaviour. This concerns connection using any of the protocols that supportpersistent connections.When reaching the maximum limit, curl uses the \fICURLOPT_CLOSEPOLICY\fP tofigure out which of the existing connections to close to prevent the number ofopen connections to increase.\fBNOTE:\fP if you already have performed transfers with this curl handle,setting a smaller MAXCONNECTS than before may cause open connections to getclosed unnecessarily..TP.B CURLOPT_CLOSEPOLICYPass a long. This option sets what policy libcurl should use when theconnection cache is filled and one of the open connections has to be closed tomake room for a new connection. This must be one of the CURLCLOSEPOLICY_*defines. Use \fICURLCLOSEPOLICY_LEAST_RECENTLY_USED\fP to make libcurl closethe connection that was least recently used, that connection is also leastlikely to be capable of re-use. Use \fICURLCLOSEPOLICY_OLDEST\fP to makelibcurl close the oldest connection, the one that was created first among theones in the connection cache. The other close policies are not supportyet..TP.B CURLOPT_FRESH_CONNECTPass a long. Set to non-zero to make the next transfer use a new (fresh)connection by force. If the connection cache is full before this connection,one of the existing connections will be closed as according to the selected ordefault policy. This option should be used with caution and only if youunderstand what it does. Set this to 0 to have libcurl attempt re-using anexisting connection (default behavior)..TP.B CURLOPT_FORBID_REUSEPass a long. Set to non-zero to make the next transfer explicitly close theconnection when done. Normally, libcurl keep all connections alive when donewith one transfer in case there comes a succeeding one that can re-use them.This option should be used with caution and only if you understand what itdoes. Set to 0 to have libcurl keep the connection open for possibly laterre-use (default behavior)..TP.B CURLOPT_CONNECTTIMEOUTPass a long. It should contain the maximum time in seconds that you allow theconnection to the server to take.  This only limits the connection phase, onceit has connected, this option is of no more use. Set to zero to disableconnection timeout (it will then only timeout on the system's internaltimeouts). See also the \fICURLOPT_TIMEOUT\fP option.\fBNOTE:\fP this is not recommended to use in unix multi-threaded programs, asit uses signals unless CURLOPT_NOSIGNAL (see above) is set..PP.SH SSL and SECURITY OPTIONS.TP 0.4i.B CURLOPT_SSLCERTPass a pointer to a zero terminated string as parameter. The string should bethe file name of your certificate. The default format is "PEM" and can bechanged with \fICURLOPT_SSLCERTTYPE\fP..TP.B CURLOPT_SSLCERTTYPEPass a pointer to a zero terminated string as parameter. The string should bethe format of your certificate. Supported formats are "PEM" and "DER".  (Addedin 7.9.3).TP.B CURLOPT_SSLCERTPASSWDPass a pointer to a zero terminated string as parameter. It will be used asthe password required to use the CURLOPT_SSLCERT certificate. If the passwordis not supplied, you will be prompted for it. \fICURLOPT_PASSWDFUNCTION\fP canbe used to set your own prompt function.\fBNOTE:\fPThis option is replaced by \fICURLOPT_SSLKEYPASSWD\fP and onlycept for backward compatibility. You never needed a pass phrase to loada certificate but you need one to load your private key..TP.B CURLOPT_SSLKEYPass a pointer to a zero terminated string as parameter. The string should bethe file name of your private key. The default format is "PEM" and can bechanged with \fICURLOPT_SSLKEYTYPE\fP..TP.B CURLOPT_SSLKEYTYPEPass a pointer to a zero terminated string as parameter. The string should bethe format of your private key. Supported formats are "PEM", "DER" and "ENG".\fBNOTE:\fPThe format "ENG" enables you to load the private key from a cryptoengine. in this case \fICURLOPT_SSLKEY\fP is used as an identifier passed tothe engine. You have to set the crypto engine with \fICURLOPT_SSL_ENGINE\fP..TP.B CURLOPT_SSLKEYPASSWDPass a pointer to a zero terminated string as parameter. It will be used asthe password required to use the \fICURLOPT_SSLKEY\fP private key. If thepassword is not supplied, you will be prompted forit. \fICURLOPT_PASSWDFUNCTION\fP can be used to set your own prompt function..TP.B CURLOPT_SSL_ENGINEPass a pointer to a zero terminated string as parameter. It will be used asthe identifier for the crypto engine you want to use for your privatekey.\fBNOTE:\fPIf the crypto device cannot be loaded,\fICURLE_SSL_ENGINE_NOTFOUND\fP is returned..TP.B CURLOPT_SSL_ENGINEDEFAULTSets the actual crypto engine as the default for (asymetric) cryptooperations.\fBNOTE:\fPIf the crypto device cannot be set,\fICURLE_SSL_ENGINE_SETFAILED\fP is returned..TP.B CURLOPT_SSLVERSIONPass a long as parameter. Set what version of SSL to attempt to use, 2 or3. By default, the SSL library will try to solve this by itself although someservers make this difficult why you at times may have to use this option..TP.B CURLOPT_SSL_VERIFYPEERPass a long that is set to a zero value to stop curl from verifying the peer'scertificate (7.10 starting setting this option to TRUE by default).  Alternatecertificates to verify against can be specified with the CURLOPT_CAINFO optionor a certificate directory can be specified with the CURLOPT_CAPATH option(Added in 7.9.8).  As of 7.10, curl installs a default bundle.CURLOPT_SSL_VERIFYHOST may also need to be set to 1 or 0 ifCURLOPT_SSL_VERIFYPEER is disabled (it defaults to 2)..TP.B CURLOPT_CAINFOPass a char * to a zero terminated string naming a file holding one or morecertificates to verify the peer with. This only makes sense when used incombination with the CURLOPT_SSL_VERIFYPEER option..TP.B CURLOPT_CAPATHPass a char * to a zero terminated string naming a directory holding multipleCA certificates to verify the peer with. The certificate directory must beprepared using the openssl c_rehash utility. This only makes sense when usedin combination with the CURLOPT_SSL_VERIFYPEER option. The CAPATH functionapparently does not work in Windows due to some limitation in openssl. (Addedin 7.9.8).TP.B CURLOPT_RANDOM_FILEPass a char * to a zero terminated file name. The file will be used to readfrom to seed the random engine for SSL. The more random the specified file is,the more secure the SSL connection will become..TP.B CURLOPT_EGDSOCKETPass a char * to the zero terminated path name to the Entropy Gathering Daemonsocket. It will be used to seed the random engine for SSL..TP.B CURLOPT_SSL_VERIFYHOSTPass a long. Set if we should verify the Common name from the peer certificatein the SSL handshake, set 1 to check existence, 2 to ensure that it matchesthe provided hostname. This is by default set to 2. (default changed in 7.10).TP.B CURLOPT_SSL_CIPHER_LISTPass a char *, pointing to a zero terminated string holding the list ofciphers to use for the SSL connection. The list must be syntactly correct, itconsists of one or more cipher strings separated by colons. Commas or spacesare also acceptable separators but colons are normally used, \!, \- and \+ canbe used as operators. Valid examples of cipher lists include 'RC4-SHA',\'SHA1+DES\', 'TLSv1' and 'DEFAULT'. The default list is normally set when youcompile OpenSSL.You'll find more details about cipher lists on this URL:\fIhttp://www.openssl.org/docs/apps/ciphers.html\fP.TP.B CURLOPT_KRB4LEVELPass a char * as parameter. Set the krb4 security level, this also enableskrb4 awareness.  This is a string, 'clear', 'safe', 'confidential' or\&'private'.  If the string is set but doesn't match one of these, 'private'will be used. Set the string to NULL to disable kerberos4. The kerberossupport only works for FTP..PP.SH OTHER OPTIONS.TP 0.4i.B CURLOPT_PRIVATEPass a char * as parameter, pointing to data that should be associated withthe curl handle.  The pointer can be subsequently retrieved using theCURLINFO_PRIVATE options to curl_easy_getinfo. (Added in 7.10.3).PP.SH RETURN VALUECURLE_OK (zero) means that the option was set properly, non-zero means anerror occurred as \fI<curl/curl.h>\fP defines. See the \fIlibcurl-errors.3\fPman page for the full list with descriptions..SH "SEE ALSO".BR curl_easy_init "(3), " curl_easy_cleanup "(3), "

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -