說明:
curl常見的返回錯誤碼,中文的翻譯好像不是很詳細,因此把英文的貼在下面了。有空再翻譯下。
中文:
CURLE_OK (0) _ 都正確,像往常壹樣
CURLE_UNSUPPORTED_PROTOCOL (1) _ 您傳送給 libcurl 的網址使用了此 libcurl 不支持的協議。 可能是您沒有使用的編譯時選項造成了這種情況(可能是協議字符串拼寫有誤,或沒有指定協議 libcurl 代碼)。
CURLE_FAILED_INIT (2) _ 非常早期的初始化代碼失敗。 可能是內部錯誤或問題。
CURLE_URL_MALFORMAT (3) _ 網址格式不正確。
CURLE_COULDNT_RESOLVE_PROXY (5) _ 無法解析代理服務器。 指定的代理服務器主機無法解析。
CURLE_COULDNT_RESOLVE_HOST (6) _ 無法解析主機。 指定的遠程主機無法解析。
CURLE_COULDNT_CONNECT (7) _ 無法通過 connect() 連接至主機或代理服務器。
CURLE_FTP_WEIRD_SERVER_REPLY (8) _ 在連接到 FTP 服務器後,libcurl 需要收到特定的回復。 此錯誤代碼表示收到了不正常或不正確的回復。 指定的遠程服務器可能不是正確的 FTP 服務器。
CURLE_REMOTE_ACCESS_DENIED (9) _ 我們無法訪問網址中指定的資源。 對於 FTP,如果嘗試更改為遠程目錄,就會發生這種情況。
CURLE_FTP_WEIRD_PASS_REPLY (11) _ 在將 FTP 密碼發送到服務器後,libcurl 需要收到正確的回復。 此錯誤代碼表示返回的是意外的代碼。
CURLE_FTP_WEIRD_PASV_REPLY (13) _ libcurl 無法從服務器端收到有用的結果,作為對 PASV 或 EPSV 命令的響應。 服務器有問題。
CURLE_FTP_WEIRD_227_FORMAT (14) _ FTP 服務器返回 227 行作為對 PASV 命令的響應。 如果 libcurl 無法解析此行,就會返回此代碼。
CURLE_FTP_CANT_GET_HOST (15) _ 在查找用於新連接的主機時出現內部錯誤。
CURLE_FTP_COULDNT_SET_TYPE (17) _ 在嘗試將傳輸模式設置為二進制或 ascii 時發生錯誤。
CURLE_PARTIAL_FILE (18) _ 文件傳輸尺寸小於或大於預期。 當服務器先報告了壹個預期的傳輸尺寸,然後所傳送的數據與先前指定尺寸不相符時,就會發生此錯誤。
CURLE_FTP_COULDNT_RETR_FILE (19) _ ‘RETR’ 命令收到了不正常的回復,或完成的傳輸尺寸為零字節。
CURLE_QUOTE_ERROR (21) _ 在向遠程服務器發送自定義 “QUOTE” 命令時,其中壹個命令返回的錯誤代碼為 400 或更大的數字(對於 FTP),或以其他方式表明命令無法成功完成。
CURLE_HTTP_RETURNED_ERROR (22) _ 如果 CURLOPT_FAILONERROR 設置為 TRUE,且 HTTP 服務器返回 >= 400 的錯誤代碼,就會返回此代碼。 (此錯誤代碼以前又稱為 CURLE_HTTP_NOT_FOUND。)
CURLE_WRITE_ERROR (23) _ 在向本地文件寫入所收到的數據時發生錯誤,或由寫入回調 (write callback) 向 libcurl 返回了壹個錯誤。
CURLE_UPLOAD_FAILED (25) _ 無法開始上傳。 對於 FTP,服務器通常會拒絕執行 STOR 命令。 錯誤緩沖區通常會提供服務器對此問題的說明。 (此錯誤代碼以前又稱為 CURLE_FTP_COULDNT_STOR_FILE。)
CURLE_READ_ERROR (26) _ 讀取本地文件時遇到問題,或由讀取回調 (read callback) 返回了壹個錯誤。
CURLE_OUT_OF_MEMORY (27) _ 內存分配請求失敗。 此錯誤比較嚴重,若發生此錯誤,則表明出現了非常嚴重的問題。
CURLE_OPERATION_TIMEDOUT (28) _ 操作超時。 已達到根據相應情況指定的超時時間。 請註意: 自 Urchin 6.6.0.2 開始,超時時間可以自行更改。 要指定遠程日誌下載超時,請打開 urchin.conf 文件,取消以下行的註釋標記:DownloadTimeout: 30CURLE_FTP_PORT_FAILED (30) _ FTP PORT 命令返回錯誤。 在沒有為 libcurl 指定適當的地址使用時,最有可能發生此問題。 請參閱 CURLOPT_FTPPORT。
CURLE_FTP_COULDNT_USE_REST (31) _ FTP REST 命令返回錯誤。 如果服務器正常,則應當不會發生這種情況。
CURLE_RANGE_ERROR (33) _ 服務器不支持或不接受範圍請求。
CURLE_HTTP_POST_ERROR (34) _ 此問題比較少見,主要由內部混亂引發。
CURLE_SSL_CONNECT_ERROR (35) _ 同時使用 SSL/TLS 時可能會發生此錯誤。 您可以訪問錯誤緩沖區查看相應信息,其中會對此問題進行更詳細的介紹。 可能是證書(文件格式、路徑、許可)、密碼及其他因素導致了此問題。
CURLE_FTP_BAD_DOWNLOAD_RESUME (36) _ 嘗試恢復超過文件大小限制的 FTP 連接。
CURLE_FILE_COULDNT_READ_FILE (37) _ 無法打開 FILE:// 路徑下的文件。 原因很可能是文件路徑無法識別現有文件。 建議您檢查文件的訪問權限。
CURLE_LDAP_CANNOT_BIND (38) _ LDAP 無法綁定。LDAP 綁定操作失敗。
CURLE_LDAP_SEARCH_FAILED (39) _ LDAP 搜索無法進行。
CURLE_FUNCTION_NOT_FOUND (41) _ 找不到函數。 找不到必要的 zlib 函數。
CURLE_ABORTED_BY_CALLBACK (42) _ 由回調中止。 回調向 libcurl 返回了 “abort”。
CURLE_BAD_FUNCTION_ARGUMENT (43) _ 內部錯誤。 使用了不正確的參數調用函數。
CURLE_INTERFACE_FAILED (45) _ 界面錯誤。 指定的外部界面無法使用。 請通過 CURLOPT_INTERFACE 設置要使用哪個界面來處理外部連接的來源 IP 地址。 (此錯誤代碼以前又稱為 CURLE_HTTP_PORT_FAILED。)
CURLE_TOO_MANY_REDIRECTS (47) _ 重定向過多。 進行重定向時,libcurl 達到了網頁點擊上限。 請使用 CURLOPT_MAXREDIRS 設置上限。
CURLE_UNKNOWN_TELNET_OPTION (48) _ 無法識別以 CURLOPT_TELNETOPTIONS 設置的選項。 請參閱相關文檔。
CURLE_TELNET_OPTION_SYNTAX (49) _ telnet 選項字符串的格式不正確。
CURLE_PEER_FAILED_VERIFICATION (51) _ 遠程服務器的 SSL 證書或 SSH md5 指紋不正確。
CURLE_GOT_NOTHING (52) _ 服務器未返回任何數據,在相應情況下,未返回任何數據就屬於出現錯誤。
CURLE_SSL_ENGINE_NOTFOUND (53) _ 找不到指定的加密引擎。
CURLE_SSL_ENGINE_SETFAILED (54) _ 無法將選定的 SSL 加密引擎設為默認選項。
CURLE_SEND_ERROR (55) _ 無法發送網絡數據。
CURLE_RECV_ERROR (56) _ 接收網絡數據失敗。
CURLE_SSL_CERTPROBLEM (58) _ 本地客戶端證書有問題
CURLE_SSL_CIPHER (59) _ 無法使用指定的密鑰
CURLE_SSL_CACERT (60) _ 無法使用已知的 CA 證書驗證對等證書
CURLE_BAD_CONTENT_ENCODING (61) _ 無法識別傳輸編碼
CURLE_LDAP_INVALID_URL (62) _ LDAP 網址無效
CURLE_FILESIZE_EXCEEDED (63) _ 超過了文件大小上限
CURLE_USE_SSL_FAILED (64) _ 請求的 FTP SSL 級別失敗
CURLE_SEND_FAIL_REWIND (65) _ 進行發送操作時,curl 必須回轉數據以便重新傳輸,但回轉操作未能成功
CURLE_SSL_ENGINE_INITFAILED (66) _ SSL 引擎初始化失敗
CURLE_LOGIN_DENIED (67) _ 遠程服務器拒絕 curl 登錄(7.13.1 新增功能)
CURLE_TFTP_NOTFOUND (68) _ 在 TFTP 服務器上找不到文件
CURLE_TFTP_PERM (69) _ 在 TFTP 服務器上遇到權限問題
CURLE_REMOTE_DISK_FULL (70) _ 服務器磁盤空間不足
CURLE_TFTP_ILLEGAL (71) _ TFTP 操作非法
CURLE_TFTP_UNKNOWNID (72) _ TFTP 傳輸 ID 未知
CURLE_REMOTE_FILE_EXISTS (73) _ 文件已存在,無法覆蓋
CURLE_TFTP_NOSUCHUSER (74) _ 運行正常的 TFTP 服務器不會返回此錯誤
CURLE_CONV_FAILED (75) _ 字符轉換失敗
CURLE_CONV_REQD (76) _ 調用方必須註冊轉換回調
CURLE_SSL_CACERT_BADFILE (77) _ 讀取 SSL CA 證書時遇到問題(可能是路徑錯誤或訪問權限問題)
CURLE_REMOTE_FILE_NOT_FOUND (78) _ 網址中引用的資源不存在
CURLE_SSH (79) _ SSH 會話中發生無法識別的錯誤
CURLE_SSL_SHUTDOWN_FAILED (80) _ 無法終止 SSL 連接英文:
Almost all “easy” interface functions return a CURLcode error code. No matter what, using the curl_easy_setopt option CURLOPT_ERRORBUFFER is a good idea as it will give you a human readable error string that may offer more details about the cause of the error than just the error code. curl_easy_strerror 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, or a resource problem where something fundamental couldn’t get done at init time.
CURLE_URL_MALFORMAT (3) The URL was not properly formatted.
CURLE_NOT_BUILT_IN (4) A requested feature, protocol or option was not found built-in in this libcurl due to a build-time decision. This means that a feature or option was not enabled or explicitly disabled when libcurl was built and in order to get it to function you have to get a rebuilt libcurl.
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 a 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_ACCEPT_FAILED (10) While waiting for the server to connect back when an active FTP session is used, an error code was sent over the control connection or similar.
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_ACCEPT_TIMEOUT (12) During an active FTP session while waiting for the server to connect, the CURLOPT_ACCEPTTIMEOUT_MS (or the internal default) timeout expired.
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_HTTP2 (16) A problem was detected in the HTTP2 framing layer. This is somewhat generic and can be one out of several problems, see the error buffer for details.
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.
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 for this.
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 occurs.
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 happens 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 er