Skip to content

Instantly share code, notes, and snippets.

@K-Ko
Last active October 13, 2021 00:11
Show Gist options
  • Save K-Ko/78a1c4f80159ddc0355f7feab5621edb to your computer and use it in GitHub Desktop.
Save K-Ko/78a1c4f80159ddc0355f7feab5621edb to your computer and use it in GitHub Desktop.
Curl exit codes as bash array
#
# curl-code.conf
#
# Curl exit Codes
#
# https://curl.haxx.se/docs/manpage.html
# https://curl.haxx.se/libcurl/c/libcurl-errors.html
#
declare -a curl_code
curl_code[1]="Unsupported protocol. This build of curl has no support for this protocol."
curl_code[2]="Failed to initialize."
curl_code[3]="URL malformed. The syntax was not correct."
curl_code[4]="A feature or option that was needed to perform the desired request was not enabled or was explicitly disabled at build-time. To make curl able to do this, you probably need another build of libcurl!"
curl_code[5]="Couldn't resolve proxy. The given proxy host could not be resolved."
curl_code[6]="Couldn't resolve host. The given remote host was not resolved."
curl_code[7]="Failed to connect to host."
curl_code[8]="Weird server reply. The server sent data curl Couldn't parse."
curl_code[9]="FTP access denied. The server denied login or denied access to the particular resource or directory you wanted to reach. Most often you tried to change to a directory that doesn't exist on the server."
curl_code[10]="FTP accept failed. 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."
curl_code[11]="FTP weird PASS reply. Curl Couldn't parse the reply sent to the PASS request."
curl_code[12]="During an active FTP session while waiting for the server to connect back to curl, the timeout expired."
curl_code[13]="FTP weird PASV reply, Curl Couldn't parse the reply sent to the PASV request."
curl_code[14]="FTP weird 227 format. Curl Couldn't parse the 227-line the server sent."
curl_code[15]="FTP can't get host. Couldn't resolve the host IP we got in the 227-line."
curl_code[16]="HTTP/2 error. A problem was detected in the HTTP2 framing layer. This is somewhat generic and can be one out of several problems, see the error message for details."
curl_code[17]="FTP Couldn't set binary. Couldn't change transfer method to binary."
curl_code[18]="Partial file. Only a part of the file was transferred."
curl_code[19]="FTP Couldn't download/access the given file, the RETR (or similar) command failed."
curl_code[21]="FTP quote error. A quote command returned error from the server."
curl_code[22]="HTTP page not retrieved. The requested url was not found or returned another error with the HTTP error code being 400 or above. This return code only appears if -f, --fail is used."
curl_code[23]="Write error. Curl Couldn't write data to a local filesystem or similar."
curl_code[25]="FTP Couldn't STOR file. The server denied the STOR operation, used for FTP uploading."
curl_code[26]="Read error. Various reading problems."
curl_code[27]="Out of memory. A memory allocation request failed."
curl_code[28]="Operation timeout. The specified time-out period was reached according to the conditions."
curl_code[30]="FTP PORT failed. The PORT command failed. Not all FTP servers support the PORT command, try doing a transfer using PASV instead!"
curl_code[31]="FTP Couldn't use REST. The REST command failed. This command is used for resumed FTP transfers."
curl_code[33]="HTTP range error. The range 'command' didn't work."
curl_code[34]="HTTP post error. Internal post-request generation error."
curl_code[35]="SSL connect error. The SSL handshaking failed."
curl_code[36]="Bad download resume. Couldn't continue an earlier aborted download."
curl_code[37]="FILE Couldn't read file. Failed to open the file. Permissions?"
curl_code[38]="LDAP cannot bind. LDAP bind operation failed."
curl_code[39]="LDAP search failed."
curl_code[41]="Function not found. A required LDAP function was not found."
curl_code[42]="Aborted by callback. An application told curl to abort the operation."
curl_code[43]="Internal error. A function was called with a bad parameter."
curl_code[45]="Interface error. A specified outgoing interface could not be used."
curl_code[47]="Too many redirects. When following redirects, curl hit the maximum amount."
curl_code[48]="Unknown option specified to libcurl. This indicates that you passed a weird option to curl that was passed on to libcurl and rejected. Read up in the manual!"
curl_code[49]="Malformed telnet option."
curl_code[51]="The peer's SSL certificate or SSH MD5 fingerprint was not OK."
curl_code[52]="The server didn't reply anything, which here is considered an error."
curl_code[53]="SSL crypto engine not found."
curl_code[54]="Cannot set SSL crypto engine as default."
curl_code[55]="Failed sending network data."
curl_code[56]="Failure in receiving network data."
curl_code[58]="Problem with the local certificate."
curl_code[59]="Couldn't use specified SSL cipher."
curl_code[60]="Peer certificate cannot be authenticated with known CA certificates."
curl_code[61]="Unrecognized transfer encoding."
curl_code[62]="Invalid LDAP URL."
curl_code[63]="Maximum file size exceeded."
curl_code[64]="Requested FTP SSL level failed."
curl_code[65]="Sending the data requires a rewind that failed."
curl_code[66]="Failed to initialise SSL Engine."
curl_code[67]="The user name, password, or similar was not accepted and curl failed to log in."
curl_code[68]="File not found on TFTP server."
curl_code[69]="Permission problem on TFTP server."
curl_code[70]="Out of disk space on TFTP server."
curl_code[71]="Illegal TFTP operation."
curl_code[72]="Unknown TFTP transfer ID."
curl_code[73]="File already exists (TFTP)."
curl_code[74]="No such user (TFTP)."
curl_code[75]="Character conversion failed."
curl_code[76]="Character conversion functions required."
curl_code[77]="Problem with reading the SSL CA cert (path? access rights?)."
curl_code[78]="The resource referenced in the URL does not exist."
curl_code[79]="An unspecified error occurred during the SSH session."
curl_code[80]="Failed to shut down the SSL connection."
curl_code[82]="Could not load CRL file, missing or wrong format (added in 7.19.0)."
curl_code[83]="Issuer check failed (added in 7.19.0)."
curl_code[84]="The FTP PRET command failed"
curl_code[85]="RTSP: mismatch of CSeq numbers"
curl_code[86]="RTSP: mismatch of Session Identifiers"
curl_code[87]="unable to parse FTP file list"
curl_code[88]="FTP chunk callback reported error"
curl_code[89]="No connection available, the session will be queued"
curl_code[90]="SSL public key does not matched pinned public key"
curl_code[91]="Invalid SSL certificate status."
curl_code[92]="Stream error in HTTP/2 framing layer."
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment