File fix-return-code-with-retry.patch of Package curl
From b42776b4f4a6e9c9f5e3ff49d7bf610ad99c45c9 Mon Sep 17 00:00:00 2001
From: Daniel Stenberg <daniel@haxx.se>
Date: Mon, 9 Jun 2025 08:37:49 +0200
Subject: [PATCH] tool_operate: fix return code when --retry is used but not
triggered
Verify with test 752
Reported-by: fjaell on github
Fixes #17554
Closes #17559
---
src/tool_operate.c | 3 +-
tests/data/Makefile.am | 2 +-
tests/data/test752 | 72 ++++++++++++++++++++++++++++++++++++++++++
3 files changed, 75 insertions(+), 2 deletions(-)
create mode 100644 tests/data/test752
diff --git a/src/tool_operate.c b/src/tool_operate.c
index 24e79e6f61fa..2397de1686d9 100644
--- a/src/tool_operate.c
+++ b/src/tool_operate.c
@@ -548,8 +548,9 @@ static CURLcode retrycheck(struct OperationConfig *config,
*retryp = TRUE;
per->num_retries++;
*delayms = sleeptime;
+ result = CURLE_OK;
}
- return CURLE_OK;
+ return result;
}
diff --git a/tests/data/Makefile.am b/tests/data/Makefile.am
index 446674605835..ab21e0e220be 100644
--- a/tests/data/Makefile.am
+++ b/tests/data/Makefile.am
@@ -107,7 +107,7 @@ test709 test710 test711 test712 test713 test714 test715 test716 test717 \
test718 test719 test720 test721 test722 test723 test724 test725 test726 \
test727 test728 test729 test730 test731 test732 test733 test734 test735 \
test736 test737 test738 test739 test740 test741 test742 test743 test744 \
-test745 test746 test747 test748 test749 test750 test751 \
+test745 test746 test747 test748 test749 test750 test751 test752 \
\
test780 test781 test782 test783 test784 test785 test786 test787 test788 \
test789 test790 test791 \
diff --git a/tests/data/test752 b/tests/data/test752
new file mode 100644
index 000000000000..00f14909d125
--- /dev/null
+++ b/tests/data/test752
@@ -0,0 +1,72 @@
+<testcase>
+<info>
+<keywords>
+HTTP
+HTTP GET
+-f
+--retry
+</keywords>
+</info>
+
+#
+# Server-side
+<reply>
+<data crlf="yes">
+HTTP/1.1 404 nopes
+Date: Tue, 09 Nov 2010 14:49:00 GMT
+Server: test-server/fake
+Last-Modified: Tue, 13 Jun 2000 12:10:00 GMT
+ETag: "21025-dc7-39462498"
+Accept-Ranges: bytes
+Content-Length: 6
+Connection: close
+Content-Type: text/html
+Funny-head: yesyes
+
+-foo-
+</data>
+
+<datacheck crlf="yes">
+HTTP/1.1 404 nopes
+Date: Tue, 09 Nov 2010 14:49:00 GMT
+Server: test-server/fake
+Last-Modified: Tue, 13 Jun 2000 12:10:00 GMT
+ETag: "21025-dc7-39462498"
+Accept-Ranges: bytes
+Content-Length: 6
+Connection: close
+Content-Type: text/html
+Funny-head: yesyes
+
+</datacheck>
+</reply>
+
+#
+# Client-side
+<client>
+<server>
+http
+</server>
+<name>
+--retry and -f on a HTTP 404 response
+</name>
+<command>
+http://%HOSTIP:%HTTPPORT/%TESTNUMBER -f --retry 1
+</command>
+</client>
+
+#
+# Verify data after the test has been "shot"
+<verify>
+<protocol crlf="yes">
+GET /%TESTNUMBER HTTP/1.1
+Host: %HOSTIP:%HTTPPORT
+User-Agent: curl/%VERSION
+Accept: */*
+
+</protocol>
+<errorcode>
+22
+</errorcode>
+</verify>
+</testcase>