commit:     6da47de8d9c8087ff2f55c8fc4459387207a13cd
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Fri Jan  5 05:56:33 2024 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Fri Jan  5 05:57:04 2024 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=6da47de8

net-misc/curl: fix mpd streaming

Bug: https://github.com/MusicPlayerDaemon/MPD/issues/1952
Bug: https://github.com/curl/curl/issues/12632
Closes: https://bugs.gentoo.org/916471
Signed-off-by: Sam James <sam <AT> gentoo.org>

 .../{curl-9999.ebuild => curl-8.5.0-r2.ebuild}     |  8 ++-
 net-misc/curl/curl-9999.ebuild                     |  5 +-
 ...curl-8.5.0-mpd-stream-http-adjust_pollset.patch | 69 ++++++++++++++++++++++
 3 files changed, 79 insertions(+), 3 deletions(-)

diff --git a/net-misc/curl/curl-9999.ebuild b/net-misc/curl/curl-8.5.0-r2.ebuild
similarity index 97%
copy from net-misc/curl/curl-9999.ebuild
copy to net-misc/curl/curl-8.5.0-r2.ebuild
index 7d87477bc1f1..03cc7f61ebca 100644
--- a/net-misc/curl/curl-9999.ebuild
+++ b/net-misc/curl/curl-8.5.0-r2.ebuild
@@ -1,4 +1,4 @@
-# Copyright 1999-2023 Gentoo Authors
+# Copyright 1999-2024 Gentoo Authors
 # Distributed under the terms of the GNU General Public License v2
 
 EAPI=8
