I'm trying to get curl to retry as follows:
curl -vvv --retry 100 -H "Authorization: SNIP" "localhost:8086/foo"
localhost:8086/foo
is configured to just always send back a "bad" HTTP status code. I've tried sending 503, 429 and 408 but in all cases, curl only tries once. Here are some example logs:
* Trying 127.0.0.1:8086...
* TCP_NODELAY set
* Connected to localhost (127.0.0.1) port 8086 (#0)
> GET /foo HTTP/1.1
> Host: localhost:8086
> User-Agent: curl/7.68.0
> Accept: */*
> Authorization: SNIP
>
* Mark bundle as not supporting multiuse
< HTTP/1.1 408 Request Time-out
< Expires: 0
< Cache-Control: no-cache, no-store, max-age=0, must-revalidate
< X-XSS-Protection: 1; mode=block
< Pragma: no-cache
< X-Frame-Options: DENY
< Date: Sun, 01 Nov 2020 21:27:00 GMT
< Connection: keep-alive
< X-Content-Type-Options: nosniff
< Content-Length: 0
<
* Connection #0 to host localhost left intact
As you can see, the logs confirm curl received a 408 but curl returns immediately. It doesn't retry another 100 times.
Do I need to specify something beyond --retry
to get this to work?
Here is my curl version:
curl -V
curl 7.68.0 (x86_64-pc-linux-gnu) libcurl/7.68.0 OpenSSL/1.1.1f zlib/1.2.11 brotli/1.0.7 libidn2/2.2.0 libpsl/0.21.0 (+libidn2/2.2.0) libssh/0.9.3/openssl/zlib nghttp2/1.40.0 librtmp/2.3
Release-Date: 2020-01-08
Protocols: dict file ftp ftps gopher http https imap imaps ldap ldaps pop3 pop3s rtmp rtsp scp sftp smb smbs smtp smtps telnet tftp
Features: AsynchDNS brotli GSS-API HTTP2 HTTPS-proxy IDN IPv6 Kerberos Largefile libz NTLM NTLM_WB PSL SPNEGO SSL TLS-SRP UnixSockets