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

📄 curl_easy_setopt.3

📁 功能最强大的网络爬虫,希望大家好好学习啊,好好研究啊
💻 3
📖 第 1 页 / 共 5 页
字号:
specify 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_LOW_SPEED_LIMITPass a long as parameter. It contains the transfer speed in bytes per secondthat the transfer should be below during \fICURLOPT_LOW_SPEED_TIME\fP secondsfor the library to consider it too slow and abort..IP CURLOPT_LOW_SPEED_TIMEPass a long as parameter. It contains the time in seconds that the transfershould be below the \fICURLOPT_LOW_SPEED_LIMIT\fP for the library to considerit too slow and abort..IP CURLOPT_MAX_SEND_SPEED_LARGEPass a curl_off_t as parameter.  If an upload exceeds this speed on cumulative average during the transfer, the transfer will pause to keep the average rate less than or equal to the parameter value.  (default: 0, unlimited).IP CURLOPT_MAX_RECV_SPEED_LARGEPass a curl_off_t as parameter.  If an upload exceeds this speed on cumulative average during the transfer, the transfer will pause to keep the average rate less than or equal to the parameter value.  (default: 0, unlimited).IP 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.If you already have performed transfers with this curl handle, setting asmaller MAXCONNECTS than before may cause open connections to get closedunnecessarily..IP 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..IP 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)..IP 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)..IP 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.In unix-like systems, this might cause signals to be used unless\fICURLOPT_NOSIGNAL\fP is set..IP CURLOPT_IPRESOLVEAllows an application to select what kind of IP addresses to use whenresolving host names. This is only interesting when using host names thatresolve addresses using more than one version of IP. The allowed values are:.RS.IP CURL_IPRESOLVE_WHATEVERDefault, resolves addresses to all IP versions that your system allows..IP CURL_IPRESOLVE_V4Resolve to ipv4 addresses..IP CURL_IPRESOLVE_V6Resolve to ipv6 addresses..RE.IP CURLOPT_CONNECT_ONLYPass a long. A non-zero parameter tells the library to perform any requiredproxy authentication and connection setup, but no data transfer.This option is useful with the \fICURLINFO_LASTSOCKET\fP option to\fIcurl_easy_getinfo(3)\fP. The library can set up the connection and then theapplication can obtain the most recently used socket for special datatransfers. (Added in 7.15.2).SH SSL and SECURITY OPTIONS.IP 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..IP 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).IP CURLOPT_SSLCERTPASSWDPass a pointer to a zero terminated string as parameter. It will be used asthe password required to use the \fICURLOPT_SSLCERT\fP certificate.This option is replaced by \fICURLOPT_SSLKEYPASSWD\fP and should only be usedfor backward compatibility. You never needed a pass phrase to load acertificate but you need one to load your private key..IP 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..IP 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".The format "ENG" enables you to load the private key from a crypto engine. Inthis case \fICURLOPT_SSLKEY\fP is used as an identifier passed to theengine. You have to set the crypto engine with \fICURLOPT_SSLENGINE\fP.\&"DER" format key file currently does not work because of a bug in OpenSSL..IP 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..IP CURLOPT_SSLENGINEPass 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.If the crypto device cannot be loaded, \fICURLE_SSL_ENGINE_NOTFOUND\fP isreturned..IP CURLOPT_SSLENGINE_DEFAULTSets the actual crypto engine as the default for (asymmetric) cryptooperations.If the crypto device cannot be set, \fICURLE_SSL_ENGINE_SETFAILED\fP isreturned..IP CURLOPT_SSLVERSIONPass a long as parameter to control what version of SSL/TLS to attempt to use.The available options are:.RS.IP CURL_SSLVERSION_DEFAULTThe default action. When libcurl built with OpenSSL, this will attempt tofigure out the remote SSL protocol version. Unfortunately there are a lot ofancient and broken servers in use which cannot handle this technique and willfail to connect. When libcurl is built with GnuTLS, this will mean SSLv3..IP CURL_SSLVERSION_TLSv1Force TLSv1.IP CURL_SSLVERSION_SSLv2Force SSLv2.IP CURL_SSLVERSION_SSLv3Force SSLv3.RE.IP CURLOPT_SSL_VERIFYPEERPass a long as parameter.This option determines whether curl verifies the authenticity of thepeer's certificate.  A nonzero value means curl verifies; zero means itdoesn't.  The default is nonzero, but before 7.10, it was zero.When negotiating an SSL connection, the server sends a certificateindicating its identity.  Curl verifies whether the certificate isauthentic, i.e. that you can trust that the server is who thecertificate says it is.  This trust is based on a chain of digitalsignatures, rooted in certification authority (CA) certificates yousupply.  As of 7.10, curl installs a default bundle of CA certificatesand you can specify alternate certificates with the\fICURLOPT_CAINFO\fP option or the \fICURLOPT_CAPATH\fP option.When \fICURLOPT_SSL_VERIFYPEER\fP is nonzero, and the verificationfails to prove that the certificate is authentic, the connectionfails.  When the option is zero, the connection succeeds regardless.Authenticating the certificate is not by itself very useful.  Youtypically want to ensure that the server, as authentically identifiedby its certificate, is the server you mean to be talking to.  Use\fICURLOPT_SSL_VERIFYHOST\fP to control that..IP CURLOPT_CAINFOPass a char * to a zero terminated string naming a file holding one or morecertificates to verify the peer with.  This makes sense only when used incombination with the \fICURLOPT_SSL_VERIFYPEER\fP option.  If\fICURLOPT_SSL_VERIFYPEER\fP is zero, \fICURLOPT_CAINFO\fP need noteven indicate an accessible file.Note that option is by default set to the system path where libcurl's cacertbundle is assumed to be stored, as established at build time..IP CURLOPT_CAPATHPass a char * to a zero terminated string naming a directory holdingmultiple CA certificates to verify the peer with. The certificatedirectory must be prepared using the openssl c_rehash utility. Thismakes sense only when used in combination with the\fICURLOPT_SSL_VERIFYPEER\fP option.  If \fICURLOPT_SSL_VERIFYPEER\fPis zero, \fICURLOPT_CAPATH\fP need not even indicate an accessiblepath.  The \fICURLOPT_CAPATH\fP function apparently does not work inWindows due to some limitation in openssl. (Added in 7.9.8).IP 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..IP 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..IP CURLOPT_SSL_VERIFYHOSTPass a long as parameter.This option determines whether libcurl verifies that the server cert is forthe server it is known as.When negotiating an SSL connection, the server sends a certificate indicatingits identity.When \fICURLOPT_SSL_VERIFYHOST\fP is 2, that certificate must indicate thatthe server is the server to which you meant to connect, or the connectionfails.Curl considers the server the intended one when the Common Name field or aSubject Alternate Name field in the certificate matches the host name in theURL to which you told Curl to connect.When the value 

⌨️ 快捷键说明

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