CURL 7.83.1 released: tool to transfer data from or to a server
curl is a tool to transfer data from or to a server, using one of the supported protocols (HTTP, HTTPS, FTP, FTPS, SCP, SFTP, TFTP, DICT, TELNET, LDAP or FILE). The command is designed to work without user interaction.
curl offers proxy support, user authentication, FTP uploading, HTTP posting, SSL connections, cookies, file transfer resume, Metalink, and many other features.
CURL 7.83.1 released.
Changelog
Bugfixes:
- altsvc: fix host name matching for trailing dots
- cirrus: Update to FreeBSD 12.3
- cirrus: Use pip for Python packages on FreeBSD
- conn: fix typo ‘connnection’ -> ‘connection’ in two function names
- cookies: make bad_domain() not consider a trailing dot fine
- curl: free resource in error path
- curl: guard against size_t wraparound in no-clobber code
- CURLOPT_DOH_URL.3: mention the known bug
- CURLOPT_HSTS*FUNCTION.3: document the involved structs as well
- CURLOPT_SSH_AUTH_TYPES.3: fix the default
- data/test376: set a proper name
- GHA/mbedtls: enabled nghttp2 in the build
- gha: build msh3
- gskit: fixed bogus setsockopt calls
- gskit: remove unused function set_callback
- hsts: ignore trailing dots when comparing hosts names
- HTTP-COOKIES: add missing CURLOPT_COOKIESESSION
- http: move Curl_allow_auth_to_host()
- http_proxy/hyper: handle closed connections
- hyper: fix test 357
- Makefile: fix “make ca-firefox”
- mbedtls: bail out if rng init fails
- mbedtls: fix compile when h2-enabled
- mbedtls: fix some error messages
- misc: use “autoreconf -fi” instead buildconf
- msh3: get msh3 version from MsH3Version
- msh3: print boolean value as text representation
- msh3: psss remote_port to MsH3ConnectionOpen
- ngtcp2: add ca-fallback support for OpenSSL backend
- nss: return error if seemingly stuck in a cert loop
- openssl: define HAVE_SSL_CTX_SET_EC_CURVES for libressl
- post_per_transfer: remove the updated file name
- sectransp: bail out if SSLSetPeerDomainName fails
- tests/server: declare variable ‘reqlogfile’ static
- tests: fix markdown formatting in README
- test{898,974,976}: add ‘HTTP proxy’ keywords
- tls: check more TLS details for connection reuse
- url: check SSH config match on connection reuse
- urlapi: address (harmless) UndefinedBehavior sanitizer warning
- urlapi: reject percent-decoding host name into separator bytes
- x509asn1: make do_pubkey handle EC public keys
- More…
Download
How to use curl
Basic GET
GET a single resource via its URI
The default operation is a GET:
curl http://api.example.com:8080/statuses/1234
GET multiple resources where IDs are in a range
Use square brackets with a dashed range:
curl http://api.example.com:8080/items/[1230-1234]
GET multiple resources where IDs aren’t in a range
Use curly braces with comma-delimited strings:
curl http://api.example.com:8080/products/{abc,def,ghi}/status
Using HTTP Headers
Accept only the application/json content-type
Use the header option: -H or –header
curl -H 'Accept: application/json' http://api.example.com:8080/items/1234
Add multiple headers
Use multiple -H options:
curl -H ‘Accept: application/json’ -H ‘Accept-Encoding: gzip’ http://api.example.com:8080/products/a1b2c3ef/status
Note: the output from this is likely to be unreadable because it’s gzipped!
More likely you’d use this with ETags:
curl -H ‘Accept: application/json’ -H ‘If-None-Match: “1cc044-172-3d9aee80″‘ http://api.example.com:8080/products/a1b2c3ef/status
Show the network and HTTP “conversation”
Use the verbose option: -v or –verbose
curl -v -H http://api.example.com
POST and PUT
POST data to a URI
To send data to the server, you use either POST or PUT, depending on what the API requires. To do a POST, you simply use the -d (–data) with some content:
curl -d "name=Ted" http://api.example.com:8080/customers
Note that this uses application/x-www-form-urlencoded as the Content-Type, i.e.,as if it was submitted by an HTML Form. You can use multiple -d options, which will be combined, e.g., these two commands produce the same content:
curl -d “first=Ted” -d “last=Young” http://api.example.com:8080/customers
curl -d “first=Ted&last=Young” http://api.example.com:8080/customers
If you want to send JSON, you’ll need to specify the Content-Type explicitly using the -H (header) option:
curl -d '{"name": "Ted"}' -H 'Content-Type: application/json' http://api.example.com:8080/items
PUT data to a URI
If you need to use the PUT method, you’ll need to override the method with the -X (–request) option:
curl -X PUT -d ‘{“name”: “Ted”}’ -H ‘Content-Type: application/json’ http://api.example.com:8080/items/1234