commit 9f4fa68dcb32052c69a4fc95b979e619c4a96242
Author: Paolo Bonzini <pbonzini@redhat.com>
Date:   Mon Jul 18 12:12:19 2022 +0200

    sorta upgrade to 3.45.1

diff --git a/gnome-online-accounts.spec b/gnome-online-accounts.spec
index 6a9262c..e04e691 100644
--- a/gnome-online-accounts.spec
+++ b/gnome-online-accounts.spec
@@ -5,7 +5,7 @@
 %global webkit2gtk3_version 2.26.0
 
 Name:		gnome-online-accounts
-Version:	3.44.0
+Version:	3.45.1
 Release:	1%{?dist}
 Summary:	Single sign-on framework for GNOME
 
@@ -17,6 +17,9 @@ Source0:	https://download.gnome.org/sources/gnome-online-accounts/3.43/%{name}-%
 # https://gitlab.gnome.org/GNOME/gnome-online-accounts/-/issues/63
 # https://bugzilla.redhat.com/show_bug.cgi?id=1913641
 Patch0:		0001-google-Remove-Photos-support.patch
+Patch1:		libsoup3-revert2.patch
+Patch2:		libsoup3-revert.patch
+Patch3:		remove-even-more-oauth.patch
 
 BuildRequires:	pkgconfig(gcr-3)
 BuildRequires:	pkgconfig(gio-2.0) >= %{glib2_version}
@@ -34,7 +37,8 @@ BuildRequires:	pkgconfig(libsoup-2.4) >= %{libsoup_version}
 BuildRequires:	pkgconfig(rest-0.7)
 BuildRequires:	pkgconfig(libxml-2.0)
 BuildRequires:	vala
-BuildRequires:	make
+BuildRequires:	ninja-build
+BuildRequires:	meson
 
 Requires:	glib2%{?_isa} >= %{glib2_version}
 Requires:	gtk3%{?_isa} >= %{gtk3_version}
@@ -61,38 +65,27 @@ developing applications that use %{name}.
 %if 0%{?rhel} >= 9
 %patch0 -p1
 %endif
+%patch1 -p1
+%patch2 -p1
+%patch3 -p1
 
 %build
-%configure \
-%if 0%{?fedora}
-  --enable-foursquare \
-%else
-  --disable-foursquare \
-%endif
-%if 0%{?fedora} || 0%{?rhel} < 9
-  --enable-flickr \
-%else
-  --disable-flickr \
-%endif
-  --disable-facebook \
-  --disable-lastfm \
-  --disable-media-server \
-  --disable-silent-rules \
-  --disable-static \
-  --enable-documentation \
-  --enable-fedora \
-  --enable-exchange \
-  --enable-google \
-  --enable-gtk-doc \
-  --enable-imap-smtp \
-  --enable-kerberos \
-  --enable-owncloud \
-  --enable-windows-live
-%make_build
+%meson \
+  -Dlastfm=false \
+  -Dmedia_server=false \
+  -Dfedora=true \
+  -Dexchange=true \
+  -Dgoogle=true \
+  -Dgtk_doc=true \
+  -Dimap_smtp=true \
+  -Dkerberos=true \
+  -Dman=true \
+  -Downcloud=true \
+  -Dwindows_live=true
+%meson_build
 
 %install
-%make_install
-find $RPM_BUILD_ROOT -name '*.la' -delete
+%meson_install
 
 %find_lang %{name}
 
