diff options
Diffstat (limited to 'meta-openembedded/meta-gnome/recipes-gnome')
18 files changed, 3200 insertions, 270 deletions
diff --git a/meta-openembedded/meta-gnome/recipes-gnome/devilspie/devilspie2_0.43.bb b/meta-openembedded/meta-gnome/recipes-gnome/devilspie/devilspie2_0.43.bb index 69c23d562a..f48f04f9da 100644 --- a/meta-openembedded/meta-gnome/recipes-gnome/devilspie/devilspie2_0.43.bb +++ b/meta-openembedded/meta-gnome/recipes-gnome/devilspie/devilspie2_0.43.bb @@ -4,15 +4,18 @@ LICENSE = "GPLv3" LIC_FILES_CHKSUM = "file://COPYING;md5=00aefaa50aad75c21367df66102d542c \ file://GPL3.txt;md5=d32239bcb673463ab874e80d47fae504" -DEPENDS = "gtk+ glib-2.0 libwnck lua virtual/libx11" +DEPENDS = "gtk+ glib-2.0 libwnck libxinerama lua virtual/libx11" -SRC_URI = " \ - http://download.savannah.gnu.org/releases/${BPN}/${BPN}_${PV}-src.tar.gz \ +PV .= "+git${SRCPV}" + +SRCREV = "a3ee65b815a0247a0dbdaa39353444cef6f93499" + +SRC_URI = "git://github.com/dsalt/devilspie2;branch=master \ file://default.lua \ file://devilspie2.desktop \ " -SRC_URI[md5sum] = "26eed0b5b4af5c7e13c551eceaeab832" -SRC_URI[sha256sum] = "ecffc17c62b41e196b72340192a90c4223329df041f135e74c0990860595f828" + +S = "${WORKDIR}/git" inherit features_check pkgconfig gettext diff --git a/meta-openembedded/meta-gnome/recipes-gnome/gfbgraph/gfbgraph/0001-Update-rest-requirement-to-rest-1.0.patch b/meta-openembedded/meta-gnome/recipes-gnome/gfbgraph/gfbgraph/0001-Update-rest-requirement-to-rest-1.0.patch new file mode 100644 index 0000000000..c24a9e569f --- /dev/null +++ b/meta-openembedded/meta-gnome/recipes-gnome/gfbgraph/gfbgraph/0001-Update-rest-requirement-to-rest-1.0.patch @@ -0,0 +1,72 @@ +From d058e6eb6c9ebf5f4fff89ec0ac93323fc64c1ba Mon Sep 17 00:00:00 2001 +From: Tim Orling <ticotimo@gmail.com> +Date: Mon, 18 Oct 2021 08:42:35 -0700 +Subject: [PATCH] Update rest requirement to rest-1.0 + +librest 0.8.1 declares rest-1.0 and was released four years ago. + +https://gitlab.gnome.org/GNOME/librest/-/commit/2971b3b92701f70fc368ad64bd25cefaea043f87 + +Upstream-Status: Submitted +[https://gitlab.gnome.org/GNOME/libgfbgraph/-/merge_requests/6] + +Signed-off-by: Tim Orling <ticotimo@gmail.com> + +--- + .dir-locals.el | 2 +- + configure.ac | 2 +- + gfbgraph/Makefile.am | 2 +- + libgfbgraph.pc.in | 2 +- + 4 files changed, 4 insertions(+), 4 deletions(-) + +diff --git a/.dir-locals.el b/.dir-locals.el +index 77abbf0..d39cdf2 100644 +--- a/.dir-locals.el ++++ b/.dir-locals.el +@@ -3,7 +3,7 @@ + "/usr/include/json-glib-1.0" + "/usr/include/goa-1.0" + "/usr/lib64/goa-1.0/include" +- "/usr/include/rest-0.7" ++ "/usr/include/rest-1.0" + "/usr/include/dbus-1.0" + "/usr/lib64/dbus-1.0/include" + "/usr/include/gio-unix-2.0/" +diff --git a/configure.ac b/configure.ac +index fd1231f..9b49f3f 100644 +--- a/configure.ac ++++ b/configure.ac +@@ -40,7 +40,7 @@ AM_CONDITIONAL([ENABLE_GTK_DOC], false) + + GOBJECT_INTROSPECTION_CHECK([1.30.0]) + +-PKG_CHECK_MODULES(LIBGFBGRAPH, [glib-2.0 gio-2.0 gobject-2.0 rest-0.7 json-glib-1.0]) ++PKG_CHECK_MODULES(LIBGFBGRAPH, [glib-2.0 gio-2.0 gobject-2.0 rest-1.0 json-glib-1.0]) + + PKG_CHECK_MODULES(SOUP, [libsoup-2.4]) + SOUP_UNSTABLE_CPPFLAGS=-DLIBSOUP_USE_UNSTABLE_REQUEST_API +diff --git a/gfbgraph/Makefile.am b/gfbgraph/Makefile.am +index d07b90d..b993ab7 100644 +--- a/gfbgraph/Makefile.am ++++ b/gfbgraph/Makefile.am +@@ -60,7 +60,7 @@ GFBGraph_@API_MAJOR@_@API_MINOR@_gir_INCLUDES = \ + GLib-2.0 \ + Gio-2.0 \ + GObject-2.0 \ +- Rest-0.7 \ ++ Rest-1.0 \ + Json-1.0 \ + Soup-2.4 + +diff --git a/libgfbgraph.pc.in b/libgfbgraph.pc.in +index f87073e..d4f4e3a 100644 +--- a/libgfbgraph.pc.in ++++ b/libgfbgraph.pc.in +@@ -9,6 +9,6 @@ apiversion=@API_VERSION@ + Name: libgfbgraph + Description: GObject library for Facebook Graph API + Version: @VERSION@ +-Requires: gio-2.0 glib-2.0 goa-1.0 json-glib-1.0 libsoup-2.4 rest-0.7 ++Requires: gio-2.0 glib-2.0 goa-1.0 json-glib-1.0 libsoup-2.4 rest-1.0 + Libs: -L${libdir} -lgfbgraph-${apiversion} + Cflags: -I${includedir}/gfbgraph-@API_VERSION@ diff --git a/meta-openembedded/meta-gnome/recipes-gnome/gfbgraph/gfbgraph_0.2.4.bb b/meta-openembedded/meta-gnome/recipes-gnome/gfbgraph/gfbgraph_0.2.4.bb index 1c5d90f6c7..23b3bf63a5 100644 --- a/meta-openembedded/meta-gnome/recipes-gnome/gfbgraph/gfbgraph_0.2.4.bb +++ b/meta-openembedded/meta-gnome/recipes-gnome/gfbgraph/gfbgraph_0.2.4.bb @@ -10,8 +10,9 @@ DEPENDS = " \ gnome-online-accounts \ " -inherit gnomebase gtk-doc gobject-introspection +inherit gnomebase gtk-doc gobject-introspection pkgconfig +SRC_URI += " file://0001-Update-rest-requirement-to-rest-1.0.patch" SRC_URI[archive.md5sum] = "c38af63e49f8fe8baad99537956b69ba" SRC_URI[archive.sha256sum] = "6065391f35e7335588cc6b0cc4c1abbce7341488573a654551264cb9793b9379" diff --git a/meta-openembedded/meta-gnome/recipes-gnome/gjs/gjs_1.58.8.bb b/meta-openembedded/meta-gnome/recipes-gnome/gjs/gjs_1.58.8.bb index ccac08d060..096e277bb4 100644 --- a/meta-openembedded/meta-gnome/recipes-gnome/gjs/gjs_1.58.8.bb +++ b/meta-openembedded/meta-gnome/recipes-gnome/gjs/gjs_1.58.8.bb @@ -9,7 +9,7 @@ GNOMEBASEBUILDCLASS = "autotools" DEPENDS = "mozjs gtk+3" -inherit gnomebase gsettings gobject-introspection vala gettext features_check upstream-version-is-even +inherit gnomebase gsettings gobject-introspection vala gettext features_check upstream-version-is-even pkgconfig SRC_URI[archive.sha256sum] = "7fb3eb746c17363d9ee47f4a5d0bb048f0075611763eb0da11d85e0e57aff381" SRC_URI += "file://0001-Disable-tests-on-host.patch \ diff --git a/meta-openembedded/meta-gnome/recipes-gnome/gnome-calendar/files/8be361b6ce8f0f8053e1609decbdbdc164ec8448.patch b/meta-openembedded/meta-gnome/recipes-gnome/gnome-calendar/files/8be361b6ce8f0f8053e1609decbdbdc164ec8448.patch deleted file mode 100644 index eabf61aa5f..0000000000 --- a/meta-openembedded/meta-gnome/recipes-gnome/gnome-calendar/files/8be361b6ce8f0f8053e1609decbdbdc164ec8448.patch +++ /dev/null @@ -1,242 +0,0 @@ -From 8be361b6ce8f0f8053e1609decbdbdc164ec8448 Mon Sep 17 00:00:00 2001 -From: Evangelos Ribeiro Tzaras <devrtz@fortysixandtwo.eu> -Date: Sat, 5 Sep 2020 02:06:34 +0200 -Subject: [PATCH] project: Switch to libhandy-1 - -This commit updates the dependencies for libhandy to the tagged 1.0 -release and changes the code to accomodate the changes from -libhandy-0 to libhandy-1. - -Notable changes: -edit-dialog: HdyDialog has been dropped in [1] -alarm-row: action child type in HdyActionRow has been removed. - -[1] https://gitlab.gnome.org/GNOME/libhandy/-/merge_requests/434 -Upstream-Status: Backport -Signed-off-by: Alexander Kanavin <alex.kanavin@gmail.com> ---- - build-aux/flatpak/org.gnome.Calendar.json | 4 ++-- - meson.build | 2 +- - src/gui/gcal-alarm-row.c | 2 +- - src/gui/gcal-alarm-row.ui | 2 +- - src/gui/gcal-application.c | 4 ++++ - src/gui/gcal-edit-dialog.c | 4 ++-- - src/gui/gcal-edit-dialog.h | 3 +-- - src/gui/gcal-edit-dialog.ui | 20 ++++++++++---------- - 8 files changed, 22 insertions(+), 19 deletions(-) - -diff --git a/build-aux/flatpak/org.gnome.Calendar.json b/build-aux/flatpak/org.gnome.Calendar.json -index 18893ad6..0772ca8d 100644 ---- a/build-aux/flatpak/org.gnome.Calendar.json -+++ b/build-aux/flatpak/org.gnome.Calendar.json -@@ -174,8 +174,8 @@ - "sources" : [ - { - "type" : "git", -- "url" : "https://source.puri.sm/Librem5/libhandy.git", -- "branch" : "libhandy-0-0" -+ "url" : "https://gitlab.gnome.org/GNOME/libhandy.git", -+ "tag" : "1.0.0" - } - ] - }, -diff --git a/meson.build b/meson.build -index 2a546252..b81b95c9 100644 ---- a/meson.build -+++ b/meson.build -@@ -165,7 +165,7 @@ libedataserver_dep = dependency('libedataserver-1.2', version: '>= 3.17.1') - libecal_dep = dependency('libecal-2.0', version: '>= 3.33.2') - libsoup_dep = dependency('libsoup-2.4') - libdazzle_dep = dependency('libdazzle-1.0', version: '>= 3.33.1') --libhandy_dep = dependency('libhandy-0.0', version: '>= 0.0.9') -+libhandy_dep = dependency('libhandy-1', version: '>= 1.0.0') - glib_dep = dependency('glib-2.0', version: '>= 2.58.0') - gtk_dep = dependency('gtk+-3.0', version: '>= 3.22.20') - gio_dep = dependency('gio-2.0', version: '>= 2.58.0') -diff --git a/src/gui/gcal-alarm-row.c b/src/gui/gcal-alarm-row.c -index 1f95426c..1ada82f4 100644 ---- a/src/gui/gcal-alarm-row.c -+++ b/src/gui/gcal-alarm-row.c -@@ -214,7 +214,7 @@ setup_alarm (GcalAlarmRow *self) - duration = e_cal_component_alarm_trigger_get_duration (trigger); - formatted_duration = format_alarm_duration (duration); - -- hdy_action_row_set_title (HDY_ACTION_ROW (self), formatted_duration); -+ hdy_preferences_row_set_title (HDY_PREFERENCES_ROW (self), formatted_duration); - - action = e_cal_component_alarm_get_action (self->alarm); - gtk_toggle_button_set_active (self->volume_button, action == E_CAL_COMPONENT_ALARM_AUDIO); -diff --git a/src/gui/gcal-alarm-row.ui b/src/gui/gcal-alarm-row.ui -index 7d416c4c..bca8af50 100644 ---- a/src/gui/gcal-alarm-row.ui -+++ b/src/gui/gcal-alarm-row.ui -@@ -3,7 +3,7 @@ - <template class="GcalAlarmRow" parent="HdyActionRow"> - <property name="visible">True</property> - <property name="can_focus">False</property> -- <child type="action"> -+ <child> - <object class="GtkBox"> - <property name="visible">True</property> - <property name="can_focus">False</property> -diff --git a/src/gui/gcal-application.c b/src/gui/gcal-application.c -index b9d46cec..591b95c8 100644 ---- a/src/gui/gcal-application.c -+++ b/src/gui/gcal-application.c -@@ -34,6 +34,7 @@ - #include <glib-object.h> - #include <gio/gio.h> - #include <glib/gi18n.h> -+#include <handy.h> - - struct _GcalApplication - { -@@ -446,6 +447,9 @@ gcal_application_startup (GApplication *app) - if ((g_application_get_flags (app) & G_APPLICATION_IS_SERVICE) != 0) - g_application_set_inactivity_timeout (app, 3 * 60 * 1000); - -+ /* initialize libhandy */ -+ hdy_init(); -+ - GCAL_EXIT; - } - -diff --git a/src/gui/gcal-edit-dialog.c b/src/gui/gcal-edit-dialog.c -index ae2b6714..5494a700 100644 ---- a/src/gui/gcal-edit-dialog.c -+++ b/src/gui/gcal-edit-dialog.c -@@ -47,7 +47,7 @@ - - struct _GcalEditDialog - { -- HdyDialog parent; -+ GtkDialog parent; - - gboolean writable; - -@@ -133,7 +133,7 @@ static void on_location_entry_changed_cb (GtkEntry - static void on_add_alarm_button_clicked_cb (GtkWidget *button, - GcalEditDialog *self); - --G_DEFINE_TYPE (GcalEditDialog, gcal_edit_dialog, HDY_TYPE_DIALOG) -+G_DEFINE_TYPE (GcalEditDialog, gcal_edit_dialog, GTK_TYPE_DIALOG) - - enum - { -diff --git a/src/gui/gcal-edit-dialog.h b/src/gui/gcal-edit-dialog.h -index e4f44ec5..a557916b 100644 ---- a/src/gui/gcal-edit-dialog.h -+++ b/src/gui/gcal-edit-dialog.h -@@ -22,7 +22,6 @@ - #include "gcal-event.h" - #include "gcal-manager.h" - --#include <handy.h> - - G_BEGIN_DECLS - -@@ -32,7 +31,7 @@ G_BEGIN_DECLS - - #define GCAL_TYPE_EDIT_DIALOG (gcal_edit_dialog_get_type ()) - --G_DECLARE_FINAL_TYPE (GcalEditDialog, gcal_edit_dialog, GCAL, EDIT_DIALOG, HdyDialog); -+G_DECLARE_FINAL_TYPE (GcalEditDialog, gcal_edit_dialog, GCAL, EDIT_DIALOG, GtkDialog); - - GtkWidget* gcal_edit_dialog_new (void); - -diff --git a/src/gui/gcal-edit-dialog.ui b/src/gui/gcal-edit-dialog.ui -index a36d8ae6..c28c22bb 100644 ---- a/src/gui/gcal-edit-dialog.ui -+++ b/src/gui/gcal-edit-dialog.ui -@@ -1,6 +1,6 @@ - <?xml version="1.0" encoding="UTF-8"?> - <interface> -- <template class="GcalEditDialog" parent="HdyDialog"> -+ <template class="GcalEditDialog" parent="GtkDialog"> - <property name="can_focus">False</property> - <property name="resizable">False</property> - <property name="modal">True</property> -@@ -156,7 +156,7 @@ - <property name="title" translatable="yes">Title</property> - <property name="activatable-widget">summary_entry</property> - -- <child type="action"> -+ <child> - <object class="GtkEntry" id="summary_entry"> - <property name="visible">True</property> - <property name="valign">center</property> -@@ -177,7 +177,7 @@ - <property name="title" translatable="yes">Location</property> - <property name="activatable-widget">location_entry</property> - -- <child type="action"> -+ <child> - <object class="GtkEntry" id="location_entry"> - <property name="visible">True</property> - <property name="valign">center</property> -@@ -226,7 +226,7 @@ - <property name="title" translatable="yes">All Day</property> - <property name="activatable-widget">all_day_switch</property> - -- <child type="action"> -+ <child> - <object class="GtkSwitch" id="all_day_switch"> - <property name="visible">True</property> - <property name="can_focus">True</property> -@@ -246,7 +246,7 @@ - <property name="visible">True</property> - <property name="title" translatable="yes">Starts</property> - -- <child type="action"> -+ <child> - <object class="GtkLabel" id="event_start_label"> - <property name="visible">True</property> - <property name="can_focus">False</property> -@@ -294,7 +294,7 @@ - <property name="visible">True</property> - <property name="title" translatable="yes">Ends</property> - -- <child type="action"> -+ <child> - <object class="GtkLabel" id="event_end_label"> - <property name="visible">True</property> - <property name="can_focus">False</property> -@@ -343,7 +343,7 @@ - <property name="title" translatable="yes">Repeat</property> - <property name="activatable-widget">repeat_combo</property> - -- <child type="action"> -+ <child> - <object class="GtkComboBoxText" id="repeat_combo"> - <property name="visible">True</property> - <property name="can_focus">False</property> -@@ -372,7 +372,7 @@ - <property name="title" translatable="yes">End Repeat</property> - <property name="activatable-widget">repeat_combo</property> - -- <child type="action"> -+ <child> - <object class="GtkComboBoxText" id="repeat_duration_combo"> - <property name="visible">True</property> - <property name="can_focus">False</property> -@@ -397,7 +397,7 @@ - <property name="title" translatable="yes">Number of Occurrences</property> - <property name="activatable-widget">number_of_occurrences_spin</property> - -- <child type="action"> -+ <child> - <object class = "GtkSpinButton" id="number_of_occurrences_spin"> - <property name="input_purpose">number</property> - <property name="input-hints">no-emoji</property> -@@ -415,7 +415,7 @@ - <property name="title" translatable="yes">End Repeat Date</property> - <property name="activatable-widget">until_date_selector</property> - -- <child type="action"> -+ <child> - <object class = "GcalDateSelector" id="until_date_selector"> - <property name="valign">center</property> - </object> --- -GitLab - diff --git a/meta-openembedded/meta-gnome/recipes-gnome/gnome-calendar/gnome-calendar_3.38.1.bb b/meta-openembedded/meta-gnome/recipes-gnome/gnome-calendar/gnome-calendar_41.0.bb index e703ec6406..4b9b14a480 100644 --- a/meta-openembedded/meta-gnome/recipes-gnome/gnome-calendar/gnome-calendar_3.38.1.bb +++ b/meta-openembedded/meta-gnome/recipes-gnome/gnome-calendar/gnome-calendar_41.0.bb @@ -18,12 +18,11 @@ DEPENDS = " \ GNOMEBASEBUILDCLASS = "meson" -inherit gnomebase gsettings gtk-icon-cache gettext features_check upstream-version-is-even +inherit gnomebase gsettings gtk-icon-cache gettext features_check upstream-version-is-even mime-xdg REQUIRED_DISTRO_FEATURES = "x11" -SRC_URI += "file://8be361b6ce8f0f8053e1609decbdbdc164ec8448.patch" -SRC_URI[archive.sha256sum] = "7280880a082d631624d02a102dd547ceb59498da368311f3e49a06cff897f512" +SRC_URI[archive.sha256sum] = "73ac923c6618bd0957d6b7c012a00a47bff67ee934249358817433772ceb193f" FILES:${PN} += " \ ${datadir}/gnome-shell \ diff --git a/meta-openembedded/meta-gnome/recipes-gnome/gnome-online-accounts/files/0001-Use-GUri-instead-of-SoupURI.patch b/meta-openembedded/meta-gnome/recipes-gnome/gnome-online-accounts/files/0001-Use-GUri-instead-of-SoupURI.patch new file mode 100644 index 0000000000..11fc96bc28 --- /dev/null +++ b/meta-openembedded/meta-gnome/recipes-gnome/gnome-online-accounts/files/0001-Use-GUri-instead-of-SoupURI.patch @@ -0,0 +1,351 @@ +From 5a5abbedb171986dbf6f5a37577ec6afa892b66b Mon Sep 17 00:00:00 2001 +From: Carlos Garcia Campos <cgarcia@igalia.com> +Date: Mon, 7 Jun 2021 16:31:18 +0200 +Subject: [PATCH 1/2] Use GUri instead of SoupURI + +In preparation for libsoup3 where SoupURI has been removed in favor of +GUri. + +Upstream-Status: Submitted [https://gitlab.gnome.org/GNOME/gnome-online-accounts/-/merge_requests/73] +Signed-off-by: Khem Raj <raj.khem@gmail.com> +--- + configure.ac | 2 +- + src/goabackend/goaoauth2provider.c | 11 +-- + src/goabackend/goaoauthprovider.c | 8 +- + src/goabackend/goaowncloudprovider.c | 107 ++++++++++++++++----------- + src/goabackend/goawebview.c | 9 +-- + 5 files changed, 80 insertions(+), 57 deletions(-) + +diff --git a/configure.ac b/configure.ac +index 1f88bbd..7c0b39d 100644 +--- a/configure.ac ++++ b/configure.ac +@@ -90,7 +90,7 @@ GTK_DOC_CHECK([1.3]) + # Libraries + # + +-PKG_CHECK_MODULES(GLIB, [glib-2.0 gio-2.0 gio-unix-2.0 >= 2.52]) ++PKG_CHECK_MODULES(GLIB, [glib-2.0 gio-2.0 gio-unix-2.0 >= 2.67.4]) + AC_SUBST(GLIB_CFLAGS) + AC_SUBST(GLIB_LIBS) + +diff --git a/src/goabackend/goaoauth2provider.c b/src/goabackend/goaoauth2provider.c +index 3715431..2757838 100644 +--- a/src/goabackend/goaoauth2provider.c ++++ b/src/goabackend/goaoauth2provider.c +@@ -763,7 +763,7 @@ on_web_view_decide_policy (WebKitWebView *web_view, + GHashTable *key_value_pairs; + WebKitNavigationAction *action; + WebKitURIRequest *request; +- SoupURI *uri; ++ GUri *uri; + const gchar *fragment; + const gchar *oauth2_error; + const gchar *query; +@@ -793,9 +793,9 @@ on_web_view_decide_policy (WebKitWebView *web_view, + if (!g_str_has_prefix (requested_uri, redirect_uri)) + goto default_behaviour; + +- uri = soup_uri_new (requested_uri); +- fragment = soup_uri_get_fragment (uri); +- query = soup_uri_get_query (uri); ++ uri = g_uri_parse (requested_uri, G_URI_FLAGS_ENCODED, NULL); ++ fragment = g_uri_get_fragment (uri); ++ query = g_uri_get_query (uri); + + /* Three cases: + * 1) we can either have the backend handle the URI for us, or +@@ -808,7 +808,7 @@ on_web_view_decide_policy (WebKitWebView *web_view, + { + gchar *url; + +- url = soup_uri_to_string (uri, FALSE); ++ url = g_uri_to_string (uri); + if (!goa_oauth2_provider_process_redirect_url (self, url, &priv->access_token, &priv->error)) + { + g_prefix_error (&priv->error, _("Authorization response: ")); +@@ -889,6 +889,7 @@ on_web_view_decide_policy (WebKitWebView *web_view, + goto ignore_request; + + ignore_request: ++ g_uri_unref (uri); + g_assert (response_id != GTK_RESPONSE_NONE); + if (response_id < 0) + gtk_dialog_response (priv->dialog, response_id); +diff --git a/src/goabackend/goaoauthprovider.c b/src/goabackend/goaoauthprovider.c +index 0bfab6b..ff0927e 100644 +--- a/src/goabackend/goaoauthprovider.c ++++ b/src/goabackend/goaoauthprovider.c +@@ -643,7 +643,7 @@ on_web_view_decide_policy (WebKitWebView *web_view, + { + GHashTable *key_value_pairs; + IdentifyData *data = user_data; +- SoupURI *uri; ++ GUri *uri; + WebKitNavigationAction *action; + WebKitURIRequest *request; + const gchar *query; +@@ -664,8 +664,8 @@ on_web_view_decide_policy (WebKitWebView *web_view, + if (!g_str_has_prefix (requested_uri, redirect_uri)) + goto default_behaviour; + +- uri = soup_uri_new (requested_uri); +- query = soup_uri_get_query (uri); ++ uri = g_uri_parse (requested_uri, G_URI_FLAGS_ENCODED, NULL); ++ query = g_uri_get_query (uri); + + if (query != NULL) + { +@@ -678,6 +678,8 @@ on_web_view_decide_policy (WebKitWebView *web_view, + g_hash_table_unref (key_value_pairs); + } + ++ g_uri_unref (uri); ++ + if (data->oauth_verifier != NULL) + goto ignore_request; + +diff --git a/src/goabackend/goaowncloudprovider.c b/src/goabackend/goaowncloudprovider.c +index d142966..10734be 100644 +--- a/src/goabackend/goaowncloudprovider.c ++++ b/src/goabackend/goaowncloudprovider.c +@@ -22,8 +22,6 @@ + + #include <glib/gi18n-lib.h> + +-#include <libsoup/soup.h> +- + #include "goahttpclient.h" + #include "goaprovider.h" + #include "goaowncloudprovider.h" +@@ -78,45 +76,42 @@ get_provider_features (GoaProvider *provider) + /* ---------------------------------------------------------------------------------------------------- */ + + static char * +-uri_to_string_with_path (SoupURI *soup_uri, const gchar *path) ++uri_to_string_with_path (GUri *uri, const gchar *path) + { + gchar *uri_string; + gchar *uri_tmp; + +- if (soup_uri == NULL) ++ if (uri == NULL) + return NULL; + +- uri_tmp = soup_uri_to_string (soup_uri, FALSE); ++ uri_tmp = g_uri_to_string (uri); + uri_string = g_strconcat (uri_tmp, path, NULL); + g_free (uri_tmp); + + return uri_string; + } + +-static char *get_webdav_uri (SoupURI *soup_uri) ++static char *get_webdav_uri (GUri *uri) + { +- SoupURI *uri_tmp; ++ GUri *uri_tmp; + gchar *uri_webdav; + const gchar *scheme; +- guint port; + +- if (soup_uri == NULL) ++ if (uri == NULL) + return NULL; + +- scheme = soup_uri_get_scheme (soup_uri); +- port = soup_uri_get_port (soup_uri); +- uri_tmp = soup_uri_copy (soup_uri); +- +- if (g_strcmp0 (scheme, SOUP_URI_SCHEME_HTTPS) == 0) +- soup_uri_set_scheme (uri_tmp, "davs"); +- else +- soup_uri_set_scheme (uri_tmp, "dav"); +- +- if (!soup_uri_uses_default_port (soup_uri)) +- soup_uri_set_port (uri_tmp, port); ++ scheme = g_uri_get_scheme (uri); ++ uri_tmp = g_uri_build (g_uri_get_flags (uri), ++ g_strcmp0 (scheme, "https") == 0 ? "davs" : "dav", ++ g_uri_get_userinfo (uri), ++ g_uri_get_host (uri), ++ g_uri_get_port (uri), ++ g_uri_get_path (uri), ++ g_uri_get_query (uri), ++ g_uri_get_fragment (uri)); + + uri_webdav = uri_to_string_with_path (uri_tmp, WEBDAV_ENDPOINT); +- soup_uri_free (uri_tmp); ++ g_uri_unref (uri_tmp); + + return uri_webdav; + } +@@ -140,7 +135,7 @@ build_object (GoaProvider *provider, + gchar *uri_carddav; + gchar *uri_webdav; + GoaPasswordBased *password_based = NULL; +- SoupURI *uri = NULL; ++ GUri *uri = NULL; + gboolean accept_ssl_errors; + gboolean calendar_enabled; + gboolean contacts_enabled; +@@ -176,9 +171,24 @@ build_object (GoaProvider *provider, + account = goa_object_get_account (GOA_OBJECT (object)); + identity = goa_account_get_identity (account); + uri_string = g_key_file_get_string (key_file, group, "Uri", NULL); +- uri = soup_uri_new (uri_string); ++ uri = g_uri_parse (uri_string, G_URI_FLAGS_ENCODED, NULL); + if (uri != NULL) +- soup_uri_set_user (uri, identity); ++ { ++ GUri *tmp_uri; ++ ++ tmp_uri = g_uri_build_with_user (g_uri_get_flags (uri), ++ g_uri_get_scheme (uri), ++ identity, ++ g_uri_get_password (uri), ++ g_uri_get_auth_params (uri), ++ g_uri_get_host (uri), ++ g_uri_get_port (uri), ++ g_uri_get_path (uri), ++ g_uri_get_query (uri), ++ g_uri_get_fragment (uri)); ++ g_uri_unref (uri); ++ uri = tmp_uri; ++ } + + accept_ssl_errors = g_key_file_get_boolean (key_file, group, "AcceptSslErrors", NULL); + +@@ -224,7 +234,7 @@ build_object (GoaProvider *provider, + + out: + g_clear_object (&password_based); +- g_clear_pointer (&uri, soup_uri_free); ++ g_clear_pointer (&uri, g_uri_unref); + g_free (uri_string); + return ret; + } +@@ -354,8 +364,11 @@ add_entry (GtkWidget *grid, + static gchar * + normalize_uri (const gchar *address, gchar **server) + { +- SoupURI *uri = NULL; ++ GUri *uri = NULL; ++ GUri *uri_tmp = NULL; + const gchar *path; ++ const gchar *new_scheme; ++ gchar *new_path = NULL; + gchar *ret = NULL; + gchar *scheme = NULL; + gchar *uri_string = NULL; +@@ -384,48 +397,56 @@ normalize_uri (const gchar *address, gchar **server) + else + goto out; + +- uri = soup_uri_new (uri_string); ++ uri = g_uri_parse (uri_string, G_URI_FLAGS_ENCODED, NULL); + if (uri == NULL) + goto out; + + if (g_strcmp0 (scheme, "dav") == 0) +- soup_uri_set_scheme (uri, SOUP_URI_SCHEME_HTTP); ++ new_scheme = "http"; + else if (g_strcmp0 (scheme, "davs") == 0) +- soup_uri_set_scheme (uri, SOUP_URI_SCHEME_HTTPS); ++ new_scheme = "https"; ++ else ++ new_scheme = g_uri_get_scheme (uri); + +- path = soup_uri_get_path (uri); ++ path = g_uri_get_path (uri); + if (!g_str_has_suffix (path, "/")) +- { +- gchar *new_path; +- + new_path = g_strconcat (path, "/", NULL); +- soup_uri_set_path (uri, new_path); +- path = soup_uri_get_path (uri); +- g_free (new_path); +- } ++ ++ uri_tmp = g_uri_build (g_uri_get_flags (uri), ++ new_scheme, ++ g_uri_get_userinfo (uri), ++ g_uri_get_host (uri), ++ g_uri_get_port (uri), ++ new_path ? new_path : path, ++ g_uri_get_query (uri), ++ g_uri_get_fragment (uri)); ++ g_free (new_path); ++ g_uri_unref (uri); ++ uri = uri_tmp; ++ path = g_uri_get_path (uri); + + if (server != NULL) + { + gchar *port_string; + gchar *pretty_path; +- guint port; ++ gint port; + +- port = soup_uri_get_port (uri); +- port_string = g_strdup_printf (":%u", port); ++ port = g_uri_get_port (uri); ++ port_string = g_strdup_printf (":%d", port); + + pretty_path = g_strdup (path); + pretty_path[strlen(pretty_path) - 1] = '\0'; + +- *server = g_strconcat (soup_uri_get_host (uri), (port == std_port) ? "" : port_string, pretty_path, NULL); ++ *server = g_strconcat (g_uri_get_host (uri), (port == std_port || port == -1) ? "" : port_string, pretty_path, NULL); + + g_free (port_string); + g_free (pretty_path); + } + +- ret = soup_uri_to_string (uri, FALSE); ++ ret = g_uri_to_string (uri); + + out: +- g_clear_pointer (&uri, soup_uri_free); ++ g_clear_pointer (&uri, g_uri_unref); + g_free (scheme); + g_free (uri_string); + return ret; +diff --git a/src/goabackend/goawebview.c b/src/goabackend/goawebview.c +index 2438e0c..3df600e 100644 +--- a/src/goabackend/goawebview.c ++++ b/src/goabackend/goawebview.c +@@ -25,7 +25,6 @@ + #include <glib.h> + #include <glib/gi18n-lib.h> + #include <jsc/jsc.h> +-#include <libsoup/soup.h> + #include <webkit2/webkit2.h> + + #include "goawebview.h" +@@ -77,17 +76,17 @@ web_view_clear_notify_progress_cb (gpointer user_data) + static char * + web_view_create_loading_title (const gchar *url) + { +- SoupURI *uri; ++ GUri *uri; + const gchar *hostname; + gchar *title; + + g_return_val_if_fail (url != NULL && url[0] != '\0', NULL); + +- uri = soup_uri_new (url); +- hostname = soup_uri_get_host (uri); ++ uri = g_uri_parse (url, G_URI_FLAGS_NONE, NULL); ++ hostname = g_uri_get_host (uri); + /* translators: %s here is the address of the web page */ + title = g_strdup_printf (_("Loading “%s”…"), hostname); +- soup_uri_free (uri); ++ g_uri_unref (uri); + + return title; + } +-- +2.33.1 + diff --git a/meta-openembedded/meta-gnome/recipes-gnome/gnome-online-accounts/files/0002-Port-to-libsoup3.patch b/meta-openembedded/meta-gnome/recipes-gnome/gnome-online-accounts/files/0002-Port-to-libsoup3.patch new file mode 100644 index 0000000000..0f959084a2 --- /dev/null +++ b/meta-openembedded/meta-gnome/recipes-gnome/gnome-online-accounts/files/0002-Port-to-libsoup3.patch @@ -0,0 +1,841 @@ +From 7d8c5208d095ce8e7123935263ef7a02f0381ae5 Mon Sep 17 00:00:00 2001 +From: Carlos Garcia Campos <cgarcia@igalia.com> +Date: Mon, 7 Jun 2021 18:28:42 +0200 +Subject: [PATCH 2/2] Port to libsoup3 + +Upstream-Status: Submitted [https://gitlab.gnome.org/GNOME/gnome-online-accounts/-/merge_requests/73] +Signed-off-by: Khem Raj <raj.khem@gmail.com> +--- + configure.ac | 8 +- + src/daemon/goadaemon.c | 2 +- + src/goabackend/goaewsclient.c | 178 +++++++++++++++-------------- + src/goabackend/goahttpclient.c | 72 +++++++----- + src/goabackend/goalastfmprovider.c | 24 ++-- + src/goabackend/goaoauth2provider.c | 6 +- + src/goabackend/goaoauthprovider.c | 23 ++-- + src/goabackend/goarestproxy.h | 2 - + src/goabackend/goasouplogger.c | 33 ++---- + src/goabackend/goasouplogger.h | 3 - + src/goabackend/goautils.c | 27 ++--- + 11 files changed, 199 insertions(+), 179 deletions(-) + +--- a/configure.ac ++++ b/configure.ac +@@ -113,15 +113,15 @@ if test "$enable_backend" != "no"; then + AC_SUBST(GTK_CFLAGS) + AC_SUBST(GTK_LIBS) + +- PKG_CHECK_MODULES(JAVASCRIPT_CORE_GTK, [javascriptcoregtk-4.0 >= 2.12.0]) ++ PKG_CHECK_MODULES(JAVASCRIPT_CORE_GTK, [javascriptcoregtk-4.1 >= 2.33.1]) + AC_SUBST(JAVASCRIPT_CORE_GTK_CFLAGS) + AC_SUBST(JAVASCRIPT_CORE_GTK_LIBS) + +- PKG_CHECK_MODULES(WEBKIT_GTK, [webkit2gtk-4.0 >= 2.26.0]) ++ PKG_CHECK_MODULES(WEBKIT_GTK, [webkit2gtk-4.1 >= 2.33.1]) + AC_SUBST(WEBKIT_GTK_CFLAGS) + AC_SUBST(WEBKIT_GTK_LIBS) + +- PKG_CHECK_MODULES(LIBSOUP, [libsoup-2.4 >= 2.42]) ++ PKG_CHECK_MODULES(LIBSOUP, [libsoup-3.0 >= 2.99.8]) + AC_SUBST(LIBSOUP_CFLAGS) + AC_SUBST(LIBSOUP_LIBS) + +@@ -129,7 +129,7 @@ if test "$enable_backend" != "no"; then + AC_SUBST(JSON_GLIB_CFLAGS) + AC_SUBST(JSON_GLIB_LIBS) + +- PKG_CHECK_MODULES(REST, [rest-0.7]) ++ PKG_CHECK_MODULES(REST, [rest-1.0]) + AC_SUBST(REST_CFLAGS) + AC_SUBST(REST_LIBS) + +--- a/src/daemon/goadaemon.c ++++ b/src/daemon/goadaemon.c +@@ -1496,7 +1496,7 @@ is_authorization_error (GError *error) + g_return_val_if_fail (error != NULL, FALSE); + + ret = FALSE; +- if (error->domain == REST_PROXY_ERROR || error->domain == SOUP_HTTP_ERROR) ++ if (error->domain == REST_PROXY_ERROR) + { + if (SOUP_STATUS_IS_CLIENT_ERROR (error->code)) + ret = TRUE; +--- a/src/goabackend/goaewsclient.c ++++ b/src/goabackend/goaewsclient.c +@@ -63,6 +63,12 @@ goa_ews_client_new (void) + + typedef struct + { ++ gchar *password; ++ gchar *username; ++} AutodiscoverAuthData; ++ ++typedef struct ++{ + GCancellable *cancellable; + GError *error; + SoupMessage *msgs[2]; +@@ -71,13 +77,16 @@ typedef struct + guint pending; + gulong cancellable_id; + xmlOutputBuffer *buf; ++ AutodiscoverAuthData *auth; + } AutodiscoverData; + +-typedef struct ++static void ++ews_client_autodiscover_auth_data_free (AutodiscoverAuthData *auth) + { +- gchar *password; +- gchar *username; +-} AutodiscoverAuthData; ++ g_free (auth->password); ++ g_free (auth->username); ++ g_slice_free (AutodiscoverAuthData, auth); ++} + + static void + ews_client_autodiscover_data_free (gpointer user_data) +@@ -92,22 +101,12 @@ ews_client_autodiscover_data_free (gpoin + + g_clear_error (&data->error); + +- /* soup_session_queue_message stole the references to data->msgs */ + xmlOutputBufferClose (data->buf); ++ g_clear_pointer (&data->auth, ews_client_autodiscover_auth_data_free); + g_object_unref (data->session); + g_slice_free (AutodiscoverData, data); + } + +-static void +-ews_client_autodiscover_auth_data_free (gpointer data, GClosure *closure) +-{ +- AutodiscoverAuthData *auth = data; +- +- g_free (auth->password); +- g_free (auth->username); +- g_slice_free (AutodiscoverAuthData, auth); +-} +- + static gboolean + ews_client_check_node (const xmlNode *node, const gchar *name) + { +@@ -115,9 +114,8 @@ ews_client_check_node (const xmlNode *no + return node->type == XML_ELEMENT_NODE && !g_strcmp0 ((gchar *) node->name, name); + } + +-static void +-ews_client_authenticate (SoupSession *session, +- SoupMessage *msg, ++static gboolean ++ews_client_authenticate (SoupMessage *msg, + SoupAuth *auth, + gboolean retrying, + gpointer user_data) +@@ -125,26 +123,26 @@ ews_client_authenticate (SoupSession *se + AutodiscoverAuthData *data = user_data; + + if (retrying) +- return; ++ return FALSE; + + soup_auth_authenticate (auth, data->username, data->password); ++ return TRUE; + } + +-static void +-ews_client_request_started (SoupSession *session, SoupMessage *msg, SoupSocket *socket, gpointer user_data) ++static gboolean ++ews_client_accept_certificate (SoupMessage *msg, GTlsCertificate *cert, GTlsCertificateFlags cert_flags, gpointer user_data) + { + AutodiscoverData *data; + GTask *task = G_TASK (user_data); +- GTlsCertificateFlags cert_flags; + +- g_debug ("goa_ews_client_autodiscover(): request started (%p)", msg); ++ g_debug ("goa_ews_client_autodiscover(): accept certificate for request (%p)", msg); + + data = (AutodiscoverData *) g_task_get_task_data (task); + +- if (!data->accept_ssl_errors +- && soup_message_get_https_status (msg, NULL, &cert_flags) +- && cert_flags != 0 +- && data->error == NULL) ++ if (data->accept_ssl_errors || cert_flags == 0) ++ return TRUE; ++ ++ if (data->error == NULL) + { + goa_utils_set_error_ssl (&data->error, cert_flags); + +@@ -153,6 +151,8 @@ ews_client_request_started (SoupSession + */ + soup_session_abort (data->session); + } ++ ++ return FALSE; + } + + static void +@@ -192,8 +192,10 @@ ews_client_autodiscover_parse_protocol ( + } + + static void +-ews_client_autodiscover_response_cb (SoupSession *session, SoupMessage *msg, gpointer user_data) ++ews_client_autodiscover_response_cb (SoupSession *session, GAsyncResult *result, gpointer user_data) + { ++ SoupMessage *msg; ++ GBytes *body; + GError *error = NULL; + AutodiscoverData *data; + GTask *task = G_TASK (user_data); +@@ -204,7 +206,11 @@ ews_client_autodiscover_response_cb (Sou + xmlDoc *doc; + xmlNode *node; + +- g_debug ("goa_ews_client_autodiscover(): response (%p, %u)", msg, msg->status_code); ++ msg = soup_session_get_async_result_message (session, result); ++ ++ g_debug ("goa_ews_client_autodiscover(): response (%p, %u)", msg, soup_message_get_status (msg)); ++ ++ body = soup_session_send_and_read_finish (session, result, &error); + + data = (AutodiscoverData *) g_task_get_task_data (task); + size = sizeof (data->msgs) / sizeof (data->msgs[0]); +@@ -215,16 +221,19 @@ ews_client_autodiscover_response_cb (Sou + break; + } + if (idx == size || data->pending == 0) +- return; ++ { ++ g_bytes_unref (body); ++ g_clear_object (&error); ++ g_object_unref (msg); ++ return; ++ } + + data->msgs[idx] = NULL; +- status = msg->status_code; +- +- /* status == SOUP_STATUS_CANCELLED, if we are being aborted by the ++ /* G_IO_ERROR_CANCELLED, if we are being aborted by the + * GCancellable, an SSL error or another message that was + * successful. + */ +- if (status == SOUP_STATUS_CANCELLED) ++ if (g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CANCELLED)) + { + /* If we are being aborted by the GCancellable, then the + * GTask is responsible for setting the GError automatically. +@@ -235,21 +244,23 @@ ews_client_autodiscover_response_cb (Sou + */ + goto out; + } +- else if (status != SOUP_STATUS_OK) ++ ++ status = soup_message_get_status (msg); ++ if (status != SOUP_STATUS_OK || error) + { +- g_warning ("goa_ews_client_autodiscover() failed: %u — %s", msg->status_code, msg->reason_phrase); ++ g_warning ("goa_ews_client_autodiscover() failed: %u — %s", status, soup_message_get_reason_phrase (msg)); + g_return_if_fail (data->error == NULL); + +- goa_utils_set_error_soup (&error, msg); ++ if (!error) ++ goa_utils_set_error_soup (&error, msg); + goto out; + } + +- soup_buffer_free (soup_message_body_flatten (SOUP_MESSAGE (msg)->response_body)); + g_debug ("The response headers"); + g_debug ("==================="); +- g_debug ("%s", SOUP_MESSAGE (msg)->response_body->data); ++ g_debug ("%s", (char *)g_bytes_get_data (body, NULL)); + +- doc = xmlReadMemory (msg->response_body->data, msg->response_body->length, "autodiscover.xml", NULL, 0); ++ doc = xmlReadMemory (g_bytes_get_data (body, NULL), g_bytes_get_size (body), "autodiscover.xml", NULL, 0); + if (doc == NULL) + { + g_set_error (&error, +@@ -333,7 +344,7 @@ ews_client_autodiscover_response_cb (Sou + /* The callback (ie. this function) will be invoked after we + * have returned to the main loop. + */ +- soup_session_cancel_message (data->session, data->msgs[idx], SOUP_STATUS_CANCELLED); ++ g_cancellable_cancel (data->cancellable); + } + } + +@@ -368,6 +379,7 @@ ews_client_autodiscover_response_cb (Sou + + g_clear_error (&error); + g_object_unref (task); ++ g_object_unref (msg); + } + + static xmlDoc * +@@ -399,52 +411,54 @@ static void + ews_client_post_restarted_cb (SoupMessage *msg, gpointer data) + { + xmlOutputBuffer *buf = data; ++ GBytes *body; + + /* In violation of RFC2616, libsoup will change a POST request to + * a GET on receiving a 302 redirect. + */ + g_debug ("Working around libsoup bug with redirect"); +- g_object_set (msg, SOUP_MESSAGE_METHOD, "POST", NULL); ++ g_object_set (msg, "method", "POST", NULL); + +- soup_message_set_request(msg, +- "text/xml; charset=utf-8", +- SOUP_MEMORY_COPY, + #ifdef LIBXML2_NEW_BUFFER +- (gchar *) xmlOutputBufferGetContent(buf), +- xmlOutputBufferGetSize(buf)); ++ body = g_bytes_new (xmlOutputBufferGetContent (buf), xmlOutputBufferGetSize (buf)); + #else +- (gchar *) buf->buffer->content, +- buf->buffer->use); ++ body = g_bytes_new (buf->buffer->content, buf->buffer->use); + #endif ++ soup_message_set_request_body_from_bytes (msg, "text/xml; charset=utf-8", body); ++ g_bytes_unref (body); + } + + static SoupMessage * +-ews_client_create_msg_for_url (const gchar *url, xmlOutputBuffer *buf) ++ews_client_create_msg_for_url (const gchar *url, xmlOutputBuffer *buf, AutodiscoverAuthData *auth, GTask *task) + { + SoupMessage *msg; ++ GBytes *body = NULL; + + msg = soup_message_new (buf != NULL ? "POST" : "GET", url); +- soup_message_headers_append (msg->request_headers, "User-Agent", "libews/0.1"); ++ soup_message_headers_append (soup_message_get_request_headers (msg), ++ "User-Agent", "libews/0.1"); ++ ++ g_signal_connect (msg, "authenticate", ++ G_CALLBACK (ews_client_authenticate), ++ auth); ++ g_signal_connect (msg, "accept-certificate", ++ G_CALLBACK (ews_client_accept_certificate), ++ task); + + if (buf != NULL) + { +- soup_message_set_request (msg, +- "text/xml; charset=utf-8", +- SOUP_MEMORY_COPY, + #ifdef LIBXML2_NEW_BUFFER +- (gchar *) xmlOutputBufferGetContent(buf), +- xmlOutputBufferGetSize(buf)); ++ body = g_bytes_new (xmlOutputBufferGetContent (buf), xmlOutputBufferGetSize (buf)); + #else +- (gchar *) buf->buffer->content, +- buf->buffer->use); ++ body = g_bytes_new (buf->buffer->content, buf->buffer->use); + #endif ++ soup_message_set_request_body_from_bytes (msg, "text/xml; charset=utf-8", body); + g_signal_connect (msg, "restarted", G_CALLBACK (ews_client_post_restarted_cb), buf); + } + +- soup_buffer_free (soup_message_body_flatten (SOUP_MESSAGE (msg)->request_body)); + g_debug ("The request headers"); + g_debug ("==================="); +- g_debug ("%s", SOUP_MESSAGE (msg)->request_body->data); ++ g_debug ("%s", body ? (char *)g_bytes_get_data (body, NULL) : ""); + + return msg; + } +@@ -497,12 +511,15 @@ goa_ews_client_autodiscover (GoaEwsClien + * (successful) one win. + */ + ++ auth = g_slice_new0 (AutodiscoverAuthData); ++ auth->username = g_strdup (username); ++ auth->password = g_strdup (password); ++ data->auth = auth; + data->buf = buf; +- data->msgs[0] = ews_client_create_msg_for_url (url1, buf); +- data->msgs[1] = ews_client_create_msg_for_url (url2, buf); ++ data->msgs[0] = ews_client_create_msg_for_url (url1, buf, auth, task); ++ data->msgs[1] = ews_client_create_msg_for_url (url2, buf, auth, task); + data->pending = sizeof (data->msgs) / sizeof (data->msgs[0]); +- data->session = soup_session_new_with_options (SOUP_SESSION_SSL_STRICT, FALSE, +- NULL); ++ data->session = soup_session_new (); + soup_session_add_feature_by_type (data->session, SOUP_TYPE_AUTH_NTLM); + data->accept_ssl_errors = accept_ssl_errors; + +@@ -515,26 +532,19 @@ goa_ews_client_autodiscover (GoaEwsClien + NULL); + } + +- auth = g_slice_new0 (AutodiscoverAuthData); +- auth->username = g_strdup (username); +- auth->password = g_strdup (password); +- g_signal_connect_data (data->session, +- "authenticate", +- G_CALLBACK (ews_client_authenticate), +- auth, +- ews_client_autodiscover_auth_data_free, +- 0); +- +- g_signal_connect (data->session, "request-started", G_CALLBACK (ews_client_request_started), task); +- +- soup_session_queue_message (data->session, +- data->msgs[0], +- ews_client_autodiscover_response_cb, +- g_object_ref (task)); +- soup_session_queue_message (data->session, +- data->msgs[1], +- ews_client_autodiscover_response_cb, +- g_object_ref (task)); ++ ++ soup_session_send_and_read_async (data->session, ++ data->msgs[0], ++ G_PRIORITY_DEFAULT, ++ data->cancellable, ++ (GAsyncReadyCallback)ews_client_autodiscover_response_cb, ++ g_object_ref (task)); ++ soup_session_send_and_read_async (data->session, ++ data->msgs[1], ++ G_PRIORITY_DEFAULT, ++ data->cancellable, ++ (GAsyncReadyCallback)ews_client_autodiscover_response_cb, ++ g_object_ref (task)); + + g_free (url2); + g_free (url1); +--- a/src/goabackend/goahttpclient.c ++++ b/src/goabackend/goahttpclient.c +@@ -82,7 +82,7 @@ http_client_check_data_free (gpointer us + + g_clear_error (&data->error); + +- /* soup_session_queue_message stole the references to data->msg */ ++ g_object_unref (data->msg); + g_object_unref (data->session); + g_slice_free (CheckData, data); + } +@@ -97,9 +97,8 @@ http_client_check_auth_data_free (gpoint + g_slice_free (CheckAuthData, auth); + } + +-static void +-http_client_authenticate (SoupSession *session, +- SoupMessage *msg, ++static gboolean ++http_client_authenticate (SoupMessage *msg, + SoupAuth *auth, + gboolean retrying, + gpointer user_data) +@@ -107,26 +106,26 @@ http_client_authenticate (SoupSession *s + CheckAuthData *data = user_data; + + if (retrying) +- return; ++ return FALSE; + + soup_auth_authenticate (auth, data->username, data->password); ++ return TRUE; + } + +-static void +-http_client_request_started (SoupSession *session, SoupMessage *msg, SoupSocket *socket, gpointer user_data) ++static gboolean ++http_client_accept_certificate (SoupMessage *msg, GTlsCertificate *cert, GTlsCertificateFlags cert_flags, gpointer user_data) + { + CheckData *data; + GTask *task = G_TASK (user_data); +- GTlsCertificateFlags cert_flags; + + g_debug ("goa_http_client_check(): request started (%p)", msg); + + data = (CheckData *) g_task_get_task_data (task); + +- if (!data->accept_ssl_errors +- && soup_message_get_https_status (msg, NULL, &cert_flags) +- && cert_flags != 0 +- && data->error == NULL) ++ if (data->accept_ssl_errors || cert_flags == 0) ++ return TRUE; ++ ++ if (data->error == NULL) + { + goa_utils_set_error_ssl (&data->error, cert_flags); + +@@ -135,6 +134,8 @@ http_client_request_started (SoupSession + */ + soup_session_abort (data->session); + } ++ ++ return FALSE; + } + + static void +@@ -154,21 +155,27 @@ http_client_check_cancelled_cb (GCancell + } + + static void +-http_client_check_response_cb (SoupSession *session, SoupMessage *msg, gpointer user_data) ++http_client_check_response_cb (SoupSession *session, GAsyncResult *result, gpointer user_data) + { ++ SoupMessage *msg; + CheckData *data; +- GCancellable *cancellable; + GTask *task = G_TASK (user_data); ++ guint status; ++ GBytes *body; ++ GError *error = NULL; + +- g_debug ("goa_http_client_check(): response (%p, %u)", msg, msg->status_code); ++ msg = soup_session_get_async_result_message (session, result); ++ ++ g_debug ("goa_http_client_check(): response (%p, %u)", msg, soup_message_get_status (msg)); ++ ++ body = soup_session_send_and_read_finish (session, result, &error); + + data = (CheckData *) g_task_get_task_data (task); +- cancellable = g_task_get_cancellable (task); + +- /* status == SOUP_STATUS_CANCELLED, if we are being aborted by the ++ /* G_IO_ERROR_CANCELLED, if we are being aborted by the + * GCancellable or due to an SSL error. + */ +- if (msg->status_code == SOUP_STATUS_CANCELLED) ++ if (g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CANCELLED)) + { + /* If we are being aborted by the GCancellable then there might + * or might not be an error. The GCancellable can be triggered +@@ -176,20 +183,27 @@ http_client_check_response_cb (SoupSessi + * of events across threads. + */ + if (data->error == NULL) +- g_cancellable_set_error_if_cancelled (cancellable, &data->error); ++ g_propagate_error (&data->error, g_steal_pointer (&error)); + + goto out; + } +- else if (msg->status_code != SOUP_STATUS_OK) ++ ++ status = soup_message_get_status (msg); ++ if (status != SOUP_STATUS_OK || error) + { +- g_warning ("goa_http_client_check() failed: %u — %s", msg->status_code, msg->reason_phrase); ++ g_warning ("goa_http_client_check() failed: %u — %s", status, soup_message_get_reason_phrase (msg)); + g_return_if_fail (data->error == NULL); + +- goa_utils_set_error_soup (&data->error, msg); ++ if (error) ++ g_propagate_error (&data->error, g_steal_pointer (&error)); ++ else ++ goa_utils_set_error_soup (&data->error, msg); + goto out; + } + + out: ++ g_clear_error (&error); ++ g_clear_pointer (&body, g_bytes_unref); + if (data->error != NULL) + g_task_return_error (task, g_steal_pointer (&data->error)); + else +@@ -225,7 +239,7 @@ goa_http_client_check (GoaHttpClient + data = g_slice_new0 (CheckData); + g_task_set_task_data (task, data, http_client_check_data_free); + +- data->session = soup_session_new_with_options (SOUP_SESSION_SSL_STRICT, FALSE, NULL); ++ data->session = soup_session_new (); + + logger = goa_soup_logger_new (SOUP_LOGGER_LOG_BODY, -1); + soup_session_add_feature (data->session, SOUP_SESSION_FEATURE (logger)); +@@ -246,15 +260,21 @@ goa_http_client_check (GoaHttpClient + auth = g_slice_new0 (CheckAuthData); + auth->username = g_strdup (username); + auth->password = g_strdup (password); +- g_signal_connect_data (data->session, ++ g_signal_connect_data (data->msg, + "authenticate", + G_CALLBACK (http_client_authenticate), + auth, + http_client_check_auth_data_free, + 0); + +- g_signal_connect (data->session, "request-started", G_CALLBACK (http_client_request_started), task); +- soup_session_queue_message (data->session, data->msg, http_client_check_response_cb, g_object_ref (task)); ++ g_signal_connect (data->msg, "accept-certificate", G_CALLBACK (http_client_accept_certificate), task); ++ ++ soup_session_send_and_read_async (data->session, ++ data->msg, ++ G_PRIORITY_DEFAULT, ++ data->cancellable, ++ (GAsyncReadyCallback)http_client_check_response_cb, ++ g_object_ref (task)); + + g_object_unref (task); + } +--- a/src/goabackend/goalastfmprovider.c ++++ b/src/goabackend/goalastfmprovider.c +@@ -483,8 +483,7 @@ add_account_cb (GoaManager *manager, GAs + + static void + check_cb (RestProxyCall *call, +- const GError *error, +- GObject *weak_object, ++ GAsyncResult *result, + gpointer user_data) + { + AddAccountData *data = user_data; +@@ -494,6 +493,9 @@ check_cb (RestProxyCall *call, + JsonObject *session_obj; + const gchar *payload; + ++ if (!rest_proxy_call_invoke_finish (call, result, &data->error)) ++ goto out; ++ + parser = NULL; + + parser = json_parser_new (); +@@ -562,12 +564,12 @@ on_rest_proxy_call_cancelled_cb (GCancel + } + + static void +-lastfm_login (GoaProvider *provider, +- const gchar *username, +- const gchar *password, +- GCancellable *cancellable, +- RestProxyCallAsyncCallback callback, +- gpointer user_data) ++lastfm_login (GoaProvider *provider, ++ const gchar *username, ++ const gchar *password, ++ GCancellable *cancellable, ++ GAsyncReadyCallback callback, ++ gpointer user_data) + { + AddAccountData *data = user_data; + RestProxyCall *call; +@@ -598,7 +600,7 @@ lastfm_login (GoaProvider + rest_proxy_call_add_param (call, "api_sig", sig_md5); + rest_proxy_call_add_param (call, "format", "json"); + +- rest_proxy_call_async (call, callback, NULL, data, &data->error); ++ rest_proxy_call_invoke_async (call, NULL, callback, data); + + g_signal_connect (cancellable, "cancelled", G_CALLBACK (on_rest_proxy_call_cancelled_cb), call); + +@@ -665,7 +667,7 @@ add_account (GoaProvider *provider, + username, + password, + data.cancellable, +- (RestProxyCallAsyncCallback) check_cb, ++ (GAsyncReadyCallback) check_cb, + &data); + + gtk_widget_set_sensitive (data.connect_button, FALSE); +@@ -819,7 +821,7 @@ refresh_account (GoaProvider *provide + username, + password, + data.cancellable, +- (RestProxyCallAsyncCallback) check_cb, ++ (GAsyncReadyCallback) check_cb, + &data); + gtk_widget_set_sensitive (data.connect_button, FALSE); + gtk_widget_show (data.progress_grid); +--- a/src/goabackend/goaoauth2provider.c ++++ b/src/goabackend/goaoauth2provider.c +@@ -95,11 +95,15 @@ is_authorization_error (GError *error) + g_return_val_if_fail (error != NULL, FALSE); + + ret = FALSE; +- if (error->domain == REST_PROXY_ERROR || error->domain == SOUP_HTTP_ERROR) ++ if (error->domain == REST_PROXY_ERROR) + { + if (SOUP_STATUS_IS_CLIENT_ERROR (error->code)) + ret = TRUE; + } ++ else if (g_error_matches (error, GOA_ERROR, GOA_ERROR_NOT_AUTHORIZED)) ++ { ++ ret = TRUE; ++ } + return ret; + } + +--- a/src/goabackend/goaoauthprovider.c ++++ b/src/goabackend/goaoauthprovider.c +@@ -77,11 +77,15 @@ is_authorization_error (GError *error) + g_return_val_if_fail (error != NULL, FALSE); + + ret = FALSE; +- if (error->domain == REST_PROXY_ERROR || error->domain == SOUP_HTTP_ERROR) ++ if (error->domain == REST_PROXY_ERROR) + { + if (SOUP_STATUS_IS_CLIENT_ERROR (error->code)) + ret = TRUE; + } ++ else if (g_error_matches (error, GOA_ERROR, GOA_ERROR_NOT_AUTHORIZED)) ++ { ++ ret = TRUE; ++ } + return ret; + } + +@@ -701,9 +705,15 @@ on_web_view_decide_policy (WebKitWebView + } + + static void +-rest_proxy_call_cb (RestProxyCall *call, const GError *error, GObject *weak_object, gpointer user_data) ++rest_proxy_call_cb (GObject *source, GAsyncResult *result, gpointer user_data) + { ++ RestProxyCall *call = REST_PROXY_CALL (source); + IdentifyData *data = user_data; ++ ++ if (!rest_proxy_call_invoke_finish (call, result, &data->error)) ++ { ++ g_prefix_error (&data->error, _("Error getting a Request Token: ")); ++ } + g_main_loop_quit (data->loop); + } + +@@ -770,11 +780,7 @@ get_tokens_and_identity (GoaOAuthProvide + for (n = 0; request_params[n] != NULL; n += 2) + rest_proxy_call_add_param (call, request_params[n], request_params[n+1]); + } +- if (!rest_proxy_call_async (call, rest_proxy_call_cb, NULL, &data, &data.error)) +- { +- g_prefix_error (&data.error, _("Error getting a Request Token: ")); +- goto out; +- } ++ rest_proxy_call_invoke_async (call, NULL, rest_proxy_call_cb, &data); + + goa_utils_set_dialog_title (GOA_PROVIDER (provider), dialog, add_account); + +@@ -796,6 +802,9 @@ get_tokens_and_identity (GoaOAuthProvide + g_main_loop_run (data.loop); + gtk_container_remove (GTK_CONTAINER (grid), spinner); + ++ if (data.error) ++ goto out; ++ + if (rest_proxy_call_get_status_code (call) != 200) + { + gchar *msg; +--- a/src/goabackend/goarestproxy.h ++++ b/src/goabackend/goarestproxy.h +@@ -27,8 +27,6 @@ + + G_BEGIN_DECLS + +-G_DEFINE_AUTOPTR_CLEANUP_FUNC (RestProxy, g_object_unref); +- + #define GOA_TYPE_REST_PROXY (goa_rest_proxy_get_type ()) + G_DECLARE_FINAL_TYPE (GoaRestProxy, goa_rest_proxy, GOA, REST_PROXY, RestProxy); + +--- a/src/goabackend/goasouplogger.c ++++ b/src/goabackend/goasouplogger.c +@@ -22,15 +22,6 @@ + + #include "goasouplogger.h" + +-struct _GoaSoupLogger +-{ +- SoupLogger parent_instance; +-}; +- +-G_DEFINE_TYPE (GoaSoupLogger, goa_soup_logger, SOUP_TYPE_LOGGER); +- +-/* ---------------------------------------------------------------------------------------------------- */ +- + static void + goa_soup_logger_printer (SoupLogger *logger, + SoupLoggerLogLevel level, +@@ -45,24 +36,16 @@ goa_soup_logger_printer (SoupLogger + g_free (message); + } + +-/* ---------------------------------------------------------------------------------------------------- */ +- +-static void +-goa_soup_logger_init (GoaSoupLogger *self) +-{ +- soup_logger_set_printer (SOUP_LOGGER (self), goa_soup_logger_printer, NULL, NULL); +-} +- +-static void +-goa_soup_logger_class_init (GoaSoupLoggerClass *klass) +-{ +-} +- +-/* ---------------------------------------------------------------------------------------------------- */ +- + SoupLogger * + goa_soup_logger_new (SoupLoggerLogLevel level, + gint max_body_size) + { +- return g_object_new (GOA_TYPE_SOUP_LOGGER, "level", level, "max-body-size", max_body_size, NULL); ++ SoupLogger *logger; ++ ++ logger = soup_logger_new (level); ++ if (max_body_size != -1) ++ soup_logger_set_max_body_size (logger, max_body_size); ++ soup_logger_set_printer (logger, goa_soup_logger_printer, NULL, NULL); ++ ++ return logger; + } +--- a/src/goabackend/goasouplogger.h ++++ b/src/goabackend/goasouplogger.h +@@ -27,9 +27,6 @@ + + G_BEGIN_DECLS + +-#define GOA_TYPE_SOUP_LOGGER (goa_soup_logger_get_type ()) +-G_DECLARE_FINAL_TYPE (GoaSoupLogger, goa_soup_logger, GOA, SOUP_LOGGER, SoupLogger); +- + SoupLogger *goa_soup_logger_new (SoupLoggerLogLevel level, + gint max_body_size); + +--- a/src/goabackend/goautils.c ++++ b/src/goabackend/goautils.c +@@ -841,29 +841,26 @@ goa_utils_set_error_soup (GError **err, + { + gchar *error_msg = NULL; + gint error_code = GOA_ERROR_FAILED; /* TODO: more specific */ ++ guint status_code; + +- switch (msg->status_code) ++ status_code = soup_message_get_status (msg); ++ switch (status_code) + { +- case SOUP_STATUS_CANT_RESOLVE: +- error_msg = g_strdup (_("Cannot resolve hostname")); +- break; +- +- case SOUP_STATUS_CANT_RESOLVE_PROXY: +- error_msg = g_strdup (_("Cannot resolve proxy hostname")); +- break; +- + case SOUP_STATUS_INTERNAL_SERVER_ERROR: + case SOUP_STATUS_NOT_FOUND: + error_msg = g_strdup (_("Cannot find WebDAV endpoint")); + break; + +- case SOUP_STATUS_UNAUTHORIZED: +- error_msg = g_strdup (_("Authentication failed")); +- error_code = GOA_ERROR_NOT_AUTHORIZED; +- break; +- + default: +- error_msg = g_strdup_printf (_("Code: %u — Unexpected response from server"), msg->status_code); ++ if (SOUP_STATUS_IS_CLIENT_ERROR (status_code)) ++ { ++ error_msg = g_strdup (_("Authentication failed")); ++ error_code = GOA_ERROR_NOT_AUTHORIZED; ++ } ++ else ++ { ++ error_msg = g_strdup_printf (_("Code: %u — Unexpected response from server"), status_code); ++ } + break; + } + diff --git a/meta-openembedded/meta-gnome/recipes-gnome/gnome-online-accounts/gnome-online-accounts_3.40.0.bb b/meta-openembedded/meta-gnome/recipes-gnome/gnome-online-accounts/gnome-online-accounts_3.43.1.bb index c7e8eecb1f..8580d293ee 100644 --- a/meta-openembedded/meta-gnome/recipes-gnome/gnome-online-accounts/gnome-online-accounts_3.40.0.bb +++ b/meta-openembedded/meta-gnome/recipes-gnome/gnome-online-accounts/gnome-online-accounts_3.43.1.bb @@ -4,19 +4,23 @@ LIC_FILES_CHKSUM = "file://COPYING;md5=34c88b124db5fb2762c1676be7dadd36" GNOMEBASEBUILDCLASS = "autotools" -inherit gnomebase gsettings gobject-introspection gsettings gtk-doc vala gettext upstream-version-is-even features_check +inherit gnomebase gsettings gobject-introspection gsettings gtk-doc vala gettext features_check # for webkitgtk REQUIRED_DISTRO_FEATURES = "x11" DEPENDS = "glib-2.0" -SRC_URI[archive.sha256sum] = "585c4f979f6f543b77bfdb4fb01eb18ba25c2aec5b7866c676d929616fb2c3fa" +SRC_URI += "\ + file://0001-Use-GUri-instead-of-SoupURI.patch \ + file://0002-Port-to-libsoup3.patch \ +" +SRC_URI[archive.sha256sum] = "3bcb3663a12efd4482d9fdda3e171676267fc739eb6440a2b7109a0e87afb7e8" # backend is required for gnome-control-center PACKAGECONFIG = "backend other" -PACKAGECONFIG[backend] = "--enable-backend,--disable-backend,gtk+3 webkitgtk libsoup-2.4 json-glib libsecret rest libxml2" +PACKAGECONFIG[backend] = "--enable-backend,--disable-backend,gtk+3 webkitgtk libsoup json-glib libsecret rest libxml2" PACKAGECONFIG[krb5] = "--enable-kerberos, --disable-kerberos , krb5 gcr" # no extra dependencies! diff --git a/meta-openembedded/meta-gnome/recipes-gnome/gnome-screenshot/gnome-screenshot_40.0.bb b/meta-openembedded/meta-gnome/recipes-gnome/gnome-screenshot/gnome-screenshot_40.0.bb new file mode 100644 index 0000000000..72272f993c --- /dev/null +++ b/meta-openembedded/meta-gnome/recipes-gnome/gnome-screenshot/gnome-screenshot_40.0.bb @@ -0,0 +1,22 @@ +SUMMARY = "GNOME Screenshot" +DESCRIPTION = "GNOME Screenshot is a small utility that takes a screenshot \ +of the whole desktop, the currently focused window, or an area of the screen." +LICENSE = "GPLv2" +LIC_FILES_CHKSUM = "file://COPYING;md5=59530bdf33659b29e73d4adb9f9f6552" + +SECTION = "x11/gnome" + +GNOMEBASEBUILDCLASS = "meson" + +inherit features_check gnomebase gettext upstream-version-is-even pkgconfig + +SRC_URI[archive.sha256sum] = "368ca95a39e39dc2406c849e8c4205e3f574acdd874c30741873455e3d21a5e2" + +DEPENDS += "glib-2.0 glib-2.0-native gtk+3 libhandy xext" + +REQUIRED_DISTRO_FEATURES = "x11" + +FILES:${PN} += " \ + ${datadir}/dbus-1 \ + ${datadir}/metainfo \ +" diff --git a/meta-openembedded/meta-gnome/recipes-gnome/libgweather/libgweather_3.36.2.bb b/meta-openembedded/meta-gnome/recipes-gnome/libgweather/libgweather_40.0.bb index 69fe9552f0..1d9daac1f0 100644 --- a/meta-openembedded/meta-gnome/recipes-gnome/libgweather/libgweather_3.36.2.bb +++ b/meta-openembedded/meta-gnome/recipes-gnome/libgweather/libgweather_40.0.bb @@ -7,8 +7,7 @@ GNOMEBASEBUILDCLASS = "meson" inherit gnomebase gsettings gobject-introspection gettext gtk-doc vala features_check upstream-version-is-even -SRC_URI[archive.md5sum] = "ff399cf89e97a3e574ae05db5617b96b" -SRC_URI[archive.sha256sum] = "ee1201a8fc25c14e940d3b26db49a34947c8aebf67dee01ee67fbcb06ecb37a0" +SRC_URI[archive.sha256sum] = "ca4e8f2a4baaa9fc6d75d8856adb57056ef1cd6e55c775ba878ae141b6276ee6" # gobject-introspection is mandatory and cannot be configured REQUIRED_DISTRO_FEATURES = "gobject-introspection-data" @@ -17,8 +16,9 @@ UNKNOWN_CONFIGURE_WHITELIST:append = " introspection" GTKDOC_MESON_OPTION = "gtk_doc" DEPENDS = " \ + geocode-glib \ gtk+3 \ json-glib \ libsoup-2.4 \ - geocode-glib \ + python3-pygobject-native \ " diff --git a/meta-openembedded/meta-gnome/recipes-gnome/mutter/mutter_3.34.6.bb b/meta-openembedded/meta-gnome/recipes-gnome/mutter/mutter_3.34.6.bb index 72e776719e..b659d92952 100644 --- a/meta-openembedded/meta-gnome/recipes-gnome/mutter/mutter_3.34.6.bb +++ b/meta-openembedded/meta-gnome/recipes-gnome/mutter/mutter_3.34.6.bb @@ -73,7 +73,9 @@ do_install:append() { done } -PACKAGES =+ "${PN}-tests" +GSETTINGS_PACKAGE = "${PN}-gsettings" + +PACKAGES =+ "${PN}-tests ${PN}-gsettings" FILES:${PN} += " \ ${datadir}/gnome-control-center \ @@ -93,5 +95,5 @@ FILES:${PN}-dev += " \ ${libdir}/${MUTTER_API_NAME}/lib*.so \ " -RDEPENDS:${PN} += "zenity" +RDEPENDS:${PN} += "zenity ${PN}-gsettings" diff --git a/meta-openembedded/meta-gnome/recipes-gnome/rest/files/0001-Use-GUri-instead-of-SoupURI.patch b/meta-openembedded/meta-gnome/recipes-gnome/rest/files/0001-Use-GUri-instead-of-SoupURI.patch new file mode 100644 index 0000000000..37ba0a0429 --- /dev/null +++ b/meta-openembedded/meta-gnome/recipes-gnome/rest/files/0001-Use-GUri-instead-of-SoupURI.patch @@ -0,0 +1,181 @@ +From d39fd6d5f4c0a63cc048b84b0f989cb83f31e5fe Mon Sep 17 00:00:00 2001 +From: Carlos Garcia Campos <cgarcia@igalia.com> +Date: Tue, 8 Jun 2021 10:57:06 +0200 +Subject: [PATCH 1/2] Use GUri instead of SoupURI + +Upstream-Status: Submitted [https://gitlab.gnome.org/GNOME/librest/-/merge_requests/6] +--- + configure.ac | 2 +- + rest-extras/flickr-proxy.c | 19 ++++++++++++++----- + rest/oauth-proxy-call.c | 19 ++++++++++++++----- + rest/oauth2-proxy.c | 22 +++++++++++----------- + 4 files changed, 40 insertions(+), 22 deletions(-) + +diff --git a/configure.ac b/configure.ac +index d15e592..d586e69 100644 +--- a/configure.ac ++++ b/configure.ac +@@ -40,7 +40,7 @@ AM_PROG_CC_C_O + LT_PREREQ([2.2.6]) + LT_INIT([disable-static]) + +-PKG_CHECK_MODULES(GLIB, glib-2.0 >= 2.44) ++PKG_CHECK_MODULES(GLIB, glib-2.0 >= 2.67.4) + PKG_CHECK_MODULES(SOUP, libsoup-2.4 >= 2.42) + PKG_CHECK_MODULES(XML, libxml-2.0) + PKG_CHECK_MODULES(GTHREAD, gthread-2.0) +diff --git a/rest-extras/flickr-proxy.c b/rest-extras/flickr-proxy.c +index 3342a4d..7726359 100644 +--- a/rest-extras/flickr-proxy.c ++++ b/rest-extras/flickr-proxy.c +@@ -304,13 +304,13 @@ flickr_proxy_build_login_url (FlickrProxy *proxy, + const char *frob, + const char *perms) + { +- SoupURI *uri; ++ GUri *uri; + GHashTable *params; + char *sig, *s; ++ char *query; + + g_return_val_if_fail (FLICKR_IS_PROXY (proxy), NULL); + +- uri = soup_uri_new ("http://flickr.com/services/auth/"); + params = g_hash_table_new (g_str_hash, g_str_equal); + + g_hash_table_insert (params, "api_key", proxy->priv->api_key); +@@ -321,14 +321,23 @@ flickr_proxy_build_login_url (FlickrProxy *proxy, + + sig = flickr_proxy_sign (proxy, params); + g_hash_table_insert (params, "api_sig", sig); ++ query = soup_form_encode_hash (params); + +- soup_uri_set_query_from_form (uri, params); ++ uri = g_uri_build (G_URI_FLAGS_ENCODED, ++ "http", ++ NULL, ++ "flickr.com", ++ -1, ++ "services/auth/", ++ query, ++ NULL); + +- s = soup_uri_to_string (uri, FALSE); ++ s = g_uri_to_string (uri); + ++ g_free (query); + g_free (sig); + g_hash_table_destroy (params); +- soup_uri_free (uri); ++ g_uri_unref (uri); + + return s; + } +diff --git a/rest/oauth-proxy-call.c b/rest/oauth-proxy-call.c +index c90c69d..e238c3c 100644 +--- a/rest/oauth-proxy-call.c ++++ b/rest/oauth-proxy-call.c +@@ -30,7 +30,7 @@ + + G_DEFINE_TYPE (OAuthProxyCall, oauth_proxy_call, REST_TYPE_PROXY_CALL) + +-#define OAUTH_ENCODE_STRING(x_) (x_ ? soup_uri_encode( (x_), "!$&'()*+,;=@") : g_strdup ("")) ++#define OAUTH_ENCODE_STRING(x_) (x_ ? g_uri_escape_string( (x_), NULL, TRUE) : g_strdup ("")) + + static char * + sign_plaintext (OAuthProxyPrivate *priv) +@@ -136,15 +136,24 @@ sign_hmac (OAuthProxy *proxy, RestProxyCall *call, GHashTable *oauth_params) + if (priv->oauth_echo) { + g_string_append_uri_escaped (text, priv->service_url, NULL, FALSE); + } else if (priv->signature_host != NULL) { +- SoupURI *url = soup_uri_new (url_str); ++ GUri *url = g_uri_parse (url_str, G_URI_FLAGS_ENCODED, NULL); ++ GUri *new_url; + gchar *signing_url; + +- soup_uri_set_host (url, priv->signature_host); +- signing_url = soup_uri_to_string (url, FALSE); ++ new_url = g_uri_build (g_uri_get_flags (url), ++ g_uri_get_scheme (url), ++ g_uri_get_userinfo (url), ++ priv->signature_host, ++ g_uri_get_port (url), ++ g_uri_get_path (url), ++ g_uri_get_query (url), ++ g_uri_get_fragment (url)); ++ signing_url = g_uri_to_string (new_url); + + g_string_append_uri_escaped (text, signing_url, NULL, FALSE); + +- soup_uri_free (url); ++ g_uri_unref (new_url); ++ g_uri_unref (url); + g_free (signing_url); + } else { + g_string_append_uri_escaped (text, url_str, NULL, FALSE); +diff --git a/rest/oauth2-proxy.c b/rest/oauth2-proxy.c +index 24e5da0..3382f8b 100644 +--- a/rest/oauth2-proxy.c ++++ b/rest/oauth2-proxy.c +@@ -37,8 +37,6 @@ oauth2_proxy_error_quark (void) + return g_quark_from_static_string ("rest-oauth2-proxy"); + } + +-#define EXTRA_CHARS_ENCODE "!$&'()*+,;=@" +- + enum { + PROP_0, + PROP_CLIENT_ID, +@@ -242,8 +240,8 @@ append_query_param (gpointer key, gpointer value, gpointer user_data) + char *encoded_val, *encoded_key; + char *param; + +- encoded_val = soup_uri_encode (value, EXTRA_CHARS_ENCODE); +- encoded_key = soup_uri_encode (key, EXTRA_CHARS_ENCODE); ++ encoded_val = g_uri_escape_string (value, NULL, TRUE); ++ encoded_key = g_uri_escape_string (key, NULL, TRUE); + + param = g_strdup_printf ("%s=%s", encoded_key, encoded_val); + g_free (encoded_key); +@@ -295,8 +293,8 @@ oauth2_proxy_build_login_url_full (OAuth2Proxy *proxy, + g_hash_table_foreach (extra_params, append_query_param, params); + } + +- encoded_uri = soup_uri_encode (redirect_uri, EXTRA_CHARS_ENCODE); +- encoded_id = soup_uri_encode (proxy->priv->client_id, EXTRA_CHARS_ENCODE); ++ encoded_uri = g_uri_escape_string (redirect_uri, NULL, TRUE); ++ encoded_id = g_uri_escape_string (proxy->priv->client_id, NULL, TRUE); + + url = g_strdup_printf ("%s?client_id=%s&redirect_uri=%s&type=user_agent", + proxy->priv->auth_endpoint, encoded_id, +@@ -378,20 +376,22 @@ oauth2_proxy_extract_access_token (const char *url) + { + GHashTable *params; + char *token = NULL; +- SoupURI *soupuri = soup_uri_new (url); ++ const char *fragment; ++ GUri *uri = g_uri_parse (url, G_URI_FLAGS_ENCODED, NULL); + +- if (soupuri->fragment != NULL) { +- params = soup_form_decode (soupuri->fragment); ++ fragment = g_uri_get_fragment (uri); ++ if (fragment != NULL) { ++ params = soup_form_decode (fragment); + + if (params) { + char *encoded = g_hash_table_lookup (params, "access_token"); + if (encoded) +- token = soup_uri_decode (encoded); ++ token = g_uri_unescape_string (encoded, NULL); + + g_hash_table_destroy (params); + } + } +- soup_uri_free (soupuri); ++ g_uri_unref (uri); + + return token; + } +-- +2.33.1 + diff --git a/meta-openembedded/meta-gnome/recipes-gnome/rest/files/0002-Port-to-libsoup3.patch b/meta-openembedded/meta-gnome/recipes-gnome/rest/files/0002-Port-to-libsoup3.patch new file mode 100644 index 0000000000..eed522f776 --- /dev/null +++ b/meta-openembedded/meta-gnome/recipes-gnome/rest/files/0002-Port-to-libsoup3.patch @@ -0,0 +1,1696 @@ +From 3dc630ae5b9dc6cda1ba318de2cd654aaba7b4a2 Mon Sep 17 00:00:00 2001 +From: Carlos Garcia Campos <cgarcia@igalia.com> +Date: Tue, 8 Jun 2021 17:44:04 +0200 +Subject: [PATCH 2/2] Port to libsoup3 + +Upstream-Status: Submitted [https://gitlab.gnome.org/GNOME/librest/-/merge_requests/6] +--- + configure.ac | 39 ++++- + rest-extras.pc.in | 2 +- + rest-extras/youtube-proxy.c | 110 +++++++++++--- + rest.pc.in | 2 +- + rest/rest-private.h | 22 ++- + rest/rest-proxy-auth.c | 16 ++ + rest/rest-proxy-call.c | 296 +++++++++++++++++++++++++++++------- + rest/rest-proxy.c | 209 ++++++++++++++++++++++--- + tests/custom-serialize.c | 18 +++ + tests/proxy-continuous.c | 37 ++++- + tests/proxy.c | 63 +++++++- + tests/threaded.c | 17 +++ + 12 files changed, 719 insertions(+), 112 deletions(-) + +diff --git a/configure.ac b/configure.ac +index d586e69..75c02fe 100644 +--- a/configure.ac ++++ b/configure.ac +@@ -20,12 +20,6 @@ AM_INIT_AUTOMAKE([1.11 foreign -Wno-portability no-define dist-xz]) + + AM_SILENT_RULES([yes]) + +-API_MAJOR=1 +-API_MINOR=0 +-AC_SUBST([API_VERSION],[$API_MAJOR.$API_MINOR]) +-AC_SUBST([API_VERSION_AM],[$API_MAJOR\_$API_MINOR]) +-AC_DEFINE_UNQUOTED(API_VERSION, [$API_VERSION], [API version]) +- + AC_CANONICAL_HOST + + AC_PROG_CC +@@ -41,7 +35,6 @@ LT_PREREQ([2.2.6]) + LT_INIT([disable-static]) + + PKG_CHECK_MODULES(GLIB, glib-2.0 >= 2.67.4) +-PKG_CHECK_MODULES(SOUP, libsoup-2.4 >= 2.42) + PKG_CHECK_MODULES(XML, libxml-2.0) + PKG_CHECK_MODULES(GTHREAD, gthread-2.0) + +@@ -58,6 +51,37 @@ AC_PATH_PROG([GLIB_MKENUMS],[glib-mkenums]) + localedir=${datadir}/locale + AC_SUBST(localedir) + ++AC_MSG_CHECKING([for libsoup version to use]) ++AC_ARG_WITH(soup, ++ [AC_HELP_STRING([--soup=2|3], ++ [version of libsoup library to use (default: 2)])], ++ [case "$withval" in ++ 2|3) ;; ++ *) AC_MSG_ERROR([invalid argument "$withval" for --with-soup]) ;; ++ esac], ++ [with_soup=2]) ++AC_MSG_RESULT([$with_soup]) ++ ++API_MAJOR=1 ++ ++if test "$with_soup" = "2"; then ++ PKG_CHECK_MODULES(SOUP, libsoup-2.4 >= 2.42) ++ SOUP_API_VERSION=2.4 ++ API_MINOR=0 ++ AC_DEFINE([WITH_SOUP_2],[1],[Define if libsoup version used is 2]) ++else ++ PKG_CHECK_MODULES(SOUP, libsoup-3.0 >= 2.99.8) ++ SOUP_API_VERSION=3.0 ++ API_MINOR=1 ++fi ++ ++AM_CONDITIONAL([WITH_SOUP_2],[test "$with_soup" = "2"]) ++AC_SUBST(SOUP_API_VERSION) ++ ++AC_SUBST([API_VERSION],[$API_MAJOR.$API_MINOR]) ++AC_SUBST([API_VERSION_AM],[$API_MAJOR\_$API_MINOR]) ++AC_DEFINE_UNQUOTED(API_VERSION, [$API_VERSION], [API version]) ++ + dnl === Coverage report ======================================================= + AC_PATH_PROG([GCOV], [lcov], [enable_gcov=no]) + +@@ -130,6 +154,7 @@ echo " LibRest $VERSION" + echo " ================" + echo "" + echo " prefix: ${prefix}" ++echo " libsoup version: ${with_soup}" + echo "" + echo " Documentation: ${enable_gtk_doc}" + echo " Introspection data: ${enable_introspection}" +diff --git a/rest-extras.pc.in b/rest-extras.pc.in +index 39f21bf..3723d6d 100644 +--- a/rest-extras.pc.in ++++ b/rest-extras.pc.in +@@ -9,4 +9,4 @@ Description: RESTful web api query library + Version: @VERSION@ + Libs: -L${libdir} -lrest-extras-${apiversion} + Cflags: -I${includedir}/rest-${apiversion} +-Requires: glib-2.0 libsoup-2.4 libxml-2.0 ++Requires: glib-2.0 libsoup-@SOUP_API_VERSION@ libxml-2.0 +diff --git a/rest-extras/youtube-proxy.c b/rest-extras/youtube-proxy.c +index be0cf08..cd598f4 100644 +--- a/rest-extras/youtube-proxy.c ++++ b/rest-extras/youtube-proxy.c +@@ -246,6 +246,9 @@ typedef struct { + GObject *weak_object; + gpointer user_data; + gsize uploaded; ++#ifndef WITH_SOUP_2 ++ GCancellable *cancellable; ++#endif + } YoutubeProxyUploadClosure; + + static void +@@ -255,7 +258,11 @@ _upload_async_weak_notify_cb (gpointer *data, + YoutubeProxyUploadClosure *closure = + (YoutubeProxyUploadClosure *) data; + ++#ifdef WITH_SOUP_2 + _rest_proxy_cancel_message (REST_PROXY (closure->proxy), closure->message); ++#else ++ g_cancellable_cancel (closure->cancellable); ++#endif + } + + static void +@@ -267,6 +274,9 @@ _upload_async_closure_free (YoutubeProxyUploadClosure *closure) + closure); + + g_object_unref (closure->proxy); ++#ifndef WITH_SOUP_2 ++ g_object_unref (closure->cancellable); ++#endif + + g_slice_free (YoutubeProxyUploadClosure, closure); + } +@@ -286,6 +296,9 @@ _upload_async_closure_new (YoutubeProxy *self, + closure->message = message; + closure->weak_object = weak_object; + closure->user_data = user_data; ++#ifndef WITH_SOUP_2 ++ closure->cancellable = g_cancellable_new (); ++#endif + + if (weak_object != NULL) + g_object_weak_ref (weak_object, +@@ -295,41 +308,67 @@ _upload_async_closure_new (YoutubeProxy *self, + } + + static void +-_upload_completed_cb (SoupSession *session, +- SoupMessage *message, ++_upload_completed_cb (SoupMessage *message, ++ GBytes *payload, ++ GError *error, + gpointer user_data) + { + YoutubeProxyUploadClosure *closure = + (YoutubeProxyUploadClosure *) user_data; +- GError *error = NULL; ++ gsize length; ++ gconstpointer data; ++ guint status_code; ++ const char *reason_phrase; + + if (closure->callback == NULL) + return; + +- if (message->status_code < 200 || message->status_code >= 300) +- error = g_error_new_literal (REST_PROXY_ERROR, +- message->status_code, +- message->reason_phrase); +- +- closure->callback (closure->proxy, message->response_body->data, +- message->request_body->length, +- message->request_body->length, ++#ifdef WITH_SOUP_2 ++ status_code = message->status_code; ++ reason_phrase = message->reason_phrase; ++#else ++ status_code = soup_message_get_status (message); ++ reason_phrase = soup_message_get_reason_phrase (message); ++#endif ++ ++ if (status_code < 200 || status_code >= 300) ++ { ++ g_clear_error (&error); ++ error = g_error_new_literal (REST_PROXY_ERROR, ++ status_code, ++ reason_phrase); ++ } ++ ++ data = g_bytes_get_data (payload, &length); ++ closure->callback (closure->proxy, data, length, length, + error, closure->weak_object, closure->user_data); ++ g_bytes_unref (payload); + + _upload_async_closure_free (closure); + } + + static void + _message_wrote_data_cb (SoupMessage *msg, ++#ifdef WITH_SOUP_2 + SoupBuffer *chunk, ++#else ++ gsize chunk_size, ++#endif + YoutubeProxyUploadClosure *closure) + { +- closure->uploaded = closure->uploaded + chunk->length; ++#ifdef WITH_SOUP_2 ++ gsize chunk_size = chunk->length; ++ goffset content_length = msg->request_body->length; ++#else ++ goffset content_length = soup_message_headers_get_content_length (soup_message_get_request_headers (msg)); ++#endif ++ ++ closure->uploaded = closure->uploaded + chunk_size; + +- if (closure->uploaded < msg->request_body->length) ++ if (closure->uploaded < content_length) + closure->callback (closure->proxy, + NULL, +- msg->request_body->length, ++ content_length, + closure->uploaded, + NULL, + closure->weak_object, +@@ -364,7 +403,12 @@ youtube_proxy_upload_async (YoutubeProxy *self, + SoupMultipart *mp; + SoupMessage *message; + SoupMessageHeaders *part_headers; ++ SoupMessageHeaders *request_headers; ++#ifdef WITH_SOUP_2 + SoupBuffer *sb; ++#else ++ GBytes *sb; ++#endif + gchar *content_type; + gchar *atom_xml; + GMappedFile *map; +@@ -380,10 +424,17 @@ youtube_proxy_upload_async (YoutubeProxy *self, + + atom_xml = _construct_upload_atom_xml (fields, incomplete); + ++#ifdef WITH_SOUP_2 + sb = soup_buffer_new_with_owner (atom_xml, + strlen(atom_xml), + atom_xml, + (GDestroyNotify) g_free); ++#else ++ sb = g_bytes_new_with_free_func (atom_xml, ++ strlen (atom_xml), ++ (GDestroyNotify) g_free, ++ atom_xml); ++#endif + + part_headers = soup_message_headers_new (SOUP_MESSAGE_HEADERS_MULTIPART); + +@@ -393,7 +444,11 @@ youtube_proxy_upload_async (YoutubeProxy *self, + + soup_multipart_append_part (mp, part_headers, sb); + ++#ifdef WITH_SOUP_2 + soup_buffer_free (sb); ++#else ++ g_bytes_unref (sb); ++#endif + + content_type = g_content_type_guess ( + filename, +@@ -401,24 +456,37 @@ youtube_proxy_upload_async (YoutubeProxy *self, + g_mapped_file_get_length (map), + NULL); + ++#ifdef WITH_SOUP_2 + sb = soup_buffer_new_with_owner (g_mapped_file_get_contents (map), + g_mapped_file_get_length (map), + map, + (GDestroyNotify) g_mapped_file_unref); ++#else ++ sb = g_bytes_new_with_free_func (g_mapped_file_get_contents (map), ++ g_mapped_file_get_length (map), ++ (GDestroyNotify) g_mapped_file_unref, ++ map); ++#endif + + soup_message_headers_replace (part_headers, "Content-Type", content_type); + + soup_multipart_append_part (mp, part_headers, sb); + ++#ifdef WITH_SOUP_2 + soup_buffer_free (sb); +- + soup_message_headers_free (part_headers); +- + message = soup_form_request_new_from_multipart (UPLOAD_URL, mp); ++ request_headers = message->request_headers; ++#else ++ g_bytes_unref (sb); ++ soup_message_headers_unref (part_headers); ++ message = soup_message_new_from_multipart (UPLOAD_URL, mp); ++ request_headers = soup_message_get_request_headers (message); ++#endif + + soup_multipart_free (mp); + +- _set_upload_headers (self, message->request_headers, filename); ++ _set_upload_headers (self, request_headers, filename); + + closure = _upload_async_closure_new (self, callback, message, weak_object, + user_data); +@@ -429,7 +497,13 @@ youtube_proxy_upload_async (YoutubeProxy *self, + closure); + + +- _rest_proxy_queue_message (REST_PROXY (self), message, _upload_completed_cb, ++ _rest_proxy_queue_message (REST_PROXY (self), message, ++#ifdef WITH_SOUP_2 ++ NULL, ++#else ++ closure->cancellable, ++#endif ++ _upload_completed_cb, + closure); + + return TRUE; +diff --git a/rest.pc.in b/rest.pc.in +index 94c384b..e6bae3e 100644 +--- a/rest.pc.in ++++ b/rest.pc.in +@@ -9,4 +9,4 @@ Description: RESTful web api query library + Version: @VERSION@ + Libs: -L${libdir} -lrest-${apiversion} + Cflags: -I${includedir}/rest-${apiversion} +-Requires: glib-2.0 libsoup-2.4 libxml-2.0 ++Requires: glib-2.0 libsoup-@SOUP_API_VERSION@ libxml-2.0 +diff --git a/rest/rest-private.h b/rest/rest-private.h +index 9e91fa0..6e71322 100644 +--- a/rest/rest-private.h ++++ b/rest/rest-private.h +@@ -31,6 +31,11 @@ + + G_BEGIN_DECLS + ++typedef void (*RestMessageFinishedCallback) (SoupMessage *msg, ++ GBytes *body, ++ GError *error, ++ gpointer user_data); ++ + typedef enum + { + REST_DEBUG_XML_PARSER = 1 << 0, +@@ -53,12 +58,23 @@ gboolean _rest_proxy_get_binding_required (RestProxy *proxy); + const gchar *_rest_proxy_get_bound_url (RestProxy *proxy); + void _rest_proxy_queue_message (RestProxy *proxy, + SoupMessage *message, +- SoupSessionCallback callback, ++ GCancellable *cancellable, ++ RestMessageFinishedCallback callback, + gpointer user_data); + void _rest_proxy_cancel_message (RestProxy *proxy, + SoupMessage *message); +-guint _rest_proxy_send_message (RestProxy *proxy, +- SoupMessage *message); ++GBytes *_rest_proxy_send_message (RestProxy *proxy, ++ SoupMessage *message, ++ GCancellable *cancellable, ++ GError **error); ++void _rest_proxy_send_message_async (RestProxy *proxy, ++ SoupMessage *message, ++ GCancellable *cancellable, ++ GAsyncReadyCallback callback, ++ gpointer user_data); ++GInputStream *_rest_proxy_send_message_finish (RestProxy *proxy, ++ GAsyncResult *result, ++ GError **error); + + RestXmlNode *_rest_xml_node_new (void); + void _rest_xml_node_reverse_children_siblings (RestXmlNode *node); +diff --git a/rest/rest-proxy-auth.c b/rest/rest-proxy-auth.c +index b96e443..0b2ec9f 100644 +--- a/rest/rest-proxy-auth.c ++++ b/rest/rest-proxy-auth.c +@@ -29,7 +29,9 @@ + struct _RestProxyAuthPrivate { + /* used to hold state during async authentication */ + RestProxy *proxy; ++#ifdef WITH_SOUP_2 + SoupSession *session; ++#endif + SoupMessage *message; + SoupAuth *auth; + gboolean paused; +@@ -43,7 +45,9 @@ rest_proxy_auth_dispose (GObject *object) + RestProxyAuthPrivate *priv = ((RestProxyAuth*)object)->priv; + + g_clear_object (&priv->proxy); ++#ifdef WITH_SOUP_2 + g_clear_object (&priv->session); ++#endif + g_clear_object (&priv->message); + g_clear_object (&priv->auth); + +@@ -73,13 +77,17 @@ rest_proxy_auth_new (RestProxy *proxy, + RestProxyAuth *rest_auth; + + g_return_val_if_fail (REST_IS_PROXY (proxy), NULL); ++#ifdef WITH_SOUP_2 + g_return_val_if_fail (SOUP_IS_SESSION (session), NULL); ++#endif + g_return_val_if_fail (SOUP_IS_MESSAGE (message), NULL); + g_return_val_if_fail (SOUP_IS_AUTH (soup_auth), NULL); + + rest_auth = REST_PROXY_AUTH (g_object_new (REST_TYPE_PROXY_AUTH, NULL)); + rest_auth->priv->proxy = g_object_ref(proxy); ++#ifdef WITH_SOUP_2 + rest_auth->priv->session = g_object_ref(session); ++#endif + rest_auth->priv->message = g_object_ref(message); + rest_auth->priv->auth = g_object_ref(soup_auth); + +@@ -104,7 +112,9 @@ rest_proxy_auth_pause (RestProxyAuth *auth) + return; + + auth->priv->paused = TRUE; ++#ifdef WITH_SOUP_2 + soup_session_pause_message (auth->priv->session, auth->priv->message); ++#endif + } + + /** +@@ -128,7 +138,9 @@ rest_proxy_auth_unpause (RestProxyAuth *auth) + soup_auth_authenticate (auth->priv->auth, username, password); + g_free (username); + g_free (password); ++#ifdef WITH_SOUP_2 + soup_session_unpause_message (auth->priv->session, auth->priv->message); ++#endif + auth->priv->paused = FALSE; + } + +@@ -146,7 +158,11 @@ rest_proxy_auth_cancel (RestProxyAuth *auth) + { + g_return_if_fail (REST_IS_PROXY_AUTH (auth)); + ++#ifdef WITH_SOUP_2 + soup_session_cancel_message (auth->priv->session, auth->priv->message, SOUP_STATUS_CANCELLED); ++#else ++ soup_auth_cancel (auth->priv->auth); ++#endif + } + + G_GNUC_INTERNAL gboolean rest_proxy_auth_is_paused (RestProxyAuth *auth) +diff --git a/rest/rest-proxy-call.c b/rest/rest-proxy-call.c +index 2ab722f..62b00da 100644 +--- a/rest/rest-proxy-call.c ++++ b/rest/rest-proxy-call.c +@@ -20,12 +20,14 @@ + * + */ + ++#include <config.h> + #include <rest/rest-proxy.h> + #include <rest/rest-proxy-call.h> + #include <rest/rest-params.h> + #include <libsoup/soup.h> + + #include "rest-private.h" ++#include "rest-proxy-auth-private.h" + #include "rest-proxy-call-private.h" + + +@@ -38,12 +40,15 @@ struct _RestProxyCallAsyncClosure { + }; + typedef struct _RestProxyCallAsyncClosure RestProxyCallAsyncClosure; + ++#define READ_BUFFER_SIZE 8192 ++ + struct _RestProxyCallContinuousClosure { + RestProxyCall *call; + RestProxyCallContinuousCallback callback; + GObject *weak_object; + gpointer userdata; + SoupMessage *message; ++ guchar buffer[READ_BUFFER_SIZE]; + }; + typedef struct _RestProxyCallContinuousClosure RestProxyCallContinuousClosure; + +@@ -70,8 +75,7 @@ struct _RestProxyCallPrivate { + gchar *url; + + GHashTable *response_headers; +- goffset length; +- gchar *payload; ++ GBytes *payload; + guint status_code; + gchar *status_message; + +@@ -160,7 +164,7 @@ rest_proxy_call_finalize (GObject *object) + g_free (priv->method); + g_free (priv->function); + +- g_free (priv->payload); ++ g_clear_pointer (&priv->payload, g_bytes_unref); + g_free (priv->status_message); + + g_free (priv->url); +@@ -546,14 +550,23 @@ _populate_headers_hash_table (const gchar *name, + g_hash_table_insert (headers, g_strdup (name), g_strdup (value)); + } + ++#ifdef WITH_SOUP_2 + /* I apologise for this macro, but it saves typing ;-) */ + #define error_helper(x) g_set_error_literal(error, REST_PROXY_ERROR, x, message->reason_phrase) ++#endif + static gboolean + _handle_error_from_message (SoupMessage *message, GError **error) + { +- if (message->status_code < 100) ++ guint status_code; ++ const char *reason_phrase; ++ ++#ifdef WITH_SOUP_2 ++ status_code = message->status_code; ++ ++ if (status_code < 100) + { +- switch (message->status_code) ++ g_clear_error (error); ++ switch (status_code) + { + case SOUP_STATUS_CANCELLED: + error_helper (REST_PROXY_ERROR_CANCELLED); +@@ -580,61 +593,84 @@ _handle_error_from_message (SoupMessage *message, GError **error) + } + return FALSE; + } ++ reason_phrase = message->reason_phrase; ++#else ++ status_code = soup_message_get_status (message); ++ reason_phrase = soup_message_get_reason_phrase (message); ++#endif + +- if (message->status_code >= 200 && message->status_code < 300) ++ if (status_code >= 200 && status_code < 300) + { + return TRUE; + } + ++ if (*error != NULL) ++ return FALSE; ++ + /* If we are here we must be in some kind of HTTP error, lets try */ + g_set_error_literal (error, + REST_PROXY_ERROR, +- message->status_code, +- message->reason_phrase); ++ status_code, ++ reason_phrase); + return FALSE; + } + + static gboolean +-finish_call (RestProxyCall *call, SoupMessage *message, GError **error) ++finish_call (RestProxyCall *call, SoupMessage *message, GBytes *payload, GError **error) + { + RestProxyCallPrivate *priv = GET_PRIVATE (call); ++ SoupMessageHeaders *response_headers; + + g_assert (call); + g_assert (message); ++ g_assert (payload); ++ ++#ifdef WITH_SOUP_2 ++ response_headers = message->response_headers; ++#else ++ response_headers = soup_message_get_response_headers (message); ++#endif + + /* Convert the soup headers in to hash */ + /* FIXME: Eeek..are you allowed duplicate headers? ... */ + g_hash_table_remove_all (priv->response_headers); +- soup_message_headers_foreach (message->response_headers, ++ soup_message_headers_foreach (response_headers, + (SoupMessageHeadersForeachFunc)_populate_headers_hash_table, + priv->response_headers); + +- priv->payload = g_memdup (message->response_body->data, +- message->response_body->length + 1); +- priv->length = message->response_body->length; ++ priv->payload = payload; + ++#ifdef WITH_SOUP_2 + priv->status_code = message->status_code; + priv->status_message = g_strdup (message->reason_phrase); ++#else ++ priv->status_code = soup_message_get_status (message); ++ priv->status_message = g_strdup (soup_message_get_reason_phrase (message)); ++#endif + + return _handle_error_from_message (message, error); + } + + static void +-_continuous_call_message_completed_cb (SoupSession *session, +- SoupMessage *message, +- gpointer userdata) ++_continuous_call_message_completed (SoupMessage *message, ++ GError *error, ++ gpointer userdata) + { + RestProxyCallContinuousClosure *closure; + RestProxyCall *call; + RestProxyCallPrivate *priv; +- GError *error = NULL; + + closure = (RestProxyCallContinuousClosure *)userdata; + call = closure->call; + priv = GET_PRIVATE (call); + ++#ifdef WITH_SOUP_2 + priv->status_code = message->status_code; + priv->status_message = g_strdup (message->reason_phrase); ++#else ++ priv->status_code = soup_message_get_status (message); ++ priv->status_message = g_strdup (soup_message_get_reason_phrase (message)); ++#endif + + _handle_error_from_message (message, &error); + +@@ -657,6 +693,7 @@ _continuous_call_message_completed_cb (SoupSession *session, + + priv->cur_call_closure = NULL; + g_object_unref (closure->call); ++ g_object_unref (message); + g_slice_free (RestProxyCallContinuousClosure, closure); + } + +@@ -715,6 +752,49 @@ set_url (RestProxyCall *call) + return TRUE; + } + ++#ifndef WITH_SOUP_2 ++static gboolean ++authenticate (RestProxyCall *call, ++ SoupAuth *soup_auth, ++ gboolean retrying, ++ SoupMessage *message) ++{ ++ RestProxyCallPrivate *priv = GET_PRIVATE (call); ++ RestProxyAuth *rest_auth; ++ gboolean try_auth; ++ ++ rest_auth = rest_proxy_auth_new (priv->proxy, NULL, message, soup_auth); ++ g_signal_emit_by_name (priv->proxy, "authenticate", rest_auth, retrying, &try_auth); ++ if (try_auth && !rest_proxy_auth_is_paused (rest_auth)) { ++ char *username, *password; ++ ++ g_object_get (priv->proxy, "username", &username, "password", &password, NULL); ++ soup_auth_authenticate (soup_auth, username, password); ++ g_free (username); ++ g_free (password); ++ } ++ g_object_unref (rest_auth); ++ ++ return try_auth; ++} ++ ++static gboolean ++accept_certificate (RestProxyCall *call, ++ GTlsCertificate *tls_certificate, ++ GTlsCertificateFlags *tls_errors, ++ SoupMessage *message) ++{ ++ RestProxyCallPrivate *priv = GET_PRIVATE (call); ++ gboolean ssl_strict; ++ ++ if (tls_errors == 0) ++ return TRUE; ++ ++ g_object_get (priv->proxy, "ssl-strict", &ssl_strict, NULL); ++ return !ssl_strict; ++} ++#endif ++ + static SoupMessage * + prepare_message (RestProxyCall *call, GError **error_out) + { +@@ -722,6 +802,7 @@ prepare_message (RestProxyCall *call, GError **error_out) + RestProxyCallClass *call_class; + const gchar *user_agent; + SoupMessage *message; ++ SoupMessageHeaders *request_headers; + GError *error = NULL; + + call_class = REST_PROXY_CALL_GET_CLASS (call); +@@ -748,6 +829,9 @@ prepare_message (RestProxyCall *call, GError **error_out) + gchar *content; + gchar *content_type; + gsize content_len; ++#ifndef WITH_SOUP_2 ++ GBytes *body; ++#endif + + if (!call_class->serialize_params (call, &content_type, + &content, &content_len, &error)) +@@ -780,8 +864,14 @@ prepare_message (RestProxyCall *call, GError **error_out) + "Could not parse URI"); + return NULL; + } ++#ifdef WITH_SOUP_2 + soup_message_set_request (message, content_type, + SOUP_MEMORY_TAKE, content, content_len); ++#else ++ body = g_bytes_new_take (content, content_len); ++ soup_message_set_request_body_from_bytes (message, content_type, body); ++ g_bytes_unref (body); ++#endif + + g_free (content_type); + } else if (rest_params_are_strings (priv->params)) { +@@ -798,9 +888,15 @@ prepare_message (RestProxyCall *call, GError **error_out) + + hash = rest_params_as_string_hash_table (priv->params); + ++#ifdef WITH_SOUP_2 + message = soup_form_request_new_from_hash (priv->method, + priv->url, + hash); ++#else ++ message = soup_message_new_from_encoded_form (priv->method, ++ priv->url, ++ soup_form_encode_hash (hash)); ++#endif + + g_hash_table_unref (hash); + +@@ -827,19 +923,28 @@ prepare_message (RestProxyCall *call, GError **error_out) + if (rest_param_is_string (param)) { + soup_multipart_append_form_string (mp, name, rest_param_get_content (param)); + } else { +- SoupBuffer *sb; +- +- sb = soup_buffer_new_with_owner (rest_param_get_content (param), +- rest_param_get_content_length (param), +- rest_param_ref (param), +- (GDestroyNotify)rest_param_unref); ++#ifdef WITH_SOUP_2 ++ SoupBuffer *sb = soup_buffer_new_with_owner (rest_param_get_content (param), ++ rest_param_get_content_length (param), ++ rest_param_ref (param), ++ (GDestroyNotify)rest_param_unref); ++#else ++ GBytes *sb = g_bytes_new_with_free_func (rest_param_get_content (param), ++ rest_param_get_content_length (param), ++ (GDestroyNotify)rest_param_unref, ++ rest_param_ref (param)); ++#endif + + soup_multipart_append_form_file (mp, name, + rest_param_get_file_name (param), + rest_param_get_content_type (param), + sb); + ++#ifdef WITH_SOUP_2 + soup_buffer_free (sb); ++#else ++ g_bytes_unref (sb); ++#endif + } + } + +@@ -853,19 +958,36 @@ prepare_message (RestProxyCall *call, GError **error_out) + return NULL; + } + ++#ifdef WITH_SOUP_2 + message = soup_form_request_new_from_multipart (priv->url, mp); ++#else ++ message = soup_message_new_from_multipart (priv->url, mp); ++#endif + + soup_multipart_free (mp); + } + ++#ifdef WITH_SOUP_2 ++ request_headers = message->request_headers; ++#else ++ request_headers = soup_message_get_request_headers (message); ++ g_signal_connect_swapped (message, "authenticate", ++ G_CALLBACK (authenticate), ++ call); ++ g_signal_connect_swapped (message, "accept-certificate", ++ G_CALLBACK (accept_certificate), ++ call); ++#endif ++ ++ + /* Set the user agent, if one was set in the proxy */ + user_agent = rest_proxy_get_user_agent (priv->proxy); + if (user_agent) { +- soup_message_headers_append (message->request_headers, "User-Agent", user_agent); ++ soup_message_headers_append (request_headers, "User-Agent", user_agent); + } + + /* Set the headers */ +- g_hash_table_foreach (priv->headers, set_header, message->request_headers); ++ g_hash_table_foreach (priv->headers, set_header, request_headers); + + return message; + } +@@ -878,17 +1000,17 @@ _call_message_call_cancelled_cb (GCancellable *cancellable, + } + + static void +-_call_message_call_completed_cb (SoupSession *session, +- SoupMessage *message, ++_call_message_call_completed_cb (SoupMessage *message, ++ GBytes *payload, ++ GError *error, + gpointer user_data) + { + GTask *task = user_data; + RestProxyCall *call; +- GError *error = NULL; + + call = REST_PROXY_CALL (g_task_get_source_object (task)); + +- finish_call (call, message, &error); ++ finish_call (call, message, payload, &error); + + if (error != NULL) + g_task_return_error (task, error); +@@ -938,6 +1060,7 @@ rest_proxy_call_invoke_async (RestProxyCall *call, + + _rest_proxy_queue_message (priv->proxy, + message, ++ priv->cancellable, + _call_message_call_completed_cb, + task); + } +@@ -962,16 +1085,55 @@ rest_proxy_call_invoke_finish (RestProxyCall *call, + } + + static void +-_continuous_call_message_got_chunk_cb (SoupMessage *msg, +- SoupBuffer *chunk, +- RestProxyCallContinuousClosure *closure) ++_continuous_call_read_cb (GObject *source, ++ GAsyncResult *result, ++ gpointer user_data) + { ++ GInputStream *stream = G_INPUT_STREAM (source); ++ RestProxyCallContinuousClosure *closure = user_data; ++ RestProxyCallPrivate *priv = GET_PRIVATE (closure->call); ++ gssize bytes_read; ++ GError *error = NULL; ++ ++ bytes_read = g_input_stream_read_finish (stream, result, &error); ++ if (bytes_read <= 0) ++ { ++ _continuous_call_message_completed (closure->message, error, user_data); ++ return; ++ } ++ + closure->callback (closure->call, +- chunk->data, +- chunk->length, ++ (gconstpointer)closure->buffer, ++ bytes_read, + NULL, + closure->weak_object, + closure->userdata); ++ ++ g_input_stream_read_async (stream, closure->buffer, READ_BUFFER_SIZE, G_PRIORITY_DEFAULT, ++ priv->cancellable, _continuous_call_read_cb, closure); ++} ++ ++static void ++_continuous_call_message_sent_cb (GObject *source, ++ GAsyncResult *result, ++ gpointer user_data) ++{ ++ RestProxy *proxy = REST_PROXY (source); ++ RestProxyCallContinuousClosure *closure = user_data; ++ RestProxyCallPrivate *priv = GET_PRIVATE (closure->call); ++ GInputStream *stream; ++ GError *error = NULL; ++ ++ stream = _rest_proxy_send_message_finish (proxy, result, &error); ++ if (!stream) ++ { ++ _continuous_call_message_completed (closure->message, error, user_data); ++ return; ++ } ++ ++ g_input_stream_read_async (stream, closure->buffer, READ_BUFFER_SIZE, G_PRIORITY_DEFAULT, ++ priv->cancellable, _continuous_call_read_cb, closure); ++ g_object_unref (stream); + } + + +@@ -1021,9 +1183,6 @@ rest_proxy_call_continuous (RestProxyCall *call, + if (message == NULL) + return FALSE; + +- /* Must turn off accumulation */ +- soup_message_body_set_accumulate (message->response_body, FALSE); +- + closure = g_slice_new0 (RestProxyCallContinuousClosure); + closure->call = g_object_ref (call); + closure->callback = callback; +@@ -1041,33 +1200,29 @@ rest_proxy_call_continuous (RestProxyCall *call, + closure); + } + +- g_signal_connect (message, +- "got-chunk", +- (GCallback)_continuous_call_message_got_chunk_cb, +- closure); +- +- _rest_proxy_queue_message (priv->proxy, +- message, +- _continuous_call_message_completed_cb, +- closure); ++ _rest_proxy_send_message_async (priv->proxy, ++ message, ++ priv->cancellable, ++ _continuous_call_message_sent_cb, ++ closure); + return TRUE; + } + + static void +-_upload_call_message_completed_cb (SoupSession *session, +- SoupMessage *message, ++_upload_call_message_completed_cb (SoupMessage *message, ++ GBytes *payload, ++ GError *error, + gpointer user_data) + { + RestProxyCall *call; + RestProxyCallPrivate *priv; +- GError *error = NULL; + RestProxyCallUploadClosure *closure; + + closure = (RestProxyCallUploadClosure *) user_data; + call = closure->call; + priv = GET_PRIVATE (call); + +- finish_call (call, message, &error); ++ finish_call (call, message, payload, &error); + + closure->callback (closure->call, + closure->uploaded, +@@ -1093,14 +1248,25 @@ _upload_call_message_completed_cb (SoupSession *session, + + static void + _upload_call_message_wrote_data_cb (SoupMessage *msg, ++#ifdef WITH_SOUP_2 + SoupBuffer *chunk, ++#else ++ gsize chunk_size, ++#endif + RestProxyCallUploadClosure *closure) + { +- closure->uploaded = closure->uploaded + chunk->length; ++#ifdef WITH_SOUP_2 ++ gsize chunk_size = chunk->length; ++ goffset content_length = msg->request_body->length; ++#else ++ goffset content_length = soup_message_headers_get_content_length (soup_message_get_request_headers (msg)); ++#endif + +- if (closure->uploaded < msg->request_body->length) ++ closure->uploaded = closure->uploaded + chunk_size; ++ ++ if (closure->uploaded < content_length) + closure->callback (closure->call, +- msg->request_body->length, ++ content_length, + closure->uploaded, + NULL, + closure->weak_object, +@@ -1178,6 +1344,7 @@ rest_proxy_call_upload (RestProxyCall *call, + + _rest_proxy_queue_message (priv->proxy, + message, ++ priv->cancellable, + _upload_call_message_completed_cb, + closure); + return TRUE; +@@ -1206,6 +1373,10 @@ rest_proxy_call_cancel (RestProxyCall *call) + if (priv->cancellable) + { + g_signal_handler_disconnect (priv->cancellable, priv->cancel_sig); ++#ifndef WITH_SOUP_2 ++ if (!g_cancellable_is_cancelled (priv->cancellable)) ++ g_cancellable_cancel (priv->cancellable); ++#endif + g_clear_object (&priv->cancellable); + } + +@@ -1240,6 +1411,7 @@ rest_proxy_call_sync (RestProxyCall *call, + RestProxyCallPrivate *priv = GET_PRIVATE (call); + SoupMessage *message; + gboolean ret; ++ GBytes *payload; + + g_return_val_if_fail (REST_IS_PROXY_CALL (call), FALSE); + +@@ -1247,9 +1419,9 @@ rest_proxy_call_sync (RestProxyCall *call, + if (!message) + return FALSE; + +- _rest_proxy_send_message (priv->proxy, message); ++ payload = _rest_proxy_send_message (priv->proxy, message, priv->cancellable, error_out); + +- ret = finish_call (call, message, error_out); ++ ret = finish_call (call, message, payload, error_out); + + g_object_unref (message); + +@@ -1314,9 +1486,16 @@ rest_proxy_call_get_response_headers (RestProxyCall *call) + goffset + rest_proxy_call_get_payload_length (RestProxyCall *call) + { ++ GBytes *payload; ++ + g_return_val_if_fail (REST_IS_PROXY_CALL (call), 0); + +- return GET_PRIVATE (call)->length; ++ payload = GET_PRIVATE (call)->payload; ++#ifdef WITH_SOUP_2 ++ return payload ? g_bytes_get_size (payload) - 1 : 0; ++#else ++ return payload ? g_bytes_get_size (payload) : 0; ++#endif + } + + /** +@@ -1331,9 +1510,12 @@ rest_proxy_call_get_payload_length (RestProxyCall *call) + const gchar * + rest_proxy_call_get_payload (RestProxyCall *call) + { ++ GBytes *payload; ++ + g_return_val_if_fail (REST_IS_PROXY_CALL (call), NULL); + +- return GET_PRIVATE (call)->payload; ++ payload = GET_PRIVATE (call)->payload; ++ return payload ? g_bytes_get_data (payload, NULL) : NULL; + } + + /** +diff --git a/rest/rest-proxy.c b/rest/rest-proxy.c +index 80972a3..171f6cb 100644 +--- a/rest/rest-proxy.c ++++ b/rest/rest-proxy.c +@@ -45,6 +45,9 @@ struct _RestProxyPrivate { + SoupSession *session; + gboolean disable_cookies; + char *ssl_ca_file; ++#ifndef WITH_SOUP_2 ++ gboolean ssl_strict; ++#endif + }; + + +@@ -116,11 +119,15 @@ rest_proxy_get_property (GObject *object, + g_value_set_string (value, priv->password); + break; + case PROP_SSL_STRICT: { ++#ifdef WITH_SOUP_2 + gboolean ssl_strict; + g_object_get (G_OBJECT(priv->session), + "ssl-strict", &ssl_strict, + NULL); + g_value_set_boolean (value, ssl_strict); ++#else ++ g_value_set_boolean (value, priv->ssl_strict); ++#endif + break; + } + case PROP_SSL_CA_FILE: +@@ -172,9 +179,13 @@ rest_proxy_set_property (GObject *object, + priv->password = g_value_dup_string (value); + break; + case PROP_SSL_STRICT: ++#ifdef WITH_SOUP_2 + g_object_set (G_OBJECT(priv->session), + "ssl-strict", g_value_get_boolean (value), + NULL); ++#else ++ priv->ssl_strict = g_value_get_boolean (value); ++#endif + break; + case PROP_SSL_CA_FILE: + g_free(priv->ssl_ca_file); +@@ -207,6 +218,7 @@ default_authenticate_cb (RestProxy *self, + return !retrying; + } + ++#ifdef WITH_SOUP_2 + static void + authenticate (RestProxy *self, + SoupMessage *msg, +@@ -224,6 +236,7 @@ authenticate (RestProxy *self, + soup_auth_authenticate (soup_auth, priv->username, priv->password); + g_object_unref (G_OBJECT (rest_auth)); + } ++#endif + + static void + rest_proxy_constructed (GObject *object) +@@ -238,14 +251,20 @@ rest_proxy_constructed (GObject *object) + } + + if (REST_DEBUG_ENABLED(PROXY)) { ++#ifdef WITH_SOUP_2 + SoupSessionFeature *logger = (SoupSessionFeature*)soup_logger_new (SOUP_LOGGER_LOG_BODY, 0); ++#else ++ SoupSessionFeature *logger = (SoupSessionFeature*)soup_logger_new (SOUP_LOGGER_LOG_HEADERS); ++#endif + soup_session_add_feature (priv->session, logger); + g_object_unref (logger); + } + ++#ifdef WITH_SOUP_2 + /* session lifetime is same as self, no need to keep signalid */ + g_signal_connect_swapped (priv->session, "authenticate", + G_CALLBACK(authenticate), object); ++#endif + } + + static void +@@ -391,23 +410,62 @@ rest_proxy_class_init (RestProxyClass *klass) + proxy_class->authenticate = default_authenticate_cb; + } + ++static gboolean ++transform_ssl_ca_file_to_tls_database (GBinding *binding, ++ const GValue *from_value, ++ GValue *to_value, ++ gpointer user_data) ++{ ++ g_value_take_object (to_value, ++ g_tls_file_database_new (g_value_get_string (from_value), NULL)); ++ return TRUE; ++} ++ ++static gboolean ++transform_tls_database_to_ssl_ca_file (GBinding *binding, ++ const GValue *from_value, ++ GValue *to_value, ++ gpointer user_data) ++{ ++ GTlsDatabase *tls_database; ++ char *path = NULL; ++ ++ tls_database = g_value_get_object (from_value); ++ if (tls_database) ++ g_object_get (tls_database, "anchors", &path, NULL); ++ g_value_take_string (to_value, path); ++ return TRUE; ++} ++ + static void + rest_proxy_init (RestProxy *self) + { + RestProxyPrivate *priv = GET_PRIVATE (self); ++ GTlsDatabase *tls_database; ++ ++#ifndef WITH_SOUP_2 ++ priv->ssl_strict = TRUE; ++#endif + + priv->session = soup_session_new (); + + #ifdef REST_SYSTEM_CA_FILE + /* with ssl-strict (defaults TRUE) setting ssl-ca-file forces all + * certificates to be trusted */ +- g_object_set (priv->session, +- "ssl-ca-file", REST_SYSTEM_CA_FILE, +- NULL); ++ tls_database = g_tls_file_database_new (REST_SYSTEM_CA_FILE, NULL); ++ if (tls_database) { ++ g_object_set (priv->session, ++ "tls-database", tls_database, ++ NULL); ++ g_object_unref (tls_database); ++ } + #endif +- g_object_bind_property (self, "ssl-ca-file", +- priv->session, "ssl-ca-file", +- G_BINDING_BIDIRECTIONAL); ++ g_object_bind_property_full (self, "ssl-ca-file", ++ priv->session, "tls-database", ++ G_BINDING_BIDIRECTIONAL, ++ transform_ssl_ca_file_to_tls_database, ++ transform_tls_database_to_ssl_ca_file, ++ NULL, NULL); + } + + /** +@@ -689,27 +747,127 @@ rest_proxy_simple_run (RestProxy *proxy, + return ret; + } + ++typedef struct { ++ RestMessageFinishedCallback callback; ++ gpointer user_data; ++} RestMessageQueueData; ++ ++#ifdef WITH_SOUP_2 ++static void ++message_finished_cb (SoupSession *session, ++ SoupMessage *message, ++ gpointer user_data) ++{ ++ RestMessageQueueData *data = user_data; ++ GBytes *body; ++ GError *error = NULL; ++ ++ body = g_bytes_new (message->response_body->data, ++ message->response_body->length + 1); ++ data->callback (message, body, error, data->user_data); ++ g_free (data); ++} ++#else ++static void ++message_send_and_read_ready_cb (GObject *source, ++ GAsyncResult *result, ++ gpointer user_data) ++{ ++ SoupSession *session = SOUP_SESSION (source); ++ RestMessageQueueData *data = user_data; ++ GBytes *body; ++ GError *error = NULL; ++ ++ body = soup_session_send_and_read_finish (session, result, &error); ++ data->callback (soup_session_get_async_result_message (session, result), body, error, data->user_data); ++ g_free (data); ++} ++#endif ++ + void +-_rest_proxy_queue_message (RestProxy *proxy, +- SoupMessage *message, +- SoupSessionCallback callback, +- gpointer user_data) ++_rest_proxy_queue_message (RestProxy *proxy, ++ SoupMessage *message, ++ GCancellable *cancellable, ++ RestMessageFinishedCallback callback, ++ gpointer user_data) + { + RestProxyPrivate *priv = GET_PRIVATE (proxy); ++ RestMessageQueueData *data; + + g_return_if_fail (REST_IS_PROXY (proxy)); + g_return_if_fail (SOUP_IS_MESSAGE (message)); + ++ data = g_new0 (RestMessageQueueData, 1); ++ data->callback = callback; ++ data->user_data = user_data; ++ ++#ifdef WITH_SOUP_2 + soup_session_queue_message (priv->session, + message, +- callback, +- user_data); ++ message_finished_cb, ++ data); ++#else ++ soup_session_send_and_read_async (priv->session, ++ message, ++ G_PRIORITY_DEFAULT, ++ cancellable, ++ message_send_and_read_ready_cb, ++ data); ++#endif ++} ++ ++static void ++message_send_ready_cb (GObject *source, ++ GAsyncResult *result, ++ gpointer user_data) ++{ ++ SoupSession *session = SOUP_SESSION (source); ++ GTask *task = user_data; ++ GInputStream *stream; ++ GError *error = NULL; ++ ++ stream = soup_session_send_finish (session, result, &error); ++ if (stream) ++ g_task_return_pointer (task, stream, g_object_unref); ++ else ++ g_task_return_error (task, error); ++ g_object_unref (task); ++} ++ ++void ++_rest_proxy_send_message_async (RestProxy *proxy, ++ SoupMessage *message, ++ GCancellable *cancellable, ++ GAsyncReadyCallback callback, ++ gpointer user_data) ++{ ++ RestProxyPrivate *priv = GET_PRIVATE (proxy); ++ GTask *task; ++ ++ task = g_task_new (proxy, cancellable, callback, user_data); ++ soup_session_send_async (priv->session, ++ message, ++#ifndef WITH_SOUP_2 ++ G_PRIORITY_DEFAULT, ++#endif ++ cancellable, ++ message_send_ready_cb, ++ task); ++} ++ ++GInputStream * ++_rest_proxy_send_message_finish (RestProxy *proxy, ++ GAsyncResult *result, ++ GError **error) ++{ ++ return g_task_propagate_pointer (G_TASK (result), error); + } + + void + _rest_proxy_cancel_message (RestProxy *proxy, + SoupMessage *message) + { ++#ifdef WITH_SOUP_2 + RestProxyPrivate *priv = GET_PRIVATE (proxy); + + g_return_if_fail (REST_IS_PROXY (proxy)); +@@ -718,16 +876,31 @@ _rest_proxy_cancel_message (RestProxy *proxy, + soup_session_cancel_message (priv->session, + message, + SOUP_STATUS_CANCELLED); ++#endif + } + +-guint +-_rest_proxy_send_message (RestProxy *proxy, +- SoupMessage *message) ++GBytes * ++_rest_proxy_send_message (RestProxy *proxy, ++ SoupMessage *message, ++ GCancellable *cancellable, ++ GError **error) + { + RestProxyPrivate *priv = GET_PRIVATE (proxy); ++ GBytes *body; + +- g_return_val_if_fail (REST_IS_PROXY (proxy), 0); +- g_return_val_if_fail (SOUP_IS_MESSAGE (message), 0); ++ g_return_val_if_fail (REST_IS_PROXY (proxy), NULL); ++ g_return_val_if_fail (SOUP_IS_MESSAGE (message), NULL); ++ ++#ifdef WITH_SOUP_2 ++ soup_session_send_message (priv->session, message); ++ body = g_bytes_new (message->response_body->data, ++ message->response_body->length + 1); ++#else ++ body = soup_session_send_and_read (priv->session, ++ message, ++ cancellable, ++ error); ++#endif + +- return soup_session_send_message (priv->session, message); ++ return body; + } +diff --git a/tests/custom-serialize.c b/tests/custom-serialize.c +index c3fde93..01b3a56 100644 +--- a/tests/custom-serialize.c ++++ b/tests/custom-serialize.c +@@ -88,22 +88,40 @@ custom_proxy_call_init (CustomProxyCall *self) + } + + static void ++#ifdef WITH_SOUP_2 + server_callback (SoupServer *server, SoupMessage *msg, + const char *path, GHashTable *query, + SoupClientContext *client, gpointer user_data) ++#else ++server_callback (SoupServer *server, SoupServerMessage *msg, ++ const char *path, GHashTable *query, gpointer user_data) ++#endif + { + if (g_str_equal (path, "/ping")) { + const char *content_type = NULL; ++#ifdef WITH_SOUP_2 + SoupMessageHeaders *headers = msg->request_headers; + SoupMessageBody *body = msg->request_body; ++#else ++ SoupMessageHeaders *headers = soup_server_message_get_request_headers (msg); ++ SoupMessageBody *body = soup_server_message_get_request_body (msg); ++#endif + content_type = soup_message_headers_get_content_type (headers, NULL); + g_assert_cmpstr (content_type, ==, "application/json"); + + g_assert_cmpstr (body->data, ==, "{}"); + ++#ifdef WITH_SOUP_2 + soup_message_set_status (msg, SOUP_STATUS_OK); ++#else ++ soup_server_message_set_status (msg, SOUP_STATUS_OK, NULL); ++#endif + } else { ++#ifdef WITH_SOUP_2 + soup_message_set_status (msg, SOUP_STATUS_NOT_IMPLEMENTED); ++#else ++ soup_server_message_set_status (msg, SOUP_STATUS_NOT_IMPLEMENTED, NULL); ++#endif + } + } + +diff --git a/tests/proxy-continuous.c b/tests/proxy-continuous.c +index 8f4b7a8..7967bbd 100644 +--- a/tests/proxy-continuous.c ++++ b/tests/proxy-continuous.c +@@ -39,9 +39,15 @@ static SoupServer *server; + static gboolean + send_chunks (gpointer user_data) + { +- SoupMessage *msg = SOUP_MESSAGE (user_data); + guint i; + guint8 data[SIZE_CHUNK]; ++#ifdef WITH_SOUP_2 ++ SoupMessage *msg = SOUP_MESSAGE (user_data); ++ SoupMessageBody *response_body = msg->response_body; ++#else ++ SoupServerMessage *msg = SOUP_SERVER_MESSAGE (user_data); ++ SoupMessageBody *response_body = soup_server_message_get_response_body (msg); ++#endif + + for (i = 0; i < SIZE_CHUNK; i++) + { +@@ -49,12 +55,12 @@ send_chunks (gpointer user_data) + server_count++; + } + +- soup_message_body_append (msg->response_body, SOUP_MEMORY_COPY, data, SIZE_CHUNK); ++ soup_message_body_append (response_body, SOUP_MEMORY_COPY, data, SIZE_CHUNK); + soup_server_unpause_message (server, msg); + + if (server_count == NUM_CHUNKS * SIZE_CHUNK) + { +- soup_message_body_complete (msg->response_body); ++ soup_message_body_complete (response_body); + return FALSE; + } else { + return TRUE; +@@ -62,13 +68,28 @@ send_chunks (gpointer user_data) + } + + static void ++#ifdef WITH_SOUP_2 + server_callback (SoupServer *server, SoupMessage *msg, + const char *path, GHashTable *query, + SoupClientContext *client, gpointer user_data) ++#else ++server_callback (SoupServer *server, SoupServerMessage *msg, ++ const char *path, GHashTable *query, gpointer user_data) ++#endif + { ++#ifdef WITH_SOUP_2 ++ SoupMessageHeaders *response_headers = msg->response_headers; ++#else ++ SoupMessageHeaders *response_headers = soup_server_message_get_response_headers (msg); ++#endif ++ + g_assert_cmpstr (path, ==, "/stream"); ++#ifdef WITH_SOUP_2 + soup_message_set_status (msg, SOUP_STATUS_OK); +- soup_message_headers_set_encoding (msg->response_headers, ++#else ++ soup_server_message_set_status (msg, SOUP_STATUS_OK, NULL); ++#endif ++ soup_message_headers_set_encoding (response_headers, + SOUP_ENCODING_CHUNKED); + soup_server_pause_message (server, msg); + +@@ -142,13 +163,21 @@ continuous () + uris = soup_server_get_uris (server); + g_assert (g_slist_length (uris) > 0); + ++#ifdef WITH_SOUP_2 + url = soup_uri_to_string (uris->data, FALSE); ++#else ++ url = g_uri_to_string (uris->data); ++#endif + + loop = g_main_loop_new (NULL, FALSE); + + proxy = rest_proxy_new (url, FALSE); + stream_test (proxy); ++#ifdef WITH_SOUP_2 + g_slist_free_full (uris, (GDestroyNotify)soup_uri_free); ++#else ++ g_slist_free_full (uris, (GDestroyNotify)g_uri_unref); ++#endif + + g_main_loop_run (loop); + g_free (url); +diff --git a/tests/proxy.c b/tests/proxy.c +index 89a9325..652c600 100644 +--- a/tests/proxy.c ++++ b/tests/proxy.c +@@ -49,20 +49,35 @@ SoupServer *server; + GMainLoop *server_loop; + + static void ++#ifdef WITH_SOUP_2 + server_callback (SoupServer *server, SoupMessage *msg, + const char *path, GHashTable *query, + SoupClientContext *client, gpointer user_data) ++#else ++server_callback (SoupServer *server, SoupServerMessage *msg, ++ const char *path, GHashTable *query, gpointer user_data) ++#endif + { + if (g_str_equal (path, "/ping")) { ++#ifdef WITH_SOUP_2 + soup_message_set_status (msg, SOUP_STATUS_OK); ++#else ++ soup_server_message_set_status (msg, SOUP_STATUS_OK, NULL); ++#endif + } + else if (g_str_equal (path, "/echo")) { + const char *value; + + value = g_hash_table_lookup (query, "value"); ++#ifdef WITH_SOUP_2 + soup_message_set_response (msg, "text/plain", SOUP_MEMORY_COPY, + value, strlen (value)); + soup_message_set_status (msg, SOUP_STATUS_OK); ++#else ++ soup_server_message_set_response (msg, "text/plain", SOUP_MEMORY_COPY, ++ value, strlen (value)); ++ soup_server_message_set_status (msg, SOUP_STATUS_OK, NULL); ++#endif + } + else if (g_str_equal (path, "/reverse")) { + char *value; +@@ -70,9 +85,15 @@ server_callback (SoupServer *server, SoupMessage *msg, + value = g_strdup (g_hash_table_lookup (query, "value")); + g_strreverse (value); + ++#ifdef WITH_SOUP_2 + soup_message_set_response (msg, "text/plain", SOUP_MEMORY_TAKE, + value, strlen (value)); + soup_message_set_status (msg, SOUP_STATUS_OK); ++#else ++ soup_server_message_set_response (msg, "text/plain", SOUP_MEMORY_TAKE, ++ value, strlen (value)); ++ soup_server_message_set_status (msg, SOUP_STATUS_OK, NULL); ++#endif + } + else if (g_str_equal (path, "/status")) { + const char *value; +@@ -81,25 +102,61 @@ server_callback (SoupServer *server, SoupMessage *msg, + value = g_hash_table_lookup (query, "status"); + if (value) { + status = atoi (value); ++#ifdef WITH_SOUP_2 + soup_message_set_status (msg, status ?: SOUP_STATUS_INTERNAL_SERVER_ERROR); ++#else ++ soup_server_message_set_status (msg, status ?: SOUP_STATUS_INTERNAL_SERVER_ERROR, NULL); ++#endif + } else { ++#ifdef WITH_SOUP_2 + soup_message_set_status (msg, SOUP_STATUS_INTERNAL_SERVER_ERROR); ++#else ++ soup_server_message_set_status (msg, SOUP_STATUS_INTERNAL_SERVER_ERROR, NULL); ++#endif + } + } + else if (g_str_equal (path, "/useragent/none")) { +- if (soup_message_headers_get (msg->request_headers, "User-Agent") == NULL) { ++#ifdef WITH_SOUP_2 ++ SoupMessageHeaders *request_headers = msg->request_headers; ++#else ++ SoupMessageHeaders *request_headers = soup_server_message_get_request_headers (msg); ++#endif ++ ++ if (soup_message_headers_get (request_headers, "User-Agent") == NULL) { ++#ifdef WITH_SOUP_2 + soup_message_set_status (msg, SOUP_STATUS_OK); ++#else ++ soup_server_message_set_status (msg, SOUP_STATUS_OK, NULL); ++#endif + } else { ++#ifdef WITH_SOUP_2 + soup_message_set_status (msg, SOUP_STATUS_EXPECTATION_FAILED); ++#else ++ soup_server_message_set_status (msg, SOUP_STATUS_EXPECTATION_FAILED, NULL); ++#endif + } + } + else if (g_str_equal (path, "/useragent/testsuite")) { ++#ifdef WITH_SOUP_2 ++ SoupMessageHeaders *request_headers = msg->request_headers; ++#else ++ SoupMessageHeaders *request_headers = soup_server_message_get_request_headers (msg); ++#endif + const char *value; +- value = soup_message_headers_get (msg->request_headers, "User-Agent"); ++ value = soup_message_headers_get (request_headers, "User-Agent"); + if (g_strcmp0 (value, "TestSuite-1.0") == 0) { ++#ifdef WITH_SOUP_2 + soup_message_set_status (msg, SOUP_STATUS_OK); ++#else ++ soup_server_message_set_status (msg, SOUP_STATUS_OK, NULL); ++#endif + } else { ++#ifdef WITH_SOUP_2 + soup_message_set_status (msg, SOUP_STATUS_EXPECTATION_FAILED); ++#else ++ soup_server_message_set_status (msg, SOUP_STATUS_EXPECTATION_FAILED, NULL); ++#endif ++ + } + } + } +@@ -325,7 +382,7 @@ main (int argc, char **argv) + char *url; + RestProxy *proxy; + +- server = soup_server_new ("", NULL); ++ server = soup_server_new (NULL); + g_thread_new ("Server Thread", server_thread_func, NULL); + + url = g_strdup_printf ("http://127.0.0.1:%d/", PORT); +diff --git a/tests/threaded.c b/tests/threaded.c +index a251900..411361c 100644 +--- a/tests/threaded.c ++++ b/tests/threaded.c +@@ -36,13 +36,22 @@ GMainLoop *main_loop; + SoupServer *server; + + static void ++#ifdef WITH_SOUP_2 + server_callback (SoupServer *server, SoupMessage *msg, + const char *path, GHashTable *query, + SoupClientContext *client, gpointer user_data) ++#else ++server_callback (SoupServer *server, SoupServerMessage *msg, ++ const char *path, GHashTable *query, gpointer user_data) ++#endif + { + g_assert_cmpstr (path, ==, "/ping"); + ++#ifdef WITH_SOUP_2 + soup_message_set_status (msg, SOUP_STATUS_OK); ++#else ++ soup_server_message_set_status (msg, SOUP_STATUS_OK, NULL); ++#endif + g_atomic_int_add (&threads_done, 1); + + if (threads_done == N_THREADS) { +@@ -96,7 +105,11 @@ static void ping () + uris = soup_server_get_uris (server); + g_assert (g_slist_length (uris) > 0); + ++#ifdef WITH_SOUP_2 + url = soup_uri_to_string (uris->data, FALSE); ++#else ++ url = g_uri_to_string (uris->data); ++#endif + + main_loop = g_main_loop_new (NULL, TRUE); + +@@ -109,7 +122,11 @@ static void ping () + g_main_loop_run (main_loop); + + g_free (url); ++#ifdef WITH_SOUP_2 + g_slist_free_full (uris, (GDestroyNotify)soup_uri_free); ++#else ++ g_slist_free_full (uris, (GDestroyNotify)g_uri_unref); ++#endif + g_object_unref (server); + g_main_loop_unref (main_loop); + } +-- +2.33.1 + diff --git a/meta-openembedded/meta-gnome/recipes-gnome/rest/rest_0.8.1.bb b/meta-openembedded/meta-gnome/recipes-gnome/rest/rest_0.8.1.bb index 47e3f8dbbf..545224a99e 100644 --- a/meta-openembedded/meta-gnome/recipes-gnome/rest/rest_0.8.1.bb +++ b/meta-openembedded/meta-gnome/recipes-gnome/rest/rest_0.8.1.bb @@ -14,13 +14,13 @@ DEPENDS = " \ inherit gnomebase gobject-introspection gtk-doc vala -SRC_URI[archive.md5sum] = "ece4547298a81105f307369d73c21b9d" -SRC_URI[archive.sha256sum] = "0513aad38e5d3cedd4ae3c551634e3be1b9baaa79775e53b2dba9456f15b01c9" - -# * gnome environment requires libsoup build with in gnome PACKAGECONFIG -# * libsoup-gnome support was removed upstream three years ago [1] -# [1] https://gitlab.gnome.org/GNOME/librest/commit/8f904a8e2bb38a7bf72245cdf2f1ecad17e9a720 -EXTRA_OECONF = "--without-gnome" +PV .= "+git${SRCPV}" +SRCREV = "7b46065dea860ef09861f4d70124728b8270c8b7" +SRC_URI = "git://gitlab.gnome.org/GNOME/librest;protocol=https;branch=master \ + file://0001-Use-GUri-instead-of-SoupURI.patch \ + file://0002-Port-to-libsoup3.patch \ +" +S = "${WORKDIR}/git" do_configure:prepend() { # rest expects introspection.m4 at custom location (see aclocal.m4). diff --git a/meta-openembedded/meta-gnome/recipes-gnome/yelp/yelp-tools_40.0.bb b/meta-openembedded/meta-gnome/recipes-gnome/yelp/yelp-tools_41.0.bb index 0e7f499bc0..ec8edb80d3 100644 --- a/meta-openembedded/meta-gnome/recipes-gnome/yelp/yelp-tools_40.0.bb +++ b/meta-openembedded/meta-gnome/recipes-gnome/yelp/yelp-tools_41.0.bb @@ -16,7 +16,7 @@ DEPENDS += " \ yelp-xsl \ " -SRC_URI[archive.sha256sum] = "664bacf2f3dd65ef00a43f79487351ab64a6c4c629c56ac0ceb1723c2eb66aae" +SRC_URI[archive.sha256sum] = "37f1acc02bcbe68a31b86e07c129a839bd3276e656dc89eb7fc0a92746eff272" RDEPENDS:${PN} += "python3-core yelp-xsl" diff --git a/meta-openembedded/meta-gnome/recipes-gnome/yelp/yelp-xsl_40.2.bb b/meta-openembedded/meta-gnome/recipes-gnome/yelp/yelp-xsl_41.0.bb index 9ac88c1fe3..029fd02951 100644 --- a/meta-openembedded/meta-gnome/recipes-gnome/yelp/yelp-xsl_40.2.bb +++ b/meta-openembedded/meta-gnome/recipes-gnome/yelp/yelp-xsl_41.0.bb @@ -10,7 +10,7 @@ inherit gnomebase gettext itstool DEPENDS += "libxml2" -SRC_URI[archive.sha256sum] = "919c552f846aaec741fe51d5af416b469bcdb25c77effc3b5a15a4b4b7ff814e" +SRC_URI[archive.sha256sum] = "c8cd64c093bbd8c5d5e47fd38864e90831b5f9cf7403530870206fa96636a4a5" RDEPENDS:${PN}:append:class-target = " libxml2 itstool" diff --git a/meta-openembedded/meta-gnome/recipes-gnome/yelp/yelp_40.3.bb b/meta-openembedded/meta-gnome/recipes-gnome/yelp/yelp_41.1.bb index c179a618ba..980b9a1ae5 100644 --- a/meta-openembedded/meta-gnome/recipes-gnome/yelp/yelp_40.3.bb +++ b/meta-openembedded/meta-gnome/recipes-gnome/yelp/yelp_41.1.bb @@ -9,7 +9,7 @@ inherit gnomebase itstool autotools-brokensep gsettings gettext gtk-doc features # for webkitgtk REQUIRED_DISTRO_FEATURES = "x11" -SRC_URI[archive.sha256sum] = "a173847851f26189be78ecbb10015d539d8cceffc7c23e8635492bc3ada5ee23" +SRC_URI[archive.sha256sum] = "456a6415647bceeb0159b90b3553ff328728cf29a608fce08024232504ccb874" DEPENDS += " \ libxml2-native \ |