From 6f795dd4c4d3d1aa73b1b3051781dd55d989216a Mon Sep 17 00:00:00 2001 From: Renbo Date: Tue, 5 Dec 2023 17:18:16 +0800 Subject: [PATCH 1/2] update to libsoup-2.62.3-4 Signed-off-by: Renbo --- ...-the-input-source-when-IO-is-closing.patch | 84 +++++++++++++++++++ libsoup.spec | 23 ++--- 2 files changed, 89 insertions(+), 18 deletions(-) create mode 100644 0005-WebSockets-do-not-start-the-input-source-when-IO-is-closing.patch diff --git a/0005-WebSockets-do-not-start-the-input-source-when-IO-is-closing.patch b/0005-WebSockets-do-not-start-the-input-source-when-IO-is-closing.patch new file mode 100644 index 0000000..998dee8 --- /dev/null +++ b/0005-WebSockets-do-not-start-the-input-source-when-IO-is-closing.patch @@ -0,0 +1,84 @@ +From 87e8c2ab9f3bc79befb0e3b25ec513cfd36fefe9 Mon Sep 17 00:00:00 2001 +From: Carlos Garcia Campos +Date: Tue, 21 Jan 2020 11:41:37 +0100 +Subject: [PATCH] WebSockets: do not start the input source when IO is closing + +We should not schedule a new read after reading the close message, since +we don't expect more input. This fixes a crash due to an assert that +checks that the input source is NULL when the connection is destroyed +that happens when the connection is destroyed in the closed callback. + +Fixes #181 +--- + libsoup/soup-websocket-connection.c | 3 ++- + tests/websocket-test.c | 33 +++++++++++++++++++++++++++++ + 2 files changed, 35 insertions(+), 1 deletion(-) + +diff --git a/libsoup/soup-websocket-connection.c b/libsoup/soup-websocket-connection.c +index 2c7fc1161..a4095e1c9 100644 +--- a/libsoup/soup-websocket-connection.c ++++ b/libsoup/soup-websocket-connection.c +@@ -1156,7 +1156,8 @@ soup_websocket_connection_read (SoupWebsocketConnection *self) + return; + } + +- soup_websocket_connection_start_input_source (self); ++ if (!pv->io_closing) ++ soup_websocket_connection_start_input_source (self); + } + + static gboolean +diff --git a/tests/websocket-test.c b/tests/websocket-test.c +index b5142612e..5e40cf364 100644 +--- a/tests/websocket-test.c ++++ b/tests/websocket-test.c +@@ -1067,6 +1067,34 @@ test_close_after_close (Test *test, + g_io_stream_close (test->raw_server, NULL, NULL); + } + ++static gboolean ++on_close_unref_connection (SoupWebsocketConnection *ws, ++ gpointer user_data) ++{ ++ Test *test = user_data; ++ ++ g_assert_true (test->server == ws); ++ g_clear_object (&test->server); ++ return TRUE; ++} ++ ++static void ++test_server_unref_connection_on_close (Test *test, ++ gconstpointer data) ++{ ++ gboolean close_event_client = FALSE; ++ ++ g_signal_connect (test->client, "closed", G_CALLBACK (on_close_set_flag), &close_event_client); ++ g_signal_connect (test->server, "closed", G_CALLBACK (on_close_unref_connection), test); ++ soup_websocket_connection_close (test->client, SOUP_WEBSOCKET_CLOSE_GOING_AWAY, "client closed"); ++ g_assert_cmpint (soup_websocket_connection_get_state (test->client), ==, SOUP_WEBSOCKET_STATE_CLOSING); ++ ++ WAIT_UNTIL (test->server == NULL); ++ WAIT_UNTIL (soup_websocket_connection_get_state (test->client) == SOUP_WEBSOCKET_STATE_CLOSED); ++ ++ g_assert_true (close_event_client); ++} ++ + static gpointer + timeout_server_thread (gpointer user_data) + { +@@ -1923,6 +1951,11 @@ main (int argc, + test_close_after_close, + teardown_direct_connection); + ++ g_test_add ("/websocket/soup/server-unref-connection-on-close", Test, NULL, ++ setup_soup_connection, ++ test_server_unref_connection_on_close, ++ teardown_soup_connection); ++ + + g_test_add ("/websocket/direct/protocol-negotiate", Test, NULL, NULL, + test_protocol_negotiate_direct, +-- +GitLab + diff --git a/libsoup.spec b/libsoup.spec index f19577d..c557b40 100644 --- a/libsoup.spec +++ b/libsoup.spec @@ -1,9 +1,8 @@ -%define anolis_release .0.1 %define glib2_version 2.38.0 Name: libsoup Version: 2.62.3 -Release: 3%{anolis_release}%{?dist} +Release: 4%{?dist} Summary: Soup, an HTTP library implementation License: LGPLv2 @@ -14,6 +13,7 @@ Patch0001: 0001-WebSockets-ignore-any-messages-after-close-has-been-.patch Patch0002: 0002-WebSockets-allow-null-characters-in-text-messages-da.patch Patch0003: 0003-WebSockets-only-poll-IO-stream-when-needed.patch Patch0004: 0004-ntlmv2.patch +Patch0005: 0005-WebSockets-do-not-start-the-input-source-when-IO-is-closing.patch BuildRequires: chrpath BuildRequires: glib2-devel >= %{glib2_version} @@ -29,9 +29,6 @@ BuildRequires: vala Requires: glib2%{?_isa} >= %{glib2_version} Requires: glib-networking%{?_isa} >= %{glib2_version} -Requires: glibc -Requires: libxml2 - %description Libsoup is an HTTP library implementation in C. It was originally part of a SOAP (Simple Object Access Protocol) implementation called Soup, but @@ -51,14 +48,6 @@ Requires: %{name}%{?_isa} = %{version}-%{release} Libsoup is an HTTP library implementation in C. This package allows you to develop applications that use the libsoup library. -%package doc -Summary: Documents for %{name} -BuildArch: noarch -Requires: %{name} = %{version}-%{release} - -%description doc -Doc pages for %{name}. - %prep %autosetup -p1 @@ -82,6 +71,7 @@ chrpath --delete $RPM_BUILD_ROOT%{_libdir}/*.so %files -f libsoup.lang %license COPYING +%doc README NEWS AUTHORS %{_libdir}/lib*.so.* %{_libdir}/girepository-1.0/Soup*2.4.typelib @@ -97,12 +87,9 @@ chrpath --delete $RPM_BUILD_ROOT%{_libdir}/*.so %{_datadir}/vala/vapi/libsoup-2.4.deps %{_datadir}/vala/vapi/libsoup-2.4.vapi -%files doc -%doc README NEWS AUTHORS - %changelog -* Tue Jul 04 2023 Weisson - 2.62.3-3.0.1 -- Add doc sub package +* Mon May 15 2023 Milan Crha - 2.62.3-4 +- Resolves: #2203398 (WebSocket server asserts when a client is closing the connection) * Fri Sep 16 2022 Milan Crha - 2.62.3-3 - Resolves: #1938011 (Support for NTLMv2 Authentication) -- Gitee From 406c992a8b2fad0c139c2bfa5c4c82d26f5acc71 Mon Sep 17 00:00:00 2001 From: Weisson Date: Mon, 18 Jul 2022 10:59:52 +0800 Subject: [PATCH 2/2] spec: add doc sub package Signed-off-by: Weisson --- libsoup.spec | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/libsoup.spec b/libsoup.spec index c557b40..42520db 100644 --- a/libsoup.spec +++ b/libsoup.spec @@ -1,8 +1,9 @@ +%define anolis_release .0.1 %define glib2_version 2.38.0 Name: libsoup Version: 2.62.3 -Release: 4%{?dist} +Release: 4%{anolis_release}%{?dist} Summary: Soup, an HTTP library implementation License: LGPLv2 @@ -29,6 +30,9 @@ BuildRequires: vala Requires: glib2%{?_isa} >= %{glib2_version} Requires: glib-networking%{?_isa} >= %{glib2_version} +Requires: glibc +Requires: libxml2 + %description Libsoup is an HTTP library implementation in C. It was originally part of a SOAP (Simple Object Access Protocol) implementation called Soup, but @@ -48,6 +52,14 @@ Requires: %{name}%{?_isa} = %{version}-%{release} Libsoup is an HTTP library implementation in C. This package allows you to develop applications that use the libsoup library. +%package doc +Summary: Documents for %{name} +BuildArch: noarch +Requires: %{name} = %{version}-%{release} + +%description doc +Doc pages for %{name}. + %prep %autosetup -p1 @@ -71,7 +83,6 @@ chrpath --delete $RPM_BUILD_ROOT%{_libdir}/*.so %files -f libsoup.lang %license COPYING -%doc README NEWS AUTHORS %{_libdir}/lib*.so.* %{_libdir}/girepository-1.0/Soup*2.4.typelib @@ -87,7 +98,13 @@ chrpath --delete $RPM_BUILD_ROOT%{_libdir}/*.so %{_datadir}/vala/vapi/libsoup-2.4.deps %{_datadir}/vala/vapi/libsoup-2.4.vapi +%files doc +%doc README NEWS AUTHORS + %changelog +* Wed Dec 06 2023 Weisson - 2.62.3-4.0.1 +- Add doc sub package + * Mon May 15 2023 Milan Crha - 2.62.3-4 - Resolves: #2203398 (WebSocket server asserts when a client is closing the connection) -- Gitee