tool_operate: retry on HTTP response codes 522 and 524

- Treat HTTP response codes 522 and 524 as a transient error since
  Cloudflare may use them instead of 504 to signal timeout.

For example here is a 522 error message from Cloudflare:

"The initial connection between Cloudflare's network and the origin web
server timed out. As a result, the web page can not be displayed."

Prior to this change the curl tool did not retry on HTTP response codes
522 and 524 when --retry was used.

Fixes https://github.com/curl/curl/discussions/16143
Closes https://github.com/curl/curl/pull/19011
This commit is contained in:
Jay Satiro 2025-10-10 15:42:27 -04:00
parent 64ed2ea196
commit fe06127ded
2 changed files with 4 additions and 2 deletions

View file

@ -412,6 +412,8 @@ static CURLcode retrycheck(struct OperationConfig *config,
case 502: /* Bad Gateway */
case 503: /* Service Unavailable */
case 504: /* Gateway Timeout */
case 522: /* Connection Timed Out (Cloudflare) */
case 524: /* Proxy Read Timeout (Cloudflare) */
retry = RETRY_HTTP;
/*
* At this point, we have already written data to the output