[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] [gnurl] 85/220: curl: make use of CURLINFO_RETRY_AFTER when
From: |
gnunet |
Subject: |
[GNUnet-SVN] [gnurl] 85/220: curl: make use of CURLINFO_RETRY_AFTER when retrying |
Date: |
Thu, 12 Sep 2019 17:27:25 +0200 |
This is an automated email from the git hooks/post-receive script.
ng0 pushed a commit to branch master
in repository gnurl.
commit 640b9733de74d629af68afcad0ff8bb658e80eff
Author: Daniel Stenberg <address@hidden>
AuthorDate: Tue Aug 6 11:57:02 2019 +0200
curl: make use of CURLINFO_RETRY_AFTER when retrying
If a Retry-After: header was used in the response, that value overrides
other retry timing options.
Fixes #3794
Closes #4195
---
docs/cmdline-opts/retry.d | 3 +++
src/tool_operate.c | 15 ++++++++++++++-
2 files changed, 17 insertions(+), 1 deletion(-)
diff --git a/docs/cmdline-opts/retry.d b/docs/cmdline-opts/retry.d
index 32d1c799b..3db89b71c 100644
--- a/docs/cmdline-opts/retry.d
+++ b/docs/cmdline-opts/retry.d
@@ -14,4 +14,7 @@ for all forthcoming retries it will double the waiting time
until it reaches
using --retry-delay you disable this exponential backoff algorithm. See also
--retry-max-time to limit the total time allowed for retries.
+Since curl 7.66.0, curl will comply with the Retry-After: response header if
+one was present to know when to issue the next retry.
+
If this option is used several times, the last one will be used.
diff --git a/src/tool_operate.c b/src/tool_operate.c
index 923b5a99d..01ee20061 100644
--- a/src/tool_operate.c
+++ b/src/tool_operate.c
@@ -496,6 +496,8 @@ static CURLcode post_transfer(struct GlobalConfig *global,
}
if(retry) {
+ long sleeptime = 0;
+ curl_off_t retry_after = 0;
static const char * const m[]={
NULL,
"timeout",
@@ -504,13 +506,24 @@ static CURLcode post_transfer(struct GlobalConfig *global,
"FTP error"
};
+ sleeptime = per->retry_sleep;
+ if(RETRY_HTTP == retry) {
+ curl_easy_getinfo(curl, CURLINFO_RETRY_AFTER, &retry_after);
+ if(retry_after) {
+ /* store in a 'long', make sure it doesn't overflow */
+ if(retry_after > LONG_MAX/1000)
+ sleeptime = LONG_MAX;
+ else
+ sleeptime = (long)retry_after * 1000; /* milliseconds */
+ }
+ }
warnf(config->global, "Transient problem: %s "
"Will retry in %ld seconds. "
"%ld retries left.\n",
m[retry], per->retry_sleep/1000L, per->retry_numretries);
- tool_go_sleep(per->retry_sleep);
per->retry_numretries--;
+ tool_go_sleep(sleeptime);
if(!config->retry_delay) {
per->retry_sleep *= 2;
if(per->retry_sleep > RETRY_SLEEP_MAX)
--
To stop receiving notification emails like this one, please contact
address@hidden.
- [GNUnet-SVN] [gnurl] 124/220: ngtcp2: do QUIC connections happy-eyeballs friendly, (continued)
- [GNUnet-SVN] [gnurl] 124/220: ngtcp2: do QUIC connections happy-eyeballs friendly, gnunet, 2019/09/12
- [GNUnet-SVN] [gnurl] 135/220: tests: Replace outdated test case numbering documentation, gnunet, 2019/09/12
- [GNUnet-SVN] [gnurl] 133/220: configure: use -lquiche to link to quiche, gnunet, 2019/09/12
- [GNUnet-SVN] [gnurl] 144/220: quiche: register debug callback once and earlier, gnunet, 2019/09/12
- [GNUnet-SVN] [gnurl] 138/220: RELEASE-NOTES: synced, gnunet, 2019/09/12
- [GNUnet-SVN] [gnurl] 140/220: vssh: create directory for SSH backend code, gnunet, 2019/09/12
- [GNUnet-SVN] [gnurl] 145/220: ngtcp2: move the h3 initing to immediately after the rx key, gnunet, 2019/09/12
- [GNUnet-SVN] [gnurl] 130/220: ngtcp2: deal with stream close, gnunet, 2019/09/12
- [GNUnet-SVN] [gnurl] 131/220: ngtcp2: add missing nghttp3_conn_add_write_offset call, gnunet, 2019/09/12
- [GNUnet-SVN] [gnurl] 132/220: ngtcp2: provide the callbacks as a static struct, gnunet, 2019/09/12
- [GNUnet-SVN] [gnurl] 85/220: curl: make use of CURLINFO_RETRY_AFTER when retrying,
gnunet <=
- [GNUnet-SVN] [gnurl] 89/220: alt-svc: send Alt-Used: in redirected requests, gnunet, 2019/09/12
- [GNUnet-SVN] [gnurl] 141/220: vssh: move ssh init/cleanup functions into backend code, gnunet, 2019/09/12
- [GNUnet-SVN] [gnurl] 114/220: CURLOPT_ALTSVC_CTRL.3: remove CURLALTSVC_ALTUSED, gnunet, 2019/09/12
- [GNUnet-SVN] [gnurl] 120/220: curl_version_info: make the quic_version a const, gnunet, 2019/09/12
- [GNUnet-SVN] [gnurl] 126/220: connect: connections are persistent by default for HTTP/3, gnunet, 2019/09/12
- [GNUnet-SVN] [gnurl] 134/220: travis: reduce number of torture tests in 'coverage', gnunet, 2019/09/12
- [GNUnet-SVN] [gnurl] 150/220: configure: use pkg-config to detect quiche, gnunet, 2019/09/12
- [GNUnet-SVN] [gnurl] 129/220: ngtcp2: Consume QUIC STREAM data properly, gnunet, 2019/09/12
- [GNUnet-SVN] [gnurl] 137/220: travis: add a quiche build, gnunet, 2019/09/12
- [GNUnet-SVN] [gnurl] 149/220: CURLOPT_SSL_VERIFYHOST: treat the value 1 as 2, gnunet, 2019/09/12