]> git.ipfire.org Git - thirdparty/curl.git/commitdiff
tool_operate: change precedence of server Retry-After time
authorDaniel Stenberg <daniel@haxx.se>
Mon, 5 Feb 2024 23:09:11 +0000 (18:09 -0500)
committerJay Satiro <raysatiro@yahoo.com>
Wed, 7 Feb 2024 07:49:28 +0000 (02:49 -0500)
- When calculating the retry time, no longer allow a server's requested
  Retry-After time to take precedence over a longer retry time (either
  default algorithmic or user-specified).

Prior to this change the server's Retry-After time took precedence over
curl's retry time in all cases, but that's not always practical for
short Retry-After times depending on how busy the server is.

Bug: https://curl.se/mail/archive-2024-01/0022.html
Reported-by: Dirk Hünniger
Closes https://github.com/curl/curl/pull/12871

src/tool_operate.c

index 86936ba5943935fd0d4a4f1b5f86d3a468440302..5a5fc8745ed14ba4e240c8cc1bf1518d6a30b28d 100644 (file)
@@ -554,7 +554,7 @@ static CURLcode post_per_transfer(struct GlobalConfig *global,
           /* store in a 'long', make sure it doesn't overflow */
           if(retry_after > LONG_MAX/1000)
             sleeptime = LONG_MAX;
-          else
+          else if((retry_after * 1000) > sleeptime)
             sleeptime = (long)retry_after * 1000; /* milliseconds */
 
           /* if adding retry_after seconds to the process would exceed the