Doku review done: Mon 20 Feb 2023 11:04:57 CET

Table of content

Commands

CommandsDescription
curl -I [url]shows only security headers
curl -k [url](TLS) By default, every SSL connection curl makes is verified to be secure. This option allows curl to proceed and operate even for server connections otherwise considered insecure.
curl -A "[uer-agent-name]" [url]changes user agent
curl -H "User-Agent: [uer-agent-name]" [url]changes user agent
curl [-f/--fail] [url]lets curl exit with none 0 returncode on failed actions (returncode 22 will be used instead)
curl --fail-early [url]Fail and exit on the first detected transfer error.
curl --fail-with-body [url]Return an error on server errors where the HTTP response code is 400 or greater

Addition to -f,--fail parameter

This method is not fail-safe and there are occasions where non-successful response codes will slip through, especially when authentication is involved (response codes 401 and 407).

Note -f, --fail is not global and is therefore contained by -:, --next

Addition to --fail-early parameter

Using this option, curl will instead return an error on the first transfer that fails, independent of the amount of URLs that are given on the command line. This way, no transfer failures go undetected by scripts and similar.

This option is global and does not need to be specified for each use of -:, --next.

Addition to --fail-with-body parameter

This is an alternative option to -f, --fail which makes curl fail for the same circumstances but without saving the content.

Exit codes

can be found in man page as well ;)

  1. Unsupported protocol. This build of curl has no support for this protocol.
  2. Failed to initialize.
  3. URL malformed. The syntax was not correct.
  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!
  5. Couldn’t resolve proxy. The given proxy host could not be resolved.
  6. Couldn’t resolve host. The given remote host was not resolved.
  7. Failed to connect to host.
  8. Weird server reply. The server sent data curl couldn’t parse.
  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.
  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.
  11. FTP weird PASS reply. curl couldn’t parse the reply sent to the PASS request.
  12. During an active FTP session while waiting for the server to connect back to curl, the timeout expired.
  13. FTP weird PASV reply, curl couldn’t parse the reply sent to the PASV request.
  14. FTP weird 227 format. curl couldn’t parse the 227-line the server sent.
  15. FTP can’t get host. Couldn’t resolve the host IP we got in the 227-line.
  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.
  17. FTP couldn’t set binary. Couldn’t change transfer method to binary.
  18. Partial file. Only a part of the file was transferred.
  19. FTP couldn’t download/access the given file, the RETR (or similar) command failed.
  20. FTP quote error. A quote command returned error from the server.
  21. 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.
  22. Write error. curl couldn’t write data to a local filesystem or similar.
  23. FTP couldn’t STOR file. The server denied the STOR operation, used for FTP uploading.
  24. Read error. Various reading problems.
  25. Out of memory. A memory allocation request failed.
  26. Operation timeout. The specified time-out period was reached according to the conditions.
  27. FTP PORT failed. The PORT command failed. Not all FTP servers support the PORT command, try doing a transfer using PASV instead!
  28. FTP couldn’t use REST. The REST command failed. This command is used for resumed FTP transfers.
  29. HTTP range error. The range “command” didn’t work.
  30. HTTP post error. Internal post-request generation error.
  31. SSL connect error. The SSL handshaking failed.
  32. Bad download resume. Couldn’t continue an earlier aborted download.
  33. FILE couldn’t read file. Failed to open the file. Permissions?
  34. LDAP cannot bind. LDAP bind operation failed.
  35. LDAP search failed.
  36. Function not found. A required LDAP function was not found.
  37. Aborted by callback. An application told curl to abort the operation.
  38. Internal error. A function was called with a bad parameter.
  39. Interface error. A specified outgoing interface could not be used.
  40. Too many redirects. When following redirects, curl hit the maximum amount.
  41. 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!
  42. Malformed telnet option.
  43. The peer’s SSL certificate or SSH MD5 fingerprint was not OK.
  44. The server didn’t reply anything, which here is considered an error.
  45. SSL crypto engine not found.
  46. Cannot set SSL crypto engine as default.
  47. Failed sending network data.
  48. Failure in receiving network data.
  49. Problem with the local certificate.
  50. Couldn’t use specified SSL cipher.
  51. Peer certificate cannot be authenticated with known CA certificates.
  52. Unrecognized transfer encoding.
  53. Invalid LDAP URL.
  54. Maximum file size exceeded.
  55. Requested FTP SSL level failed.
  56. Sending the data requires a rewind that failed.
  57. Failed to initialise SSL Engine.
  58. The user name, password, or similar was not accepted and curl failed to log in.
  59. File not found on TFTP server.
  60. Permission problem on TFTP server.
  61. Out of disk space on TFTP server.
  62. Illegal TFTP operation.
  63. Unknown TFTP transfer ID.
  64. File already exists (TFTP).
  65. No such user (TFTP).
  66. Character conversion failed.
  67. Character conversion functions required.
  68. Problem with reading the SSL CA cert (path? access rights?).
  69. The resource referenced in the URL does not exist.
  70. An unspecified error occurred during the SSH session.
  71. Failed to shut down the SSL connection.
  72. Could not load CRL file, missing or wrong format (added in 7.19.0).
  73. Issuer check failed (added in 7.19.0).
  74. The FTP PRET command failed
  75. RTSP: mismatch of CSeq numbers
  76. RTSP: mismatch of Session Identifiers
  77. unable to parse FTP file list
  78. FTP chunk callback reported error
  79. No connection available, the session will be queued
  80. SSL public key does not matched pinned public key
  81. Invalid SSL certificate status.
  82. Stream error in HTTP/2 framing layer.
  83. An API function was called from inside a callback.
  84. An authentication function returned an error.
  85. A problem was detected in the HTTP/3 layer. This is somewhat generic and can be one out of several problems, see the error message for details.
  86. QUIC connection error. This error may be caused by an SSL library error. QUIC is the protocol used for HTTP/3 transfers. XX. More error codes will appear here in future releases. The existing ones are meant to never change.