From 612554bc4d56452fe51ab93cec4d39048f2fef9cfc470d4eaaffebeddc34383c Mon Sep 17 00:00:00 2001 From: Pedro Monreal Gonzalez Date: Mon, 12 Feb 2024 09:49:54 +0000 Subject: [PATCH] Accepting request 1145417 from home:favogt:branches:devel:libraries:c_c++ - Add patch to fix various TLS related issues including FTP over SSL transmission timeouts: * 0001-vtls-revert-receive-max-buffer-add-test-case.patch - Switch to %autosetup Now with workaround for https://github.com/curl/curl/issues/12914. OBS-URL: https://build.opensuse.org/request/show/1145417 OBS-URL: https://build.opensuse.org/package/show/devel:libraries:c_c++/curl?expand=0&rev=354 --- ...ert-receive-max-buffer-add-test-case.patch | 70 +++++++++++++++++++ curl.changes | 8 +++ curl.spec | 5 +- 3 files changed, 81 insertions(+), 2 deletions(-) create mode 100644 0001-vtls-revert-receive-max-buffer-add-test-case.patch diff --git a/0001-vtls-revert-receive-max-buffer-add-test-case.patch b/0001-vtls-revert-receive-max-buffer-add-test-case.patch new file mode 100644 index 0000000..4a432c4 --- /dev/null +++ b/0001-vtls-revert-receive-max-buffer-add-test-case.patch @@ -0,0 +1,70 @@ +From e00609fc15f5d5adaf0896b751bf2c3a74a5f6f4 Mon Sep 17 00:00:00 2001 +From: Stefan Eissing +Date: Thu, 1 Feb 2024 18:15:50 +0100 +Subject: [PATCH] vtls: revert "receive max buffer" + add test case + +- add test_05_04 for requests using http/1.0, http/1.1 and h2 against an + Apache resource that does an unclean TLS shutdown. +- revert special workarund in openssl.c for suppressing shutdown errors + on multiplexed connections +- vlts.c restore to its state before 9a90c9dd64d2f03601833a70786d485851bd1b53 + +Fixes #12885 +Fixes #12844 + +Closes #12848 + +(cherry picked from commit ed09a99af57200643d5ae001e815eeab9ffe3f84) +--- + lib/vtls/vtls.c | 27 +++++-------------- + tests/http/test_05_errors.py | 27 +++++++++++++++++++ + tests/http/testenv/httpd.py | 7 ++++- + .../http/testenv/mod_curltest/mod_curltest.c | 2 +- + 4 files changed, 40 insertions(+), 23 deletions(-) + +diff --git a/lib/vtls/vtls.c b/lib/vtls/vtls.c +index e928ba5d0..f654a9749 100644 +--- a/lib/vtls/vtls.c ++++ b/lib/vtls/vtls.c +@@ -1715,32 +1715,17 @@ static ssize_t ssl_cf_recv(struct Curl_cfilter *cf, + { + struct cf_call_data save; + ssize_t nread; +- size_t ntotal = 0; + + CF_DATA_SAVE(save, cf, data); + *err = CURLE_OK; +- /* Do receive until we fill the buffer somehwhat or EGAIN, error or EOF */ +- while(!ntotal || (len - ntotal) > (4*1024)) { ++ nread = Curl_ssl->recv_plain(cf, data, buf, len, err); ++ if(nread > 0) { ++ DEBUGASSERT((size_t)nread <= len); ++ } ++ else if(nread == 0) { ++ /* eof */ + *err = CURLE_OK; +- nread = Curl_ssl->recv_plain(cf, data, buf + ntotal, len - ntotal, err); +- if(nread < 0) { +- if(*err == CURLE_AGAIN && ntotal > 0) { +- /* we EAGAINed after having reed data, return the success amount */ +- *err = CURLE_OK; +- break; +- } +- /* we have a an error to report */ +- goto out; +- } +- else if(nread == 0) { +- /* eof */ +- break; +- } +- ntotal += (size_t)nread; +- DEBUGASSERT((size_t)ntotal <= len); + } +- nread = (ssize_t)ntotal; +-out: + CURL_TRC_CF(data, cf, "cf_recv(len=%zu) -> %zd, %d", len, + nread, *err); + CF_DATA_RESTORE(cf, save); +-- +2.43.0 + diff --git a/curl.changes b/curl.changes index 88ee93b..399e927 100644 --- a/curl.changes +++ b/curl.changes @@ -1,3 +1,11 @@ +------------------------------------------------------------------- +Thu Feb 8 13:58:23 UTC 2024 - Fabian Vogt + +- Add patch to fix various TLS related issues including FTP over SSL + transmission timeouts: + * 0001-vtls-revert-receive-max-buffer-add-test-case.patch +- Switch to %autosetup + ------------------------------------------------------------------- Wed Jan 31 09:11:56 UTC 2024 - Pedro Monreal diff --git a/curl.spec b/curl.spec index 749ef75..dca1e39 100644 --- a/curl.spec +++ b/curl.spec @@ -35,6 +35,8 @@ Patch1: dont-mess-with-rpmoptflags.patch Patch2: curl-secure-getenv.patch #PATCH-FIX-OPENSUSE bsc#1076446 protocol redirection not supported or disabled Patch3: curl-disabled-redirect-protocol-message.patch +# PATCH-FIX-UPSTREAM +Patch4: 0001-vtls-revert-receive-max-buffer-add-test-case.patch BuildRequires: libtool BuildRequires: pkgconfig Requires: libcurl4 = %{version} @@ -100,8 +102,7 @@ DICT, TELNET, LDAP, or FILE). The command is designed to work without user interaction or any kind of interactivity. %prep -%setup -q -n curl-%{version} -%autopatch -p1 +%autosetup -p1 %build # curl complains if macro definition is contained in CFLAGS