@@ -123,11 +123,14 @@ QA_CONFIG_IMPL_DECL_SKIP=(
        IoctlSocket
        mach_absolute_time
        setmode
+       _fseeki64
 )
 
 PATCHES=(
        "${FILESDIR}"/${PN}-prefix.patch
        "${FILESDIR}"/${PN}-respect-cflags-3.patch
+       "${FILESDIR}"/${P}-ipv6-configure-c99.patch
+       "${FILESDIR}"/${P}-mpd-stream-http-adjust_pollset.patch
 )
 
 src_prepare() {
@@ -344,7 +347,8 @@ multilib_src_test() {
        # this ends up breaking when nproc is huge (like -j80).
        # The network sandbox causes tests 241 and 1083 to fail; these are 
typically skipped
        # as most gentoo users don't have an 'ip6-localhost'
-       multilib_is_native_abi && emake test TFLAGS="-n -v -a -k -am -p 
-j$((2*$(makeopts_jobs))) !241 !1083"
+       # Required deps for 1477 are not included in the release tarball for 
8.5.0
+       multilib_is_native_abi && emake test TFLAGS="-n -v -a -k -am -p 
-j$((2*$(makeopts_jobs))) !241 !1083 !1477"
 }
 
 multilib_src_install() {

diff --git a/net-misc/curl/curl-9999.ebuild b/net-misc/curl/curl-9999.ebuild
index 7d87477bc1f1..e390e3ae71bb 100644
--- a/net-misc/curl/curl-9999.ebuild
+++ b/net-misc/curl/curl-9999.ebuild
@@ -1,4 +1,4 @@
-# Copyright 1999-2023 Gentoo Authors
+# Copyright 1999-2024 Gentoo Authors
 # Distributed under the terms of the GNU General Public License v2
 
 EAPI=8
@@ -123,11 +123,14 @@ QA_CONFIG_IMPL_DECL_SKIP=(
        IoctlSocket
        mach_absolute_time
        setmode
+       _fseeki64
 )
 
 PATCHES=(
        "${FILESDIR}"/${PN}-prefix.patch
        "${FILESDIR}"/${PN}-respect-cflags-3.patch
+       "${FILESDIR}"/${P}-ipv6-configure-c99.patch
+       "${FILESDIR}"/${P}-mpd-stream-http-adjust_pollset.patch
 )
 
 src_prepare() {

diff --git 
a/net-misc/curl/files/curl-8.5.0-mpd-stream-http-adjust_pollset.patch 
b/net-misc/curl/files/curl-8.5.0-mpd-stream-http-adjust_pollset.patch
new file mode 100644
index 000000000000..79a16a2cc7b4
--- /dev/null
+++ b/net-misc/curl/files/curl-8.5.0-mpd-stream-http-adjust_pollset.patch
@@ -0,0 +1,69 @@
+https://github.com/MusicPlayerDaemon/MPD/issues/1952
+https://github.com/curl/curl/issues/12632
+https://github.com/curl/curl/commit/8e2d7b9fa4264b94bd1d9838c84d16e4cd33fbea
+
+From 8e2d7b9fa4264b94bd1d9838c84d16e4cd33fbea Mon Sep 17 00:00:00 2001
+From: Stefan Eissing <[email protected]>
+Date: Thu, 4 Jan 2024 10:06:17 +0100
+Subject: [PATCH] http: adjust_pollset fix
+
+do not add a socket for POLLIN when the transfer does not want to send
+(for example is paused).
+
+Follow-up to 47f5b1a
+
+Reported-by: bubbleguuum on github
+Fixes #12632
+Closes #12633
+--- a/lib/cf-socket.c
++++ b/lib/cf-socket.c
+@@ -1243,7 +1243,7 @@ static void cf_socket_adjust_pollset(struct Curl_cfilter 
*cf,
+   if(ctx->sock != CURL_SOCKET_BAD) {
+     if(!cf->connected)
+       Curl_pollset_set_out_only(data, ps, ctx->sock);
+-    else
++    else if(CURL_WANT_RECV(data))
+       Curl_pollset_add_in(data, ps, ctx->sock);
+     CURL_TRC_CF(data, cf, "adjust_pollset -> %d socks", ps->num);
+   }
+--- a/lib/http2.c
++++ b/lib/http2.c
+@@ -2341,8 +2341,8 @@ static void cf_h2_adjust_pollset(struct Curl_cfilter *cf,
+     bool c_exhaust, s_exhaust;
+ 
+     CF_DATA_SAVE(save, cf, data);
+-    c_exhaust = !nghttp2_session_get_remote_window_size(ctx->h2);
+-    s_exhaust = stream && stream->id >= 0 &&
++    c_exhaust = want_send && !nghttp2_session_get_remote_window_size(ctx->h2);
++    s_exhaust = want_send && stream && stream->id >= 0 &&
+                 !nghttp2_session_get_stream_remote_window_size(ctx->h2,
+                                                                stream->id);
+     want_recv = (want_recv || c_exhaust || s_exhaust);
+--- a/lib/vquic/curl_ngtcp2.c
++++ b/lib/vquic/curl_ngtcp2.c
+@@ -1166,9 +1166,10 @@ static void cf_ngtcp2_adjust_pollset(struct 
Curl_cfilter *cf,
+     bool c_exhaust, s_exhaust;
+ 
+     CF_DATA_SAVE(save, cf, data);
+-    c_exhaust = !ngtcp2_conn_get_cwnd_left(ctx->qconn) ||
+-                !ngtcp2_conn_get_max_data_left(ctx->qconn);
+-    s_exhaust = stream && stream->id >= 0 && stream->quic_flow_blocked;
++    c_exhaust = want_send && (!ngtcp2_conn_get_cwnd_left(ctx->qconn) ||
++                !ngtcp2_conn_get_max_data_left(ctx->qconn));
++    s_exhaust = want_send && stream && stream->id >= 0 &&
++                stream->quic_flow_blocked;
+     want_recv = (want_recv || c_exhaust || s_exhaust);
+     want_send = (!s_exhaust && want_send) ||
+                  !Curl_bufq_is_empty(&ctx->q.sendbuf);
+--- a/lib/vquic/curl_quiche.c
++++ b/lib/vquic/curl_quiche.c
+@@ -1189,7 +1189,7 @@ static void cf_quiche_adjust_pollset(struct Curl_cfilter 
*cf,
+ 
+     c_exhaust = FALSE; /* Have not found any call in quiche that tells
+                           us if the connection itself is blocked */
+-    s_exhaust = stream && stream->id >= 0 &&
++    s_exhaust = want_send && stream && stream->id >= 0 &&
+                 (stream->quic_flow_blocked || !stream_is_writeable(cf, data));
+     want_recv = (want_recv || c_exhaust || s_exhaust);
+     want_send = (!s_exhaust && want_send) ||
+

Reply via email to