curl: 8.12.1 -> 8.13.0 (#396200)

authored by scrumplex.net and committed by GitHub 262d9972 817a78a6

+177 -2
+13
pkgs/by-name/cm/cmake/009-cmCurl-Avoid-using-undocumented-type-for-CURLOPT_NETRC-values.diff
··· 1 + diff --git a/Source/cmCurl.cxx b/Source/cmCurl.cxx 2 + index b9133ed7d47b9023de66a94ed5ff15a0f1ba440c..0cf8a71a72daaa07cb42b3f5eef81d2d04300cd6 100644 3 + --- a/Source/cmCurl.cxx 4 + +++ b/Source/cmCurl.cxx 5 + @@ -170,7 +170,7 @@ std::string cmCurlSetNETRCOption(::CURL* curl, const std::string& netrc_level, 6 + const std::string& netrc_file) 7 + { 8 + std::string e; 9 + - CURL_NETRC_OPTION curl_netrc_level = CURL_NETRC_LAST; 10 + + long curl_netrc_level = CURL_NETRC_LAST; 11 + ::CURLcode res; 12 + 13 + if (!netrc_level.empty()) {
+2
pkgs/by-name/cm/cmake/package.nix
··· 76 76 # Backport of https://gitlab.kitware.com/cmake/cmake/-/merge_requests/9900 77 77 # Needed to correctly link curl in pkgsStatic. 78 78 ./008-FindCURL-Add-more-target-properties-from-pkg-config.diff 79 + # Backport of https://gitlab.kitware.com/cmake/cmake/-/commit/1b0c92a3a1b782ff3e1c4499b6ab8db614d45bcd 80 + ./009-cmCurl-Avoid-using-undocumented-type-for-CURLOPT_NETRC-values.diff 79 81 ]; 80 82 81 83 outputs =
+155
pkgs/by-name/cu/curlMinimal/0001-http2-fix-stream-window-size-after-unpausing.patch
··· 1 + From 5fbd78eb2dc4afbd8884e8eed27147fc3d4318f6 Mon Sep 17 00:00:00 2001 2 + From: Stefan Eissing <stefan@eissing.org> 3 + Date: Fri, 4 Apr 2025 10:43:13 +0200 4 + Subject: [PATCH] http2: fix stream window size after unpausing 5 + 6 + When pausing a HTTP/2 transfer, the stream's local window size 7 + is reduced to 0 to prevent the server from sending further data 8 + which curl cannot write out to the application. 9 + 10 + When unpausing again, the stream's window size was not correctly 11 + increased again. The attempt to trigger a window update was 12 + ignored by nghttp2, the server never received it and the transfer 13 + stalled. 14 + 15 + Add a debug feature to allow use of small window sizes which 16 + reproduces this bug in test_02_21. 17 + 18 + Fixes #16955 19 + Closes #16960 20 + --- 21 + docs/libcurl/libcurl-env-dbg.md | 5 +++++ 22 + lib/http2.c | 31 +++++++++++++++++++++++++++++++ 23 + tests/http/test_02_download.py | 27 +++++++++++++++++++++++++-- 24 + 3 files changed, 61 insertions(+), 2 deletions(-) 25 + 26 + diff --git a/docs/libcurl/libcurl-env-dbg.md b/docs/libcurl/libcurl-env-dbg.md 27 + index 471533625f6b..60c887bfd5a9 100644 28 + --- a/docs/libcurl/libcurl-env-dbg.md 29 + +++ b/docs/libcurl/libcurl-env-dbg.md 30 + @@ -147,3 +147,8 @@ Make a blocking, graceful shutdown of all remaining connections when 31 + a multi handle is destroyed. This implicitly triggers for easy handles 32 + that are run via easy_perform. The value of the environment variable 33 + gives the shutdown timeout in milliseconds. 34 + + 35 + +## `CURL_H2_STREAM_WIN_MAX` 36 + + 37 + +Set to a positive 32-bit number to override the HTTP/2 stream window's 38 + +default of 10MB. Used in testing to verify correct window update handling. 39 + diff --git a/lib/http2.c b/lib/http2.c 40 + index 88fbcceb7135..a1221dcc51de 100644 41 + --- a/lib/http2.c 42 + +++ b/lib/http2.c 43 + @@ -44,6 +44,7 @@ 44 + #include "connect.h" 45 + #include "rand.h" 46 + #include "strdup.h" 47 + +#include "strparse.h" 48 + #include "transfer.h" 49 + #include "dynbuf.h" 50 + #include "headers.h" 51 + @@ -141,6 +142,9 @@ struct cf_h2_ctx { 52 + uint32_t goaway_error; /* goaway error code from server */ 53 + int32_t remote_max_sid; /* max id processed by server */ 54 + int32_t local_max_sid; /* max id processed by us */ 55 + +#ifdef DEBUGBUILD 56 + + int32_t stream_win_max; /* max h2 stream window size */ 57 + +#endif 58 + BIT(initialized); 59 + BIT(via_h1_upgrade); 60 + BIT(conn_closed); 61 + @@ -166,6 +170,18 @@ static void cf_h2_ctx_init(struct cf_h2_ctx *ctx, bool via_h1_upgrade) 62 + Curl_hash_offt_init(&ctx->streams, 63, h2_stream_hash_free); 63 + ctx->remote_max_sid = 2147483647; 64 + ctx->via_h1_upgrade = via_h1_upgrade; 65 + +#ifdef DEBUGBUILD 66 + + { 67 + + const char *p = getenv("CURL_H2_STREAM_WIN_MAX"); 68 + + 69 + + ctx->stream_win_max = H2_STREAM_WINDOW_SIZE_MAX; 70 + + if(p) { 71 + + curl_off_t l; 72 + + if(!Curl_str_number(&p, &l, INT_MAX)) 73 + + ctx->stream_win_max = (int32_t)l; 74 + + } 75 + + } 76 + +#endif 77 + ctx->initialized = TRUE; 78 + } 79 + 80 + @@ -285,7 +301,15 @@ static int32_t cf_h2_get_desired_local_win(struct Curl_cfilter *cf, 81 + * This gets less precise the higher the latency. */ 82 + return (int32_t)data->set.max_recv_speed; 83 + } 84 + +#ifdef DEBUGBUILD 85 + + else { 86 + + struct cf_h2_ctx *ctx = cf->ctx; 87 + + CURL_TRC_CF(data, cf, "stream_win_max=%d", ctx->stream_win_max); 88 + + return ctx->stream_win_max; 89 + + } 90 + +#else 91 + return H2_STREAM_WINDOW_SIZE_MAX; 92 + +#endif 93 + } 94 + 95 + static CURLcode cf_h2_update_local_win(struct Curl_cfilter *cf, 96 + @@ -302,6 +326,13 @@ static CURLcode cf_h2_update_local_win(struct Curl_cfilter *cf, 97 + int32_t wsize = nghttp2_session_get_stream_effective_local_window_size( 98 + ctx->h2, stream->id); 99 + if(dwsize > wsize) { 100 + + rv = nghttp2_session_set_local_window_size(ctx->h2, NGHTTP2_FLAG_NONE, 101 + + stream->id, dwsize); 102 + + if(rv) { 103 + + failf(data, "[%d] nghttp2 set_local_window_size(%d) failed: " 104 + + "%s(%d)", stream->id, dwsize, nghttp2_strerror(rv), rv); 105 + + return CURLE_HTTP2; 106 + + } 107 + rv = nghttp2_submit_window_update(ctx->h2, NGHTTP2_FLAG_NONE, 108 + stream->id, dwsize - wsize); 109 + if(rv) { 110 + diff --git a/tests/http/test_02_download.py b/tests/http/test_02_download.py 111 + index 4b9ae3caefab..b55f022338ad 100644 112 + --- a/tests/http/test_02_download.py 113 + +++ b/tests/http/test_02_download.py 114 + @@ -313,9 +313,9 @@ def test_02_20_h2_small_frames(self, env: Env, httpd): 115 + assert httpd.stop() 116 + assert httpd.start() 117 + 118 + - # download via lib client, 1 at a time, pause/resume at different offsets 119 + + # download serial via lib client, pause/resume at different offsets 120 + @pytest.mark.parametrize("pause_offset", [0, 10*1024, 100*1023, 640000]) 121 + - @pytest.mark.parametrize("proto", ['http/1.1', 'h2', 'h3']) 122 + + @pytest.mark.parametrize("proto", ['http/1.1', 'h3']) 123 + def test_02_21_lib_serial(self, env: Env, httpd, nghttpx, proto, pause_offset): 124 + if proto == 'h3' and not env.have_h3(): 125 + pytest.skip("h3 not supported") 126 + @@ -332,6 +332,29 @@ def test_02_21_lib_serial(self, env: Env, httpd, nghttpx, proto, pause_offset): 127 + srcfile = os.path.join(httpd.docs_dir, docname) 128 + self.check_downloads(client, srcfile, count) 129 + 130 + + # h2 download parallel via lib client, pause/resume at different offsets 131 + + # debug-override stream window size to reproduce #16955 132 + + @pytest.mark.parametrize("pause_offset", [0, 10*1024, 100*1023, 640000]) 133 + + @pytest.mark.parametrize("swin_max", [0, 10*1024]) 134 + + def test_02_21_h2_lib_serial(self, env: Env, httpd, pause_offset, swin_max): 135 + + proto = 'h2' 136 + + count = 2 137 + + docname = 'data-10m' 138 + + url = f'https://localhost:{env.https_port}/{docname}' 139 + + run_env = os.environ.copy() 140 + + run_env['CURL_DEBUG'] = 'multi,http/2' 141 + + if swin_max > 0: 142 + + run_env['CURL_H2_STREAM_WIN_MAX'] = f'{swin_max}' 143 + + client = LocalClient(name='hx-download', env=env, run_env=run_env) 144 + + if not client.exists(): 145 + + pytest.skip(f'example client not built: {client.name}') 146 + + r = client.run(args=[ 147 + + '-n', f'{count}', '-P', f'{pause_offset}', '-V', proto, url 148 + + ]) 149 + + r.check_exit_code(0) 150 + + srcfile = os.path.join(httpd.docs_dir, docname) 151 + + self.check_downloads(client, srcfile, count) 152 + + 153 + # download via lib client, several at a time, pause/resume 154 + @pytest.mark.parametrize("pause_offset", [100*1023]) 155 + @pytest.mark.parametrize("proto", ['http/1.1', 'h2', 'h3'])
+7 -2
pkgs/by-name/cu/curlMinimal/package.nix
··· 91 91 92 92 stdenv.mkDerivation (finalAttrs: { 93 93 pname = "curl"; 94 - version = "8.12.1"; 94 + version = "8.13.0"; 95 95 96 96 src = fetchurl { 97 97 urls = [ ··· 100 100 builtins.replaceStrings [ "." ] [ "_" ] finalAttrs.version 101 101 }/curl-${finalAttrs.version}.tar.xz" 102 102 ]; 103 - hash = "sha256-A0Hx7ZeibIEauuvTfWK4M5VnkrdgfqPxXQAWE8dt4gI="; 103 + hash = "sha256-Sgk5eaPC0C3i+8AFSaMncQB/LngDLG+qXs0vep4VICU="; 104 104 }; 105 + 106 + patches = [ 107 + # Backport of https://github.com/curl/curl/commit/5fbd78eb2dc4afbd8884e8eed27147fc3d4318f6 108 + ./0001-http2-fix-stream-window-size-after-unpausing.patch 109 + ]; 105 110 106 111 # this could be accomplished by updateAutotoolsGnuConfigScriptsHook, but that causes infinite recursion 107 112 # necessary for FreeBSD code path in configure