diff --git a/SOURCES/0001-rest-proxy-auth-Add-rest_proxy_auth_cancel-for-cance.patch b/SOURCES/0001-rest-proxy-auth-Add-rest_proxy_auth_cancel-for-cance.patch new file mode 100644 index 0000000..463d6ed --- /dev/null +++ b/SOURCES/0001-rest-proxy-auth-Add-rest_proxy_auth_cancel-for-cance.patch @@ -0,0 +1,56 @@ +From 18cf9a2090bb846c92d19d416cd56080eb20f7bd Mon Sep 17 00:00:00 2001 +From: Pavel Grunt +Date: Fri, 20 Mar 2015 16:22:11 +0100 +Subject: [PATCH] rest-proxy-auth: Add rest_proxy_auth_cancel for cancelling + authentication + +It can be helpful when handling the "authenticate" signal to allow +to cancel the authentication instead of failing with an error. +--- + rest/rest-proxy-auth.c | 17 +++++++++++++++++ + rest/rest-proxy-auth.h | 1 + + 2 files changed, 18 insertions(+) + +diff --git a/rest/rest-proxy-auth.c b/rest/rest-proxy-auth.c +index 0cb6d7c77695..79f21e0101aa 100644 +--- a/rest/rest-proxy-auth.c ++++ b/rest/rest-proxy-auth.c +@@ -135,6 +135,23 @@ rest_proxy_auth_unpause (RestProxyAuth *auth) + auth->priv->paused = FALSE; + } + ++/** ++ * rest_proxy_auth_cancel: ++ * @auth: a #RestProxyAuth ++ * ++ * Cancel the authentication process ++ * by cancelling the associated #SoupMessage. ++ * It results in returning #GError REST_PROXY_ERROR_CANCELLED ++ * to the function that requested the authentication. ++ */ ++void ++rest_proxy_auth_cancel (RestProxyAuth *auth) ++{ ++ g_return_if_fail (REST_IS_PROXY_AUTH (auth)); ++ ++ soup_session_cancel_message (auth->priv->session, auth->priv->message, SOUP_STATUS_CANCELLED); ++} ++ + G_GNUC_INTERNAL gboolean rest_proxy_auth_is_paused (RestProxyAuth *auth) + { + g_return_val_if_fail (REST_IS_PROXY_AUTH (auth), FALSE); +diff --git a/rest/rest-proxy-auth.h b/rest/rest-proxy-auth.h +index 6358e1a16b35..816aaa9007b7 100644 +--- a/rest/rest-proxy-auth.h ++++ b/rest/rest-proxy-auth.h +@@ -66,6 +66,7 @@ GType rest_proxy_auth_get_type (void); + + void rest_proxy_auth_pause (RestProxyAuth *auth); + void rest_proxy_auth_unpause (RestProxyAuth *auth); ++void rest_proxy_auth_cancel (RestProxyAuth *auth); + + G_END_DECLS + +-- +2.5.0 + diff --git a/SOURCES/0001-tests-Avoid-race-condition-in-threaded-tests.patch b/SOURCES/0001-tests-Avoid-race-condition-in-threaded-tests.patch new file mode 100644 index 0000000..f6e0aed --- /dev/null +++ b/SOURCES/0001-tests-Avoid-race-condition-in-threaded-tests.patch @@ -0,0 +1,54 @@ +From 08f1fc35e3c77aecedacf08aa510e82c91ac7f2a Mon Sep 17 00:00:00 2001 +From: Christophe Fergeau +Date: Tue, 17 Mar 2015 15:53:36 +0100 +Subject: [PATCH] tests: Avoid race condition in threaded tests + +Calling soup_server_run in a new thread, and calling +soup_server_get_port() on the same SoupServer instance +right after creating the thread. +With recent libsoup, this sometimes causes a crash when the 2 threads +try to call soup_server_ensure_listening() at the same time. +Moving the call to soup_server_get_port() before the thread creation +avoids this race condition. +--- + tests/custom-serialize.c | 4 ++-- + tests/threaded.c | 4 ++-- + 2 files changed, 4 insertions(+), 4 deletions(-) + +diff --git a/tests/custom-serialize.c b/tests/custom-serialize.c +index f683941d297a..c4ca5413cad1 100644 +--- a/tests/custom-serialize.c ++++ b/tests/custom-serialize.c +@@ -123,10 +123,10 @@ main (int argc, char **argv) + + server = soup_server_new (NULL); + soup_server_add_handler (server, NULL, server_callback, NULL, NULL); +- g_thread_create ((GThreadFunc)soup_server_run, server, FALSE, NULL); +- + url = g_strdup_printf ("http://127.0.0.1:%d/", soup_server_get_port (server)); + ++ g_thread_create ((GThreadFunc)soup_server_run, server, FALSE, NULL); ++ + proxy = rest_proxy_new (url, FALSE); + call = g_object_new (REST_TYPE_CUSTOM_PROXY_CALL, "proxy", proxy, NULL); + +diff --git a/tests/threaded.c b/tests/threaded.c +index ecb074fd76c7..abb11e7a42d3 100644 +--- a/tests/threaded.c ++++ b/tests/threaded.c +@@ -90,10 +90,10 @@ main (int argc, char **argv) + + server = soup_server_new (NULL); + soup_server_add_handler (server, NULL, server_callback, NULL, NULL); +- g_thread_create ((GThreadFunc)soup_server_run, server, FALSE, NULL); +- + url = g_strdup_printf ("http://127.0.0.1:%d/", soup_server_get_port (server)); + ++ g_thread_create ((GThreadFunc)soup_server_run, server, FALSE, NULL); ++ + for (i = 0; i < G_N_ELEMENTS (threads); i++) { + threads[i] = g_thread_create (func, url, TRUE, NULL); + if (verbose) +-- +2.5.0 + diff --git a/SPECS/rest.spec b/SPECS/rest.spec index 84709be..80fafbf 100644 --- a/SPECS/rest.spec +++ b/SPECS/rest.spec @@ -1,6 +1,6 @@ Name: rest Version: 0.7.92 -Release: 3%{?dist} +Release: 5%{?dist} Summary: A library for access to RESTful web services Group: System Environment/Libraries @@ -10,6 +10,10 @@ Source0: http://download.gnome.org/sources/%{name}/0.7/%{name}-%{version}. Patch0: rest-fixdso.patch Patch1: 0001-oauth-Add-missing-include.patch Patch2: 0001-tests-proxy-continuous-Server-chunks-can-be-differen.patch +# https://bugzilla.redhat.com/show_bug.cgi?id=1271197 +Patch3: 0001-tests-Avoid-race-condition-in-threaded-tests.patch +# https://bugzilla.redhat.com/show_bug.cgi?id=1331101 +Patch4: 0001-rest-proxy-auth-Add-rest_proxy_auth_cancel-for-cance.patch BuildRequires: glib2-devel BuildRequires: gobject-introspection-devel @@ -43,6 +47,8 @@ Files for development with %{name}. %patch0 -p1 -b .fixdso %patch1 -p1 -b .missinginclude %patch2 -p1 -b .proxycontinuous +%patch3 -p1 -b .threadedtests +%patch4 -p1 -b .cancellingauth %build autoreconf -vif @@ -81,6 +87,14 @@ find %{buildroot} -name '*.la' -exec rm -f {} ';' %{_datadir}/gir-1.0/RestExtras-0.7.gir %changelog +* Mon May 02 2016 Debarshi Ray - 0.7.92-5 +- Add rest_proxy_auth_cancel for cancelling authentication +Resolves: #1331101 + +* Mon May 02 2016 Debarshi Ray - 0.7.92-4 +- Fix tests/custom-serialize and tests/threaded +Resolves: #1271197 + * Thu Sep 17 2015 Debarshi Ray - 0.7.92-3 - Fix tests/proxy-continuous Resolves: #1250935