diff --git a/libsoup3-revert.patch b/libsoup3-revert.patch
new file mode 100644
index 0000000..6b74598
--- /dev/null
+++ b/libsoup3-revert.patch
@@ -0,0 +1,861 @@
+diff --git a/meson.build b/meson.build
+index 005c788..02752dc 100644
+--- a/meson.build
++++ b/meson.build
+@@ -97,18 +97,15 @@ endif
+ enable_goabackend = get_option('goabackend')
+ if enable_goabackend
+   gtk_dep = dependency('gtk+-3.0', version: '>= 3.19.12')
+-  javascript_core_gtk_dep = dependency('javascriptcoregtk-4.1', version: '>= 2.33.1')
++  javascript_core_gtk_dep = dependency('javascriptcoregtk-4.0', version: '>= 2.12.0')
+   json_glib_dep = dependency('json-glib-1.0')
+   libsecret_dep = dependency('libsecret-1')
+-  libsoup_dep = dependency('libsoup-3.0', version: '>= 3.0', fallback: ['libsoup'])
++  libsoup_dep = dependency('libsoup-2.4', version: '>= 2.32')
+   libxml_dep = dependency('libxml-2.0')
+-  webkit_gtk_dep = dependency('webkit2gtk-4.1', version: '>= 2.33.1')
++  webkit_gtk_dep = dependency('webkit2gtk-4.0', version: '>= 2.26.0')
+ endif
+-rest_dep = dependency('rest-1.0',
+-  version: '>= 0.9.0',
+-  fallback: ['librest', 'librest_dep'],
++rest_dep = dependency('rest-0.7',
+   required: enable_goabackend,
+-  default_options: ['soup2=false', 'examples=false', 'tests=false', 'gtk_doc=false'],
+ )
+ config_h.set('GOA_BACKEND_ENABLED', enable_goabackend)
+ 
+diff --git a/src/daemon/goadaemon.c b/src/daemon/goadaemon.c
+index e04e084..564973e 100644
+--- a/src/daemon/goadaemon.c
++++ b/src/daemon/goadaemon.c
+@@ -1494,7 +1494,7 @@ is_authorization_error (GError *error)
+   g_return_val_if_fail (error != NULL, FALSE);
+ 
+   ret = FALSE;
+-  if (error->domain == REST_PROXY_ERROR)
++  if (error->domain == REST_PROXY_ERROR || error->domain == SOUP_HTTP_ERROR)
+     {
+       if (SOUP_STATUS_IS_CLIENT_ERROR (error->code))
+         ret = TRUE;
+diff --git a/src/goabackend/goaewsclient.c b/src/goabackend/goaewsclient.c
+index 4cb2358..4d1330f 100644
+--- a/src/goabackend/goaewsclient.c
++++ b/src/goabackend/goaewsclient.c
+@@ -61,12 +61,6 @@ goa_ews_client_new (void)
+ 
+ /* ---------------------------------------------------------------------------------------------------- */
+ 
+-typedef struct
+-{
+-  gchar *password;
+-  gchar *username;
+-} AutodiscoverAuthData;
+-
+ typedef struct
+ {
+   GCancellable *cancellable;
+@@ -77,16 +71,13 @@ typedef struct
+   guint pending;
+   gulong cancellable_id;
+   xmlOutputBuffer *buf;
+-  AutodiscoverAuthData *auth;
+ } AutodiscoverData;
+ 
+-static void
+-ews_client_autodiscover_auth_data_free (AutodiscoverAuthData *auth)
++typedef struct
+ {
+-  g_free (auth->password);
+-  g_free (auth->username);
+-  g_slice_free (AutodiscoverAuthData, auth);
+-}
++  gchar *password;
++  gchar *username;
++} AutodiscoverAuthData;
+ 
+ static void
+ ews_client_autodiscover_data_free (gpointer user_data)
+@@ -101,12 +92,22 @@ ews_client_autodiscover_data_free (gpointer user_data)
+ 
+   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)
+ {
+@@ -114,8 +115,9 @@ ews_client_check_node (const xmlNode *node, const gchar *name)
+   return node->type == XML_ELEMENT_NODE && !g_strcmp0 ((gchar *) node->name, name);
+ }
+ 
+-static gboolean
+-ews_client_authenticate (SoupMessage *msg,
++static void
++ews_client_authenticate (SoupSession *session,
++                         SoupMessage *msg,
+                          SoupAuth *auth,
+                          gboolean retrying,
+                          gpointer user_data)
+@@ -123,26 +125,26 @@ ews_client_authenticate (SoupMessage *msg,
+   AutodiscoverAuthData *data = user_data;
+ 
+   if (retrying)
+-    return FALSE;
++    return;
+ 
+   soup_auth_authenticate (auth, data->username, data->password);
+-  return TRUE;
+ }
+ 
+-static gboolean
+-ews_client_accept_certificate (SoupMessage *msg, GTlsCertificate *cert, GTlsCertificateFlags cert_flags, gpointer user_data)
++static void
++ews_client_request_started (SoupSession *session, SoupMessage *msg, SoupSocket *socket, gpointer user_data)
+ {
+   AutodiscoverData *data;
+   GTask *task = G_TASK (user_data);
++  GTlsCertificateFlags cert_flags;
+ 
+-  g_debug ("goa_ews_client_autodiscover(): accept certificate for request (%p)", msg);
++  g_debug ("goa_ews_client_autodiscover(): request started (%p)", msg);
+ 
+   data = (AutodiscoverData *) g_task_get_task_data (task);
+ 
+-  if (data->accept_ssl_errors || cert_flags == 0)
+-    return TRUE;
+-
+-  if (data->error == NULL)
++  if (!data->accept_ssl_errors
++      && soup_message_get_https_status (msg, NULL, &cert_flags)
++      && cert_flags != 0
++      && data->error == NULL)
+     {
+       goa_utils_set_error_ssl (&data->error, cert_flags);
+ 
+@@ -151,8 +153,6 @@ ews_client_accept_certificate (SoupMessage *msg, GTlsCertificate *cert, GTlsCert
+        */
+       soup_session_abort (data->session);
+     }
+-
+-  return FALSE;
+ }
+ 
+ static void
+@@ -191,25 +191,9 @@ ews_client_autodiscover_parse_protocol (xmlNode *node)
+   return as_url && oab_url;
+ }
+ 
+-static gboolean
+-ews_client_autodiscover_complete_idle_cb (gpointer user_data)
+-{
+-  GTask *task = user_data;
+-  AutodiscoverData *data = g_task_get_task_data (task);
+-
+-  if (data->error != NULL)
+-    g_task_return_error (task, g_steal_pointer (&data->error));
+-  else
+-    g_task_return_boolean (task, TRUE);
+-
+-  return G_SOURCE_REMOVE;
+-}
+-
+ static void
+-ews_client_autodiscover_response_cb (SoupSession *session, GAsyncResult *result, gpointer user_data)
++ews_client_autodiscover_response_cb (SoupSession *session, SoupMessage *msg, gpointer user_data)
+ {
+-  SoupMessage *msg;
+-  GBytes *body;
+   GError *error = NULL;
+   AutodiscoverData *data;
+   GTask *task = G_TASK (user_data);
+@@ -220,11 +204,7 @@ ews_client_autodiscover_response_cb (SoupSession *session, GAsyncResult *result,
+   xmlDoc *doc;
+   xmlNode *node;
+ 
+-  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);
++  g_debug ("goa_ews_client_autodiscover(): response (%p, %u)", msg, msg->status_code);
+ 
+   data = (AutodiscoverData *) g_task_get_task_data (task);
+   size = sizeof (data->msgs) / sizeof (data->msgs[0]);
+@@ -235,19 +215,16 @@ ews_client_autodiscover_response_cb (SoupSession *session, GAsyncResult *result,
+         break;
+     }
+   if (idx == size || data->pending == 0)
+-    {
+-      g_bytes_unref (body);
+-      g_clear_object (&error);
+-      g_object_unref (task);
+-      return;
+-    }
++    return;
+ 
+   data->msgs[idx] = NULL;
+-  /* G_IO_ERROR_CANCELLED, if we are being aborted by the
++  status = msg->status_code;
++
++  /* status == SOUP_STATUS_CANCELLED, if we are being aborted by the
+    * GCancellable, an SSL error or another message that was
+    * successful.
+    */
+-  if (g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CANCELLED))
++  if (status == SOUP_STATUS_CANCELLED)
+     {
+       /* If we are being aborted by the GCancellable, then the
+        * GTask is responsible for setting the GError automatically.
+@@ -258,23 +235,21 @@ ews_client_autodiscover_response_cb (SoupSession *session, GAsyncResult *result,
+        */
+       goto out;
+     }
+-
+-  status = soup_message_get_status (msg);
+-  if (status != SOUP_STATUS_OK || error)
++  else if (status != SOUP_STATUS_OK)
+     {
+-      g_warning ("goa_ews_client_autodiscover() failed: %u — %s", status, soup_message_get_reason_phrase (msg));
++      g_warning ("goa_ews_client_autodiscover() failed: %u — %s", msg->status_code, msg->reason_phrase);
+       g_return_if_fail (data->error == NULL);
+ 
+-      if (!error)
+-        goa_utils_set_error_soup (&error, msg);
++      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", (char *)g_bytes_get_data (body, NULL));
++  g_debug ("%s", SOUP_MESSAGE (msg)->response_body->data);
+ 
+-  doc = xmlReadMemory (g_bytes_get_data (body, NULL), g_bytes_get_size (body), "autodiscover.xml", NULL, 0);
++  doc = xmlReadMemory (msg->response_body->data, msg->response_body->length, "autodiscover.xml", NULL, 0);
+   if (doc == NULL)
+     {
+       g_set_error (&error,
+@@ -358,7 +333,7 @@ ews_client_autodiscover_response_cb (SoupSession *session, GAsyncResult *result,
+           /* The callback (ie. this function) will be invoked after we
+            * have returned to the main loop.
+            */
+-          g_cancellable_cancel (data->cancellable);
++          soup_session_cancel_message (data->session, data->msgs[idx], SOUP_STATUS_CANCELLED);
+         }
+     }
+ 
+@@ -385,10 +360,10 @@ ews_client_autodiscover_response_cb (SoupSession *session, GAsyncResult *result,
+   data->pending--;
+   if (data->pending == 0)
+     {
+-      /* This is required, to not free the SoupSession under its hands (as this callback is called under it) */
+-      GSource *idle_source = g_idle_source_new ();
+-      g_source_set_callback (idle_source, ews_client_autodiscover_complete_idle_cb, g_object_ref (task), g_object_unref);
+-      g_source_attach (idle_source, g_task_get_context (task));
++      if (data->error != NULL)
++        g_task_return_error (task, g_steal_pointer (&data->error));
++      else
++        g_task_return_boolean (task, TRUE);
+     }
+ 
+   g_clear_error (&error);
+@@ -424,56 +399,52 @@ 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, "method", "POST", NULL);
++  g_object_set (msg, SOUP_MESSAGE_METHOD, "POST", NULL);
+ 
++  soup_message_set_request(msg,
++                           "text/xml; charset=utf-8",
++                           SOUP_MEMORY_COPY,
+ #ifdef LIBXML2_NEW_BUFFER
+-  body = g_bytes_new (xmlOutputBufferGetContent (buf), xmlOutputBufferGetSize (buf));
++                           (gchar *) xmlOutputBufferGetContent(buf),
++                           xmlOutputBufferGetSize(buf));
+ #else
+-  body = g_bytes_new (buf->buffer->content, buf->buffer->use);
++                           (gchar *) 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, AutodiscoverAuthData *auth, GTask *task)
++ews_client_create_msg_for_url (const gchar *url, xmlOutputBuffer *buf)
+ {
+   SoupMessage *msg;
+-  GBytes *body = NULL;
+ 
+   msg = soup_message_new (buf != NULL ? "POST" : "GET", url);
+-  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);
++  soup_message_headers_append (msg->request_headers, "User-Agent", "libews/0.1");
+ 
+   if (buf != NULL)
+     {
++      soup_message_set_request (msg,
++                                "text/xml; charset=utf-8",
++                                SOUP_MEMORY_COPY,
+ #ifdef LIBXML2_NEW_BUFFER
+-      body = g_bytes_new (xmlOutputBufferGetContent (buf), xmlOutputBufferGetSize (buf));
++                                (gchar *) xmlOutputBufferGetContent(buf),
++                                xmlOutputBufferGetSize(buf));
+ #else
+-      body = g_bytes_new (buf->buffer->content, buf->buffer->use);
++                                (gchar *) 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", body ? (int) g_bytes_get_size (body) : 0, body ? (char *)g_bytes_get_data (body, NULL) : "");
+-  if (body)
+-    g_bytes_unref (body);
++  g_debug ("%s", SOUP_MESSAGE (msg)->request_body->data);
+ 
+   return msg;
+ }
+@@ -526,15 +497,12 @@ goa_ews_client_autodiscover (GoaEwsClient        *self,
+    * (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, auth, task);
+-  data->msgs[1] = ews_client_create_msg_for_url (url2, buf, auth, task);
++  data->msgs[0] = ews_client_create_msg_for_url (url1, buf);
++  data->msgs[1] = ews_client_create_msg_for_url (url2, buf);
+   data->pending = sizeof (data->msgs) / sizeof (data->msgs[0]);
+-  data->session = soup_session_new ();
++  data->session = soup_session_new_with_options (SOUP_SESSION_SSL_STRICT, FALSE,
++                                                 NULL);
+   soup_session_add_feature_by_type (data->session, SOUP_TYPE_AUTH_NTLM);
+   data->accept_ssl_errors = accept_ssl_errors;
+ 
+@@ -547,18 +515,26 @@ goa_ews_client_autodiscover (GoaEwsClient        *self,
+                                                     NULL);
+     }
+ 
+-  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));
++  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));
+ 
+   g_free (url2);
+   g_free (url1);
+diff --git a/src/goabackend/goagoogleprovider.c b/src/goabackend/goagoogleprovider.c
+index 70f81aa..182f30d 100644
+--- a/src/goabackend/goagoogleprovider.c
++++ b/src/goabackend/goagoogleprovider.c
+@@ -19,7 +19,7 @@
+ #include "config.h"
+ #include <glib/gi18n-lib.h>
+ 
+-#include <rest/rest.h>
++#include <rest/oauth-proxy.h>
+ #include <json-glib/json-glib.h>
+ 
+ #include "goaprovider.h"
+diff --git a/src/goabackend/goahttpclient.c b/src/goabackend/goahttpclient.c
+index f2ce3b7..c343bc0 100644
+--- a/src/goabackend/goahttpclient.c
++++ b/src/goabackend/goahttpclient.c
+@@ -82,7 +82,7 @@ http_client_check_data_free (gpointer user_data)
+ 
+   g_clear_error (&data->error);
+ 
+-  g_object_unref (data->msg);
++  /* soup_session_queue_message stole the references to data->msg */
+   g_object_unref (data->session);
+   g_slice_free (CheckData, data);
+ }
+@@ -97,8 +97,9 @@ http_client_check_auth_data_free (gpointer data, GClosure *closure)
+   g_slice_free (CheckAuthData, auth);
+ }
+ 
+-static gboolean
+-http_client_authenticate (SoupMessage *msg,
++static void
++http_client_authenticate (SoupSession *session,
++                         SoupMessage *msg,
+                          SoupAuth *auth,
+                          gboolean retrying,
+                          gpointer user_data)
+@@ -106,26 +107,26 @@ http_client_authenticate (SoupMessage *msg,
+   CheckAuthData *data = user_data;
+ 
+   if (retrying)
+-    return FALSE;
++    return;
+ 
+   soup_auth_authenticate (auth, data->username, data->password);
+-  return TRUE;
+ }
+ 
+-static gboolean
+-http_client_accept_certificate (SoupMessage *msg, GTlsCertificate *cert, GTlsCertificateFlags cert_flags, gpointer user_data)
++static void
++http_client_request_started (SoupSession *session, SoupMessage *msg, SoupSocket *socket, 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 || cert_flags == 0)
+-    return TRUE;
+-
+-  if (data->error == NULL)
++  if (!data->accept_ssl_errors
++      && soup_message_get_https_status (msg, NULL, &cert_flags)
++      && cert_flags != 0
++      && data->error == NULL)
+     {
+       goa_utils_set_error_ssl (&data->error, cert_flags);
+ 
+@@ -134,8 +135,6 @@ http_client_accept_certificate (SoupMessage *msg, GTlsCertificate *cert, GTlsCer
+        */
+       soup_session_abort (data->session);
+     }
+-
+-  return FALSE;
+ }
+ 
+ static void
+@@ -155,27 +154,21 @@ http_client_check_cancelled_cb (GCancellable *cancellable, gpointer user_data)
+ }
+ 
+ static void
+-http_client_check_response_cb (SoupSession *session, GAsyncResult *result, gpointer user_data)
++http_client_check_response_cb (SoupSession *session, SoupMessage *msg, gpointer user_data)
+ {
+-  SoupMessage *msg;
+   CheckData *data;
++  GCancellable *cancellable;
+   GTask *task = G_TASK (user_data);
+-  guint status;
+-  GBytes *body;
+-  GError *error = NULL;
+ 
+-  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);
++  g_debug ("goa_http_client_check(): response (%p, %u)", msg, msg->status_code);
+ 
+   data = (CheckData *) g_task_get_task_data (task);
++  cancellable = g_task_get_cancellable (task);
+ 
+-  /* G_IO_ERROR_CANCELLED, if we are being aborted by the
++  /* status == SOUP_STATUS_CANCELLED, if we are being aborted by the
+    * GCancellable or due to an SSL error.
+    */
+-  if (g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CANCELLED))
++  if (msg->status_code == SOUP_STATUS_CANCELLED)
+     {
+       /* If we are being aborted by the GCancellable then there might
+        * or might not be an error. The GCancellable can be triggered
+@@ -183,27 +176,20 @@ http_client_check_response_cb (SoupSession *session, GAsyncResult *result, gpoin
+        * of events across threads.
+        */
+       if (data->error == NULL)
+-        g_propagate_error (&data->error, g_steal_pointer (&error));
++        g_cancellable_set_error_if_cancelled (cancellable, &data->error);
+ 
+       goto out;
+     }
+-
+-  status = soup_message_get_status (msg);
+-  if (status != SOUP_STATUS_OK || error)
++  else if (msg->status_code != SOUP_STATUS_OK)
+     {
+-      g_warning ("goa_http_client_check() failed: %u — %s", status, soup_message_get_reason_phrase (msg));
++      g_warning ("goa_http_client_check() failed: %u — %s", msg->status_code, msg->reason_phrase);
+       g_return_if_fail (data->error == NULL);
+ 
+-      if (error)
+-        g_propagate_error (&data->error, g_steal_pointer (&error));
+-      else
+-        goa_utils_set_error_soup (&data->error, msg);
++      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
+@@ -261,21 +247,15 @@ goa_http_client_check (GoaHttpClient       *self,
+   auth = g_slice_new0 (CheckAuthData);
+   auth->username = g_strdup (username);
+   auth->password = g_strdup (password);
+-  g_signal_connect_data (data->msg,
++  g_signal_connect_data (data->session,
+                          "authenticate",
+                          G_CALLBACK (http_client_authenticate),
+                          auth,
+                          http_client_check_auth_data_free,
+                          0);
+ 
+-  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_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_object_unref (task);
+ }
+diff --git a/src/goabackend/goalastfmprovider.c b/src/goabackend/goalastfmprovider.c
+index 15a2d74..cb9a6f2 100644
+--- a/src/goabackend/goalastfmprovider.c
++++ b/src/goabackend/goalastfmprovider.c
+@@ -19,7 +19,7 @@
+ #include "config.h"
+ #include <glib/gi18n-lib.h>
+ 
+-#include <rest/rest.h>
++#include <rest/rest-proxy.h>
+ #include <json-glib/json-glib.h>
+ 
+ #include "goahttpclient.h"
+@@ -483,18 +483,18 @@ add_account_cb (GoaManager *manager, GAsyncResult *res, gpointer user_data)
+ 
+ static void
+ check_cb (RestProxyCall *call,
+-          GAsyncResult *result,
++          const GError *error,
++          GObject *weak_object,
+           gpointer user_data)
+ {
+   AddAccountData *data = user_data;
+   JsonNode *session;
+-  JsonParser *parser = NULL;
++  JsonParser *parser;
+   JsonObject *json_obj;
+   JsonObject *session_obj;
+   const gchar *payload;
+ 
+-  if (!rest_proxy_call_invoke_finish (call, result, &data->error))
+-    goto out;
++  parser = NULL;
+ 
+   parser = json_parser_new ();
+   payload = rest_proxy_call_get_payload (call);
+@@ -562,12 +562,12 @@ on_rest_proxy_call_cancelled_cb (GCancellable *cancellable, RestProxyCall *call)
+ }
+ 
+ static void
+-lastfm_login (GoaProvider          *provider,
+-              const gchar          *username,
+-              const gchar          *password,
+-              GCancellable         *cancellable,
+-              GAsyncReadyCallback   callback,
+-              gpointer              user_data)
++lastfm_login (GoaProvider                  *provider,
++              const gchar                  *username,
++              const gchar                  *password,
++              GCancellable                 *cancellable,
++              RestProxyCallAsyncCallback   callback,
++              gpointer                     user_data)
+ {
+   AddAccountData *data = user_data;
+   RestProxyCall *call;
+@@ -598,7 +598,7 @@ lastfm_login (GoaProvider          *provider,
+   rest_proxy_call_add_param (call, "api_sig", sig_md5);
+   rest_proxy_call_add_param (call, "format", "json");
+ 
+-  rest_proxy_call_invoke_async (call, NULL, callback, data);
++  rest_proxy_call_async (call, callback, NULL, data, &data->error);
+ 
+   g_signal_connect (cancellable, "cancelled", G_CALLBACK (on_rest_proxy_call_cancelled_cb), call);
+ 
+@@ -665,7 +665,7 @@ add_account (GoaProvider    *provider,
+                 username,
+                 password,
+                 data.cancellable,
+-                (GAsyncReadyCallback) check_cb,
++                (RestProxyCallAsyncCallback) check_cb,
+                 &data);
+ 
+   gtk_widget_set_sensitive (data.connect_button, FALSE);
+@@ -819,7 +819,7 @@ refresh_account (GoaProvider    *provider,
+                 username,
+                 password,
+                 data.cancellable,
+-                (GAsyncReadyCallback) check_cb,
++                (RestProxyCallAsyncCallback) check_cb,
+                 &data);
+   gtk_widget_set_sensitive (data.connect_button, FALSE);
+   gtk_widget_show (data.progress_grid);
+diff --git a/src/goabackend/goaoauth2provider.c b/src/goabackend/goaoauth2provider.c
+index 5b8d43d..2757838 100644
+--- a/src/goabackend/goaoauth2provider.c
++++ b/src/goabackend/goaoauth2provider.c
+@@ -20,7 +20,7 @@
+ #include <glib/gi18n-lib.h>
+ #include <stdlib.h>
+ 
+-#include <rest/rest.h>
++#include <rest/oauth2-proxy.h>
+ #include <libsoup/soup.h>
+ #include <json-glib/json-glib.h>
+ #include <webkit2/webkit2.h>
+@@ -95,15 +95,11 @@ is_authorization_error (GError *error)
+   g_return_val_if_fail (error != NULL, FALSE);
+ 
+   ret = FALSE;
+-  if (error->domain == REST_PROXY_ERROR)
++  if (error->domain == REST_PROXY_ERROR || error->domain == SOUP_HTTP_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;
+ }
+ 
+@@ -767,7 +763,7 @@ on_web_view_decide_policy (WebKitWebView            *web_view,
+   GHashTable *key_value_pairs;
+   WebKitNavigationAction *action;
+   WebKitURIRequest *request;
+-  GUri *uri = NULL;
++  GUri *uri;
+   const gchar *fragment;
+   const gchar *oauth2_error;
+   const gchar *query;
+@@ -893,8 +889,7 @@ on_web_view_decide_policy (WebKitWebView            *web_view,
+   goto ignore_request;
+ 
+  ignore_request:
+-  if (uri)
+-    g_uri_unref (uri);
++  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/goarestproxy.h b/src/goabackend/goarestproxy.h
+index 0241e65..09fb076 100644
+--- a/src/goabackend/goarestproxy.h
++++ b/src/goabackend/goarestproxy.h
+@@ -23,10 +23,12 @@
+ #ifndef __GOA_REST_PROXY_H__
+ #define __GOA_REST_PROXY_H__
+ 
+-#include <rest/rest.h>
++#include <rest/rest-proxy.h>
+ 
+ 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);
+ 
+diff --git a/src/goabackend/goasouplogger.c b/src/goabackend/goasouplogger.c
+index 330b6a9..9b0a53d 100644
+--- a/src/goabackend/goasouplogger.c
++++ b/src/goabackend/goasouplogger.c
+@@ -22,6 +22,15 @@
+ 
+ #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,
+@@ -36,16 +45,24 @@ goa_soup_logger_printer (SoupLogger         *logger,
+   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)
+ {
+-  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;
++  return g_object_new (GOA_TYPE_SOUP_LOGGER, "level", level, "max-body-size", max_body_size, NULL);
+ }
+diff --git a/src/goabackend/goasouplogger.h b/src/goabackend/goasouplogger.h
+index 6929dc0..4a99785 100644
+--- a/src/goabackend/goasouplogger.h
++++ b/src/goabackend/goasouplogger.h
+@@ -27,6 +27,9 @@
+ 
+ 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);
+ 
+diff --git a/src/goabackend/goautils.c b/src/goabackend/goautils.c
+index 70d66a6..b23a258 100644
+--- a/src/goabackend/goautils.c
++++ b/src/goabackend/goautils.c
+@@ -841,26 +841,29 @@ goa_utils_set_error_soup (GError **err, SoupMessage *msg)
+ {
+   gchar *error_msg = NULL;
+   gint error_code = GOA_ERROR_FAILED; /* TODO: more specific */
+-  guint status_code;
+ 
+-  status_code = soup_message_get_status (msg);
+-  switch (status_code)
++  switch (msg->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:
+-      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);
+-        }
++      error_msg = g_strdup_printf (_("Code: %u — Unexpected response from server"), msg->status_code);
+       break;
+     }
+ 
+diff --git a/src/goabackend/goawindowsliveprovider.c b/src/goabackend/goawindowsliveprovider.c
+index 608767a..be35746 100644
+--- a/src/goabackend/goawindowsliveprovider.c
++++ b/src/goabackend/goawindowsliveprovider.c
+@@ -20,7 +20,7 @@
+ #include "config.h"
+ #include <glib/gi18n-lib.h>
+ 
+-#include <rest/rest.h>
++#include <rest/rest-proxy.h>
+ #include <json-glib/json-glib.h>
+ 
+ #include "goaprovider.h"
diff --git a/libsoup3-revert2.patch b/libsoup3-revert2.patch
new file mode 100644
index 0000000..52a5ad3
--- /dev/null
+++ b/libsoup3-revert2.patch
@@ -0,0 +1,12 @@
+diff --git a/src/goabackend/goahttpclient.c b/src/goabackend/goahttpclient.c
+index f2ce3b7b..3b6857d0 100644
+--- a/src/goabackend/goahttpclient.c
++++ b/src/goabackend/goahttpclient.c
+@@ -240,7 +240,6 @@ goa_http_client_check (GoaHttpClient       *self,
+   g_task_set_task_data (task, data, http_client_check_data_free);
+ 
+   data->session = soup_session_new ();
+-  soup_session_set_user_agent (data->session, "gnome-online-accounts/" PACKAGE_VERSION " ");
+ 
+   logger = goa_soup_logger_new (SOUP_LOGGER_LOG_BODY, -1);
+   soup_session_add_feature (data->session, SOUP_SESSION_FEATURE (logger));
diff --git a/remove-even-more-oauth.patch b/remove-even-more-oauth.patch
new file mode 100644
index 0000000..e46b622
--- /dev/null
+++ b/remove-even-more-oauth.patch
@@ -0,0 +1,126 @@
+diff --git a/doc/goa-sections.txt b/doc/goa-sections.txt
+index e7c4934..164e2c4 100644
+--- a/doc/goa-sections.txt
++++ b/doc/goa-sections.txt
+@@ -54,7 +54,6 @@ GoaObject
+ GoaObjectIface
+ goa_object_get_manager
+ goa_object_get_account
+-goa_object_get_oauth_based
+ goa_object_get_oauth2_based
+ goa_object_get_mail
+ goa_object_get_calendar
+@@ -71,7 +70,6 @@ goa_object_get_exchange
+ goa_object_get_todo
+ goa_object_peek_manager
+ goa_object_peek_account
+-goa_object_peek_oauth_based
+ goa_object_peek_oauth2_based
+ goa_object_peek_mail
+ goa_object_peek_calendar
+@@ -94,7 +92,6 @@ GoaObjectSkeletonClass
+ goa_object_skeleton_new
+ goa_object_skeleton_set_manager
+ goa_object_skeleton_set_account
+-goa_object_skeleton_set_oauth_based
+ goa_object_skeleton_set_oauth2_based
+ goa_object_skeleton_set_mail
+ goa_object_skeleton_set_calendar
+@@ -279,57 +276,6 @@ goa_oauth2_based_proxy_get_type
+ goa_oauth2_based_skeleton_get_type
+ </SECTION>
+ 
+-<SECTION>
+-<FILE>GoaOAuthBased</FILE>
+-GoaOAuthBased
+-GoaOAuthBasedIface
+-goa_oauth_based_interface_info
+-goa_oauth_based_override_properties
+-goa_oauth_based_call_get_access_token
+-goa_oauth_based_call_get_access_token_finish
+-goa_oauth_based_call_get_access_token_sync
+-goa_oauth_based_complete_get_access_token
+-goa_oauth_based_get_consumer_key
+-goa_oauth_based_dup_consumer_key
+-goa_oauth_based_set_consumer_key
+-goa_oauth_based_get_consumer_secret
+-goa_oauth_based_dup_consumer_secret
+-goa_oauth_based_set_consumer_secret
+-GoaOAuthBasedProxy
+-GoaOAuthBasedProxyClass
+-goa_oauth_based_proxy_new
+-goa_oauth_based_proxy_new_finish
+-goa_oauth_based_proxy_new_sync
+-goa_oauth_based_proxy_new_for_bus
+-goa_oauth_based_proxy_new_for_bus_finish
+-goa_oauth_based_proxy_new_for_bus_sync
+-GoaOAuthBasedSkeleton
+-GoaOAuthBasedSkeletonClass
+-goa_oauth_based_skeleton_new
+-<SUBSECTION Standard>
+-GOA_OAUTH_BASED
+-GOA_OAUTH_BASED_GET_IFACE
+-GOA_OAUTH_BASED_PROXY
+-GOA_OAUTH_BASED_PROXY_CLASS
+-GOA_OAUTH_BASED_PROXY_GET_CLASS
+-GOA_OAUTH_BASED_SKELETON
+-GOA_OAUTH_BASED_SKELETON_CLASS
+-GOA_OAUTH_BASED_SKELETON_GET_CLASS
+-GOA_IS_OAUTH_BASED
+-GOA_IS_OAUTH_BASED_PROXY
+-GOA_IS_OAUTH_BASED_PROXY_CLASS
+-GOA_IS_OAUTH_BASED_SKELETON
+-GOA_IS_OAUTH_BASED_SKELETON_CLASS
+-GOA_TYPE_OAUTH_BASED
+-GOA_TYPE_OAUTH_BASED_PROXY
+-GOA_TYPE_OAUTH_BASED_SKELETON
+-GoaOAuthBasedProxyPrivate
+-GoaOAuthBasedSkeletonPrivate
+-goa_oauth_based_get_type
+-goa_oauth_based_proxy_get_type
+-goa_oauth_based_skeleton_get_type
+-</SECTION>
+-
+ <SECTION>
+ <FILE>GoaPasswordBased</FILE>
+ GoaPasswordBased
+diff --git a/doc/goa.types b/doc/goa.types
+index 7185b18..35c061a 100644
+--- a/doc/goa.types
++++ b/doc/goa.types
+@@ -9,9 +9,6 @@ goa_object_manager_client_get_type
+ goa_object_get_type
+ goa_object_proxy_get_type
+ goa_object_skeleton_get_type
+-goa_oauth_based_get_type
+-goa_oauth_based_proxy_get_type
+-goa_oauth_based_skeleton_get_type
+ goa_oauth2_based_get_type
+ goa_oauth2_based_proxy_get_type
+ goa_oauth2_based_skeleton_get_type
+@@ -65,5 +62,4 @@ goa_printers_proxy_get_type
+ goa_printers_skeleton_get_type
+ 
+ goa_provider_get_type
+-goa_oauth_provider_get_type
+ goa_oauth2_provider_get_type
+diff --git a/doc/goa-docs.xml b/doc/goa-docs.xml
+index 0abb53ab..0a82049b 100644
+--- a/doc/goa-docs.xml
++++ b/doc/goa-docs.xml
+@@ -144,7 +144,6 @@
+       <xi:include href="xml/GoaObjectManagerClient.xml"/>
+       <xi:include href="xml/GoaManager.xml"/>
+       <xi:include href="xml/GoaAccount.xml"/>
+-      <xi:include href="xml/GoaOAuthBased.xml"/>
+       <xi:include href="xml/GoaOAuth2Based.xml"/>
+       <xi:include href="xml/GoaPasswordBased.xml"/>
+       <xi:include href="xml/GoaMail.xml"/>
+@@ -171,7 +170,6 @@
+       <title>Core</title>
+       <xi:include href="xml/goautil.xml"/>
+       <xi:include href="xml/goaprovider.xml"/>
+-      <xi:include href="xml/goaoauthprovider.xml"/>
+       <xi:include href="xml/goaoauth2provider.xml"/>
+     </chapter>
+   </part>
