Libcurl Error Codes
Various Libcurl Curl Error Details
From Source
[CURLOPT_DNS_USE_GLOBAL_CACHE] => 91 [CURLOPT_DNS_CACHE_TIMEOUT] => 92 [CURLOPT_PORT] => 3 [CURLOPT_FILE] => 10001 [CURLOPT_INFILE] => 10009 [CURLOPT_INFILESIZE] => 14 [CURLOPT_URL] => 10002 [CURLOPT_PROXY] => 10004 [CURLOPT_VERBOSE] => 41 [CURLOPT_HEADER] => 42 [CURLOPT_HTTPHEADER] => 10023 [CURLOPT_NOPROGRESS] => 43 [CURLOPT_NOBODY] => 44 [CURLOPT_FAILONERROR] => 45 [CURLOPT_UPLOAD] => 46 [CURLOPT_POST] => 47 [CURLOPT_FTPLISTONLY] => 48 [CURLOPT_FTPAPPEND] => 50 [CURLOPT_NETRC] => 51 [CURLOPT_FOLLOWLOCATION] => 52 [CURLOPT_PUT] => 54 [CURLOPT_MUTE] => -2 [CURLOPT_USERPWD] => 10005 [CURLOPT_PROXYUSERPWD] => 10006 [CURLOPT_RANGE] => 10007 [CURLOPT_TIMEOUT] => 13 [CURLOPT_POSTFIELDS] => 10015 [CURLOPT_REFERER] => 10016 [CURLOPT_USERAGENT] => 10018 [CURLOPT_FTPPORT] => 10017 [CURLOPT_FTP_USE_EPSV] => 85 [CURLOPT_LOW_SPEED_LIMIT] => 19 [CURLOPT_LOW_SPEED_TIME] => 20 [CURLOPT_RESUME_FROM] => 21 [CURLOPT_COOKIE] => 10022 [CURLOPT_SSLCERT] => 10025 [CURLOPT_SSLCERTPASSWD] => 10026 [CURLOPT_WRITEHEADER] => 10029 [CURLOPT_SSL_VERIFYHOST] => 81 [CURLOPT_COOKIEFILE] => 10031 [CURLOPT_SSLVERSION] => 32 [CURLOPT_TIMECONDITION] => 33 [CURLOPT_TIMEVALUE] => 34 [CURLOPT_CUSTOMREQUEST] => 10036 [CURLOPT_STDERR] => 10037 [CURLOPT_TRANSFERTEXT] => 53 [CURLOPT_RETURNTRANSFER] => 19913 [CURLOPT_QUOTE] => 10028 [CURLOPT_POSTQUOTE] => 10039 [CURLOPT_INTERFACE] => 10062 [CURLOPT_KRB4LEVEL] => 10063 [CURLOPT_HTTPPROXYTUNNEL] => 61 [CURLOPT_FILETIME] => 69 [CURLOPT_WRITEFUNCTION] => 20011 [CURLOPT_READFUNCTION] => 20012 [CURLOPT_PASSWDFUNCTION] => -3 [CURLOPT_HEADERFUNCTION] => 20079 [CURLOPT_MAXREDIRS] => 68 [CURLOPT_MAXCONNECTS] => 71 [CURLOPT_CLOSEPOLICY] => 72 [CURLOPT_FRESH_CONNECT] => 74 [CURLOPT_FORBID_REUSE] => 75 [CURLOPT_RANDOM_FILE] => 10076 [CURLOPT_EGDSOCKET] => 10077 [CURLOPT_CONNECTTIMEOUT] => 78 [CURLOPT_SSL_VERIFYPEER] => 64 [CURLOPT_CAINFO] => 10065 [CURLOPT_CAPATH] => 10097 [CURLOPT_COOKIEJAR] => 10082 [CURLOPT_SSL_CIPHER_LIST] => 10083 [CURLOPT_BINARYTRANSFER] => 19914 [CURLOPT_HTTPGET] => 80 [CURLOPT_HTTP_VERSION] => 84 [CURLOPT_SSLKEY] => 10087 [CURLOPT_SSLKEYTYPE] => 10088 [CURLOPT_SSLKEYPASSWD] => 10026 [CURLOPT_SSLENGINE] => 10089 [CURLOPT_SSLENGINE_DEFAULT] => 90 [CURLOPT_CRLF] => 27 [CURL_TIMECOND_IFMODSINCE] => 1 [CURL_TIMECOND_IFUNMODSINCE] => 2 [CURL_TIMECOND_LASTMOD] => 3 [CURLOPT_ENCODING] => 10102 [CURLOPT_HTTPAUTH] => 107 [CURLAUTH_BASIC] => 1 [CURLAUTH_DIGEST] => 2 [CURLAUTH_GSSNEGOTIATE] => 4 [CURLAUTH_NTLM] => 8 [CURLAUTH_ANY] => -1 [CURLAUTH_ANYSAFE] => -2 [CURLOPT_PROXYAUTH] => 111 [CURLCLOSEPOLICY_LEAST_RECENTLY_USED] => 2 [CURLCLOSEPOLICY_LEAST_TRAFFIC] => 3 [CURLCLOSEPOLICY_SLOWEST] => 4 [CURLCLOSEPOLICY_CALLBACK] => 5 [CURLCLOSEPOLICY_OLDEST] => 1 [CURLINFO_EFFECTIVE_URL] => 1048577 [CURLINFO_HTTP_CODE] => 2097154 [CURLINFO_HEADER_SIZE] => 2097163 [CURLINFO_REQUEST_SIZE] => 2097164 [CURLINFO_TOTAL_TIME] => 3145731 [CURLINFO_NAMELOOKUP_TIME] => 3145732 [CURLINFO_CONNECT_TIME] => 3145733 [CURLINFO_PRETRANSFER_TIME] => 3145734 [CURLINFO_SIZE_UPLOAD] => 3145735 [CURLINFO_SIZE_DOWNLOAD] => 3145736 [CURLINFO_SPEED_DOWNLOAD] => 3145737 [CURLINFO_SPEED_UPLOAD] => 3145738 [CURLINFO_FILETIME] => 2097166 [CURLINFO_SSL_VERIFYRESULT] => 2097165 [CURLINFO_CONTENT_LENGTH_DOWNLOAD] => 3145743 [CURLINFO_CONTENT_LENGTH_UPLOAD] => 3145744 [CURLINFO_STARTTRANSFER_TIME] => 3145745 [CURLINFO_CONTENT_TYPE] => 1048594 [CURLINFO_REDIRECT_TIME] => 3145747 [CURLINFO_REDIRECT_COUNT] => 2097172 [CURLE_OK] => 0 [CURLE_UNSUPPORTED_PROTOCOL] => 1 [CURLE_FAILED_INIT] => 2 [CURLE_URL_MALFORMAT] => 3 [CURLE_URL_MALFORMAT_USER] => 4 [CURLE_COULDNT_RESOLVE_PROXY] => 5 [CURLE_COULDNT_RESOLVE_HOST] => 6 [CURLE_COULDNT_CONNECT] => 7 [CURLE_FTP_WEIRD_SERVER_REPLY] => 8 [CURLE_FTP_ACCESS_DENIED] => 9 [CURLE_FTP_USER_PASSWORD_INCORRECT] => 10 [CURLE_FTP_WEIRD_PASS_REPLY] => 11 [CURLE_FTP_WEIRD_USER_REPLY] => 12 [CURLE_FTP_WEIRD_PASV_REPLY] => 13 [CURLE_FTP_WEIRD_227_FORMAT] => 14 [CURLE_FTP_CANT_GET_HOST] => 15 [CURLE_FTP_CANT_RECONNECT] => 16 [CURLE_FTP_COULDNT_SET_BINARY] => 17 [CURLE_PARTIAL_FILE] => 18 [CURLE_FTP_COULDNT_RETR_FILE] => 19 [CURLE_FTP_WRITE_ERROR] => 20 [CURLE_FTP_QUOTE_ERROR] => 21 [CURLE_HTTP_NOT_FOUND] => 22 [CURLE_WRITE_ERROR] => 23 [CURLE_MALFORMAT_USER] => 24 [CURLE_FTP_COULDNT_STOR_FILE] => 25 [CURLE_READ_ERROR] => 26 [CURLE_OUT_OF_MEMORY] => 27 [CURLE_OPERATION_TIMEOUTED] => 28 [CURLE_FTP_COULDNT_SET_ASCII] => 29 [CURLE_FTP_PORT_FAILED] => 30 [CURLE_FTP_COULDNT_USE_REST] => 31 [CURLE_FTP_COULDNT_GET_SIZE] => 32 [CURLE_HTTP_RANGE_ERROR] => 33 [CURLE_HTTP_POST_ERROR] => 34 [CURLE_SSL_CONNECT_ERROR] => 35 [CURLE_FTP_BAD_DOWNLOAD_RESUME] => 36 [CURLE_FILE_COULDNT_READ_FILE] => 37 [CURLE_LDAP_CANNOT_BIND] => 38 [CURLE_LDAP_SEARCH_FAILED] => 39 [CURLE_LIBRARY_NOT_FOUND] => 40 [CURLE_FUNCTION_NOT_FOUND] => 41 [CURLE_ABORTED_BY_CALLBACK] => 42 [CURLE_BAD_FUNCTION_ARGUMENT] => 43 [CURLE_BAD_CALLING_ORDER] => 44 [CURLE_HTTP_PORT_FAILED] => 45 [CURLE_BAD_PASSWORD_ENTERED] => 46 [CURLE_TOO_MANY_REDIRECTS] => 47 [CURLE_UNKNOWN_TELNET_OPTION] => 48 [CURLE_TELNET_OPTION_SYNTAX] => 49 [CURLE_OBSOLETE] => 50 [CURLE_SSL_PEER_CERTIFICATE] => 51 [CURLE_GOT_NOTHING] => 52 [CURLE_SSL_ENGINE_NOTFOUND] => 53 [CURLE_SSL_ENGINE_SETFAILED] => 54 [CURLE_SEND_ERROR] => 55 [CURLE_RECV_ERROR] => 56 [CURL_NETRC_OPTIONAL] => 1 [CURL_NETRC_IGNORED] => 0 [CURL_NETRC_REQUIRED] => 2 [CURL_HTTP_VERSION_NONE] => 0 [CURL_HTTP_VERSION_1_0] => 1 [CURL_HTTP_VERSION_1_1] => 2
libcurl-errors - error codes in libcurl
This man page includes most, if not all, available error codes in libcurl. Why they occur and possibly what you can do to fix the problem. CURLcode Almost all "easy" interface functions return a CURLcode error code. No matter what, using the curl_easy_setopt(3) option CURLOPT_ERRORBUFFER is a good idea as it will give you a human readable error string that may offer more details about the error cause than just the error code does. curl_easy_strerror(3) can be called to get an error string from a given CURLcode number. CURLcode is one of the following: CURLE_OK (0) All fine. Proceed as usual. CURLE_UNSUPPORTED_PROTOCOL (1) The URL you passed to libcurl used a protocol that this libcurl does not support. The support might be a compile-time option that you didn't use, it can be a misspelled protocol string or just a protocol libcurl has no code for. CURLE_FAILED_INIT (2) Very early initialization code failed. This is likely to be an internal error or problem. CURLE_URL_MALFORMAT (3) The URL was not properly formatted. CURLE_COULDNT_RESOLVE_PROXY (5) Couldn't resolve proxy. The given proxy host could not be resolved. CURLE_COULDNT_RESOLVE_HOST (6) Couldn't resolve host. The given remote host was not resolved. CURLE_COULDNT_CONNECT (7) Failed to connect() to host or proxy. CURLE_FTP_WEIRD_SERVER_REPLY (8) After connecting to an FTP server, libcurl expects to get a certain reply back. This error code implies that it got a strange or bad reply. The given remote server is probably not an OK FTP server. CURLE_REMOTE_ACCESS_DENIED (9) We were denied access to the resource given in the URL. For FTP, this occurs while trying to change to the remote directory. CURLE_FTP_WEIRD_PASS_REPLY (11) After having sent the FTP password to the server, libcurl expects a proper reply. This error code indicates that an unexpected code was returned. CURLE_FTP_WEIRD_PASV_REPLY (13) libcurl failed to get a sensible result back from the server as a response to either a PASV or a EPSV command. The server is flawed. CURLE_FTP_WEIRD_227_FORMAT (14) FTP servers return a 227-line as a response to a PASV command. If libcurl fails to parse that line, this return code is passed back. CURLE_FTP_CANT_GET_HOST (15) An internal failure to lookup the host used for the new connection. CURLE_FTP_COULDNT_SET_TYPE (17) Received an error when trying to set the transfer mode to binary or ascii. CURLE_PARTIAL_FILE (18) A file transfer was shorter or larger than expected. This happens when the server first reports an expected transfer size, and then delivers data that doesn't match the previously given size. CURLE_FTP_COULDNT_RETR_FILE (19) This was either a weird reply to a 'RETR' command or a zero byte transfer complete. CURLE_QUOTE_ERROR (21) When sending custom "QUOTE" commands to the remote server, one of the commands returned an error code that was 400 or higher (for FTP) or otherwise indicated unsuccessful completion of the command. CURLE_HTTP_RETURNED_ERROR (22) This is returned if CURLOPT_FAILONERROR is set TRUE and the HTTP server returns an error code that is >= 400. (This error code was formerly known as CURLE_HTTP_NOT_FOUND.) CURLE_WRITE_ERROR (23) An error occurred when writing received data to a local file, or an error was returned to libcurl from a write callback. CURLE_UPLOAD_FAILED (25) Failed starting the upload. For FTP, the server typically denied the STOR command. The error buffer usually contains the server's explanation to this. (This error code was formerly known as CURLE_FTP_COULDNT_STOR_FILE.) CURLE_READ_ERROR (26) There was a problem reading a local file or an error returned by the read callback. CURLE_OUT_OF_MEMORY (27) A memory allocation request failed. This is serious badness and things are severely screwed up if this ever occur. CURLE_OPERATION_TIMEDOUT (28) Operation timeout. The specified time-out period was reached according to the conditions. CURLE_FTP_PORT_FAILED (30) The FTP PORT command returned error. This mostly happen when you haven't specified a good enough address for libcurl to use. See CURLOPT_FTPPORT. CURLE_FTP_COULDNT_USE_REST (31) The FTP REST command returned error. This should never happen if the server is sane. CURLE_RANGE_ERROR (33) The server does not support or accept range requests. CURLE_HTTP_POST_ERROR (34) This is an odd error that mainly occurs due to internal confusion. CURLE_SSL_CONNECT_ERROR (35) A problem occurred somewhere in the SSL/TLS handshake. You really want the error buffer and read the message there as it pinpoints the problem slightly more. Could be certificates (file formats, paths, permissions), passwords, and others. CURLE_FTP_BAD_DOWNLOAD_RESUME (36) Attempting FTP resume beyond file size. CURLE_FILE_COULDNT_READ_FILE (37) A file given with FILE:// couldn't be opened. Most likely because the file path doesn't identify an existing file. Did you check file permissions? CURLE_LDAP_CANNOT_BIND (38) LDAP cannot bind. LDAP bind operation failed. CURLE_LDAP_SEARCH_FAILED (39) LDAP search failed. CURLE_FUNCTION_NOT_FOUND (41) Function not found. A required zlib function was not found. CURLE_ABORTED_BY_CALLBACK (42) Aborted by callback. A callback returned "abort" to libcurl. CURLE_BAD_FUNCTION_ARGUMENT (43) Internal error. A function was called with a bad parameter. CURLE_INTERFACE_FAILED (45) Interface error. A specified outgoing interface could not be used. Set which interface to use for outgoing connections' source IP address with CURLOPT_INTERFACE. (This error code was formerly known as CURLE_HTTP_PORT_FAILED.) CURLE_TOO_MANY_REDIRECTS (47) Too many redirects. When following redirects, libcurl hit the maximum amount. Set your limit with CURLOPT_MAXREDIRS. CURLE_UNKNOWN_TELNET_OPTION (48) An option set with CURLOPT_TELNETOPTIONS was not recognized/known. Refer to the appropriate documentation. CURLE_TELNET_OPTION_SYNTAX (49) A telnet option string was Illegally formatted. CURLE_PEER_FAILED_VERIFICATION (51) The remote server's SSL certificate or SSH md5 fingerprint was deemed not OK. CURLE_GOT_NOTHING (52) Nothing was returned from the server, and under the circumstances, getting nothing is considered an error. CURLE_SSL_ENGINE_NOTFOUND (53) The specified crypto engine wasn't found. CURLE_SSL_ENGINE_SETFAILED (54) Failed setting the selected SSL crypto engine as default! CURLE_SEND_ERROR (55) Failed sending network data. CURLE_RECV_ERROR (56) Failure with receiving network data. CURLE_SSL_CERTPROBLEM (58) problem with the local client certificate CURLE_SSL_CIPHER (59) Couldn't use specified cipher CURLE_SSL_CACERT (60) Peer certificate cannot be authenticated with known CA certificates CURLE_BAD_CONTENT_ENCODING (61) Unrecognized transfer encoding CURLE_LDAP_INVALID_URL (62) Invalid LDAP URL CURLE_FILESIZE_EXCEEDED (63) Maximum file size exceeded CURLE_USE_SSL_FAILED (64) Requested FTP SSL level failed CURLE_SEND_FAIL_REWIND (65) When doing a send operation curl had to rewind the data to retransmit, but the rewinding operation failed CURLE_SSL_ENGINE_INITFAILED (66) Initiating the SSL Engine failed CURLE_LOGIN_DENIED (67) The remote server denied curl to login (Added in 7.13.1) CURLE_TFTP_NOTFOUND (68) File not found on TFTP server CURLE_TFTP_PERM (69) Permission problem on TFTP server CURLE_REMOTE_DISK_FULL (70) Out of disk space on the server CURLE_TFTP_ILLEGAL (71) Illegal TFTP operation CURLE_TFTP_UNKNOWNID (72) Unknown TFTP transfer ID CURLE_REMOTE_FILE_EXISTS (73) File already exists and will not be overwritten CURLE_TFTP_NOSUCHUSER (74) This error should never be returned by a properly functioning TFTP server CURLE_CONV_FAILED (75) Character conversion failed CURLE_CONV_REQD (76) Caller must register conversion callbacks CURLE_SSL_CACERT_BADFILE (77) Problem with reading the SSL CA cert (path? access rights?) CURLE_REMOTE_FILE_NOT_FOUND (78) The resource referenced in the URL does not exist CURLE_SSH (79) An unspecified error occurred during the SSH session CURLE_SSL_SHUTDOWN_FAILED (80) Failed to shut down the SSL connection CURLE_OBSOLETE* These error codes will never be returned. They used to be used in an old libcurl version and are currently unused. CURLMcode This is the generic return code used by functions in the libcurl multi interface. Also consider curl_multi_strerror(3). CURLM_CALL_MULTI_PERFORM (-1) This is not really an error. It means you should call curl_multi_perform(3) again without doing select() or similar in between. CURLM_OK (0) Things are fine. CURLM_BAD_HANDLE (1) The passed-in handle is not a valid CURLM handle. CURLM_BAD_EASY_HANDLE (2) An easy handle was not good/valid. It could mean that it isn't an easy handle at all, or possibly that the handle already is in used by this or another multi handle. CURLM_OUT_OF_MEMORY (3) You are doomed. CURLM_INTERNAL_ERROR (4) This can only be returned if libcurl bugs. Please report it to us! CURLM_BAD_SOCKET (5) The passed-in socket is not a valid one that libcurl already knows about. (Added in 7.15.4) CURLM_UNKNOWN_OPTION (6) curl_multi_setopt() with unsupported option (Added in 7.15.4) CURLSHcode The "share" interface will return a CURLSHcode to indicate when an error has occurred. Also consider curl_share_strerror(3). CURLSHE_OK (0) All fine. Proceed as usual. CURLSHE_BAD_OPTION (1) An invalid option was passed to the function. CURLSHE_IN_USE (2) The share object is currently in use. CURLSHE_INVALID (3) An invalid share object was passed to the function. CURLSHE_NOMEM (4) Not enough memory was available. (Added in 7.12.0)
Curl Variables
CURLOPT_COOKIE Pass a pointer to a zero terminated string as parameter. It will be used to set a cookie in the http request. The format of the string should be NAME=CONTENTS, where NAME is the cookie name and CONTENTS is what the cookie should contain. If you need to set multiple cookies, you need to set them all using a single option and thus you need to concatenate them all in one single string. Set multiple cookies in one string like this: "name1=content1; name2=content2;" etc. Using this option multiple times will only make the latest string override the previously ones. CURLOPT_COOKIEFILE Pass a pointer to a zero terminated string as parameter. It should contain the name of your file holding cookie data to read. The cookie data may be in Netscape / Mozilla cookie data format or just regular HTTP- style headers dumped to a file. Given an empty or non-existing file or by passing the empty string (""), this option will enable cookies for this curl handle, making it understand and parse received cookies and then use matching cookies in future request. If you use this option multiple times, you just add more files to read. Subsequent files will add more cookies. CURLOPT_COOKIEJAR Pass a file name as char *, zero terminated. This will make libcurl write all internally known cookies to the specified file when curl_easy_cleanup(3) is called. If no cookies are known, no file will be created. Specify "-" to instead have the cookies written to stdout. Using this option also enables cookies for this session, so if you for example follow a location it will make matching cookies get sent accordingly. If the cookie jar file can't be created or written to (when the curl_easy_cleanup(3) is called), libcurl will not and cannot report an error for this. Using CURLOPT_VERBOSE or CURLOPT_DEBUGFUNCTION will get a warning to display, but that is the only visible feedback you get about this possibly lethal situation. CURLOPT_COOKIESESSION Pass a long set to non-zero to mark this as a new cookie "session". It will force libcurl to ignore all cookies it is about to load that are "session cookies" from the previous session. By default, libcurl always stores and loads all cookies, independent if they are session cookies are not. Session cookies are cookies without expiry date and they are meant to be alive and existing for this "session" only. CURLOPT_COOKIELIST Pass a char * to a cookie string. Cookie can be either in Netscape / Mozilla format or just regular HTTP- style header (Set-Cookie: ...) format. If cURL cookie engine was not enabled it will enable its cookie engine. Passing a magic string "ALL" will erase all cookies known by cURL. (Added in 7.14.1) Passing the special string "SESS" will only erase all session cookies known by cURL. (Added in 7.15.4) CURLOPT_URL The actual URL to deal with. The parameter should be a char * to a zero terminated string. The string must remain present until curl no longer needs it, as it doesn't copy the string. If the given URL lacks the protocol part ("http://" or "ftp://" etc), it will attempt to guess which pro- tocol to use based on the given host name. If the given protocol of the set URL is not supported, libcurl will return on error (CURLE_UNSUPPORTED_PROTOCOL) when you call curl_easy_perform(3) or curl_multi_per- form(3). Use curl_version_info(3) for detailed info on which protocols that are supported. The string given to CURLOPT_URL must be url-encoded and following the RFC 2396 (http://curl.haxx.se/rfc/rfc2396.txt). CURLOPT_URL is the only option that must' be set before curl_easy_perform(3) is called. CURLOPT_PROXY Set HTTP proxy to use. The parameter should be a char * to a zero terminated string holding the host name or dotted IP address. To specify port number in this string, append :[port] to the end of the host name. The proxy string may be prefixed with [protocol]:// since any such prefix will be ignored. The proxy's port number may optionally be specified with the separate option CURLOPT_PROXYPORT. When you tell the library to use an HTTP proxy, libcurl will transparently convert operations to HTTP even if you specify an FTP URL etc. This may have an impact on what other features of the library you can use, such as CURLOPT_QUOTE and similar FTP specifics that don't work unless you tunnel through the HTTP proxy. Such tunneling is activated with CURLOPT_HTTPPROXYTUNNEL. libcurl respects the environment variables http_proxy, ftp_proxy, all_proxy etc, if any of those is set. The CURLOPT_PROXY option does however override any possibly set environment variables. Starting with 7.14.1, the proxy host string can be specified the exact same way as the proxy environment variables, include protocol prefix (http://) and embedded user + password. CURLOPT_PROXYPORT Pass a long with this option to set the proxy port to connect to unless it is specified in the proxy string CURLOPT_PROXY. CURLOPT_PROXYTYPE Pass a long with this option to set type of the proxy. Available options for this are CURLPROXY_HTTP, CURLPROXY_SOCKS4 (added in 7.15.2) CURLPROXY_SOCKS5. The HTTP type is default. (Added in 7.10) CURLOPT_HTTPPROXYTUNNEL Set the parameter to non-zero to get the library to tunnel all operations through a given HTTP proxy. There is a big difference between using a proxy and to tunnel through it. If you don't know what this means, you probably don't want this tunneling option. CURLOPT_INTERFACE Pass a char * as parameter. This set the interface name to use as outgoing network interface. The name can be an interface name, an IP address or a host name. CURLOPT_LOCALPORT Pass a long. This sets the local port number of the socket used for connection. This can be used in combi- nation with CURLOPT_INTERFACE and you are recommended to use CURLOPT_LOCALPORTRANGE as well when this is set. Note that port numbers are only valid 1 - 65535. (Added in 7.15.2) CURLOPT_LOCALPORTRANGE Pass a long. This is the number of attempts libcurl should do to find a working local port number. It starts with the given CURLOPT_LOCALPORT and adds one to the number for each retry. Setting this value to 1 or below will make libcurl do only one try for exact port number. Note that port numbers by nature is a scarce resource that will be busy at times so setting this value to something too low might cause unneces- sary connection setup failures. (Added in 7.15.2) CURLOPT_DNS_CACHE_TIMEOUT Pass a long, this sets the timeout in seconds. Name resolves will be kept in memory for this number of seconds. Set to zero(0) to completely disable caching, or set to -1 to make the cached entries remain forever. By default, libcurl caches this info for 60 seconds. CURLOPT_DNS_USE_GLOBAL_CACHE Pass a long. If the value is non-zero, it tells curl to use a global DNS cache that will survive between easy handle creations and deletions. This is not thread-safe and this will use a global variable. WARNING: this option is considered obsolete. Stop using it. Switch over to using the share interface instead! See CURLOPT_SHARE and curl_share_init(3). CURLOPT_BUFFERSIZE Pass a long specifying your preferred size (in bytes) for the receive buffer in libcurl. The main point of this would be that the write callback gets called more often and with smaller chunks. This is just treated as a request, not an order. You cannot be guaranteed to actually get the given size. (Added in 7.10) This size is by default set as big as possible (CURL_MAX_WRITE_SIZE), so it only makse sense to use this option if you want it smaller. CURLOPT_PORT Pass a long specifying what remote port number to connect to, instead of the one specified in the URL or the default port for the used protocol. CURLOPT_HTTP_VERSION Pass a long, set to one of the values described below. They force libcurl to use the specific HTTP ver- sions. This is not sensible to do unless you have a good reason. CURL_HTTP_VERSION_NONE We don't care about what version the library uses. libcurl will use whatever it thinks fit. CURL_HTTP_VERSION_1_0 Enforce HTTP 1.0 requests. CURL_HTTP_VERSION_1_1 Enforce HTTP 1.1 requests. CURLOPT_IGNORE_CONTENT_LENGTH Ignore the Content-Length header. This is useful for Apache 1.x (and similar servers) which will report incorrect content length for files over 2 gigabytes. If this option is used, curl will not be able to accurately report progress, and will simply stop the download when the server ends the connection. (added in 7.14.1)
CONNECTION OPTIONS
CURLOPT_TIMEOUT Pass a long as parameter containing the maximum time in seconds that you allow the libcurl transfer opera- tion to take. Normally, name lookups can take a considerable time and limiting operations to less than a few minutes risk aborting perfectly normal operations. This option will cause curl to use the SIGALRM to enable time-outing system calls. In unix-like systems, this might cause signals to be used unless CURLOPT_NOSIGNAL is set. CURLOPT_LOW_SPEED_LIMIT Pass a long as parameter. It contains the transfer speed in bytes per second that the transfer should be below during CURLOPT_LOW_SPEED_TIME seconds for the library to consider it too slow and abort. CURLOPT_LOW_SPEED_TIME Pass a long as parameter. It contains the time in seconds that the transfer should be below the CUR- LOPT_LOW_SPEED_LIMIT for the library to consider it too slow and abort. CURLOPT_MAX_SEND_SPEED_LARGE Pass a curl_off_t as parameter. If an upload exceeds this speed on cumulative average during the trans- fer, the transfer will pause to keep the average rate less than or equal to the parameter value. (default: 0, unlimited) CURLOPT_MAX_RECV_SPEED_LARGE Pass a curl_off_t as parameter. If an upload exceeds this speed on cumulative average during the trans- fer, the transfer will pause to keep the average rate less than or equal to the parameter value. (default: 0, unlimited) CURLOPT_MAXCONNECTS Pass a long. The set number will be the persistent connection cache size. The set amount will be the maxi- mum amount of simultaneously open connections that libcurl may cache. Default is 5, and there isn't much point in changing this value unless you are perfectly aware of how this work and changes libcurl's behaviour. This concerns connection using any of the protocols that support persistent connections. When reaching the maximum limit, curl uses the CURLOPT_CLOSEPOLICY to figure out which of the existing connections to close to prevent the number of open connections to increase. If you already have performed transfers with this curl handle, setting a smaller MAXCONNECTS than before may cause open connections to get closed unnecessarily. CURLOPT_CLOSEPOLICY Pass a long. This option sets what policy libcurl should use when the connection cache is filled and one of the open connections has to be closed to make room for a new connection. This must be one of the CURL- CLOSEPOLICY_* defines. Use CURLCLOSEPOLICY_LEAST_RECENTLY_USED to make libcurl close the connection that was least recently used, that connection is also least likely to be capable of re-use. Use CURLCLOSEPOL- ICY_OLDEST to make libcurl close the oldest connection, the one that was created first among the ones in the connection cache. The other close policies are not support yet. CURLOPT_FRESH_CONNECT Pass a long. Set to non-zero to make the next transfer use a new (fresh) connection by force. If the con- nection cache is full before this connection, one of the existing connections will be closed as according to the selected or default policy. This option should be used with caution and only if you understand what it does. Set this to 0 to have libcurl attempt re-using an existing connection (default behavior). CURLOPT_FORBID_REUSE Pass a long. Set to non-zero to make the next transfer explicitly close the connection when done. Nor- mally, libcurl keep all connections alive when done with 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 it does. Set to 0 to have libcurl keep the connection open for possibly later re-use (default behavior). CURLOPT_CONNECTTIMEOUT Pass a long. It should contain the maximum time in seconds that you allow the connection to the server to take. This only limits the connection phase, once it has connected, this option is of no more use. Set to zero to disable connection timeout (it will then only timeout on the system's internal timeouts). See also the CURLOPT_TIMEOUT option. In unix-like systems, this might cause signals to be used unless CURLOPT_NOSIGNAL is set. CURLOPT_IPRESOLVE Allows an application to select what kind of IP addresses to use when resolving host names. This is only interesting when using host names that resolve addresses using more than one version of IP. The allowed values are: CURL_IPRESOLVE_WHATEVER Default, resolves addresses to all IP versions that your system allows. CURL_IPRESOLVE_V4 Resolve to ipv4 addresses. CURL_IPRESOLVE_V6 Resolve to ipv6 addresses. CURLOPT_CONNECT_ONLY Pass a long. A non-zero parameter tells the library to perform any required proxy authentication and con- nection setup, but no data transfer. This option is useful with the CURLINFO_LASTSOCKET option to curl_easy_getinfo(3). The library can set up the connection and then the application can obtain the most recently used socket for special data trans- fers. (Added in 7.15.2)
« Google Trends for SEO / Apache HtaccessHtaccess Mod_Rewrite – Crazy Advanced Master Class »
Comments