Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Retry-After handling does not honor --retry-max-time #7675

Closed
kaol opened this issue Sep 5, 2021 · 4 comments
Closed

Retry-After handling does not honor --retry-max-time #7675

kaol opened this issue Sep 5, 2021 · 4 comments

Comments

@kaol
Copy link

kaol commented Sep 5, 2021

I did this

I made this nginx config to test this out:

location /503/ {
  add_header Retry-After 86400 always;
  return 503;
}
location /503-2/ {
  return 503;
}

My command:

curl -i -m 5 --retry 2 http://localhost/503/

I expected the following

The command to fail within five seconds, not within 3 days. If the Retry-After time is after max-time's limit, it should fail immediately.

curl/libcurl version

curl 7.74.0 (x86_64-pc-linux-gnu) libcurl/7.74.0 OpenSSL/1.1.1l zlib/1.2.11 brotli/1.0.9 libidn2/2.3.2 libpsl/0.21.0 (+libidn2/2.3.0) libssh2/1.9.0 nghttp2/1.43.0 librtmp/2.3
Release-Date: 2020-12-09
Protocols: dict file ftp ftps gopher http https imap imaps ldap ldaps mqtt pop3 pop3s rtmp rtsp scp sftp smb smbs smtp smtps telnet tftp
Features: alt-svc AsynchDNS brotli GSS-API HTTP2 HTTPS-proxy IDN IPv6 Kerberos Largefile libz NTLM NTLM_WB PSL SPNEGO SSL TLS-SRP UnixSockets

Not the newest version but I saw no mentions of max-time or Retry-After in the changelog.

operating system

Linux sammakko3 5.10.0-8-amd64 #1 SMP Debian 5.10.46-4 (2021-08-03) x86_64 GNU/Linux

@bagder
Copy link
Member

bagder commented Sep 5, 2021

--max-time limits each transfer, if you want to limit all retried transfers you want --retry-max-time

@bagder bagder added the not-a-bug This is not a bug in curl label Sep 5, 2021
@kaol
Copy link
Author

kaol commented Sep 6, 2021

Did you try it? --retry-max-time has no effect either, it's still going to only use Retry-Timeout.

I already used timeout 60 curl to work around this.

@bagder
Copy link
Member

bagder commented Sep 6, 2021

I didn't try it because your issue here was incorrect. Now you've clarified it with more details.

@bagder bagder removed the not-a-bug This is not a bug in curl label Sep 6, 2021
bagder added a commit that referenced this issue Sep 6, 2021
If Retry-After: specifies a period that is longer than what fits within
--retry-max-time, then stop retrying immediately.

Added test 366 to verify.

Reported-by: Kari Pahula
Fixes #7675
@bagder bagder changed the title Retry-After handling does not honor --max-time Retry-After handling does not honor --retry-max-time Sep 6, 2021
bagder added a commit that referenced this issue Sep 6, 2021
If Retry-After: specifies a period that is longer than what fits within
--retry-max-time, then stop retrying immediately.

Added test 366 to verify.

Reported-by: Kari Pahula
Fixes #7675
@bagder bagder closed this as completed in eb2a517 Sep 6, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

Successfully merging a pull request may close this issue.

3 participants
@bagder @kaol and others