diff options
author | Carlos Garcia Campos <cgarcia@igalia.com> | 2021-06-08 17:44:04 +0200 |
---|---|---|
committer | Carlos Garcia Campos <cgarcia@igalia.com> | 2021-06-09 13:53:29 +0200 |
commit | 3dc630ae5b9dc6cda1ba318de2cd654aaba7b4a2 (patch) | |
tree | 25853ed19257d0a46972e85cf6c880e49a02006f /rest/rest-proxy-auth.c | |
parent | d39fd6d5f4c0a63cc048b84b0f989cb83f31e5fe (diff) | |
download | librest-3dc630ae5b9dc6cda1ba318de2cd654aaba7b4a2.tar.gz |
Port to libsoup3carlosgc/libsoup3
Diffstat (limited to 'rest/rest-proxy-auth.c')
-rw-r--r-- | rest/rest-proxy-auth.c | 16 |
1 files changed, 16 insertions, 0 deletions
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) |