|
|
b59e85 |
From 18cf9a2090bb846c92d19d416cd56080eb20f7bd Mon Sep 17 00:00:00 2001
|
|
|
b59e85 |
From: Pavel Grunt <pgrunt@redhat.com>
|
|
|
b59e85 |
Date: Fri, 20 Mar 2015 16:22:11 +0100
|
|
|
b59e85 |
Subject: [PATCH] rest-proxy-auth: Add rest_proxy_auth_cancel for cancelling
|
|
|
b59e85 |
authentication
|
|
|
b59e85 |
|
|
|
b59e85 |
It can be helpful when handling the "authenticate" signal to allow
|
|
|
b59e85 |
to cancel the authentication instead of failing with an error.
|
|
|
b59e85 |
---
|
|
|
b59e85 |
rest/rest-proxy-auth.c | 17 +++++++++++++++++
|
|
|
b59e85 |
rest/rest-proxy-auth.h | 1 +
|
|
|
b59e85 |
2 files changed, 18 insertions(+)
|
|
|
b59e85 |
|
|
|
b59e85 |
diff --git a/rest/rest-proxy-auth.c b/rest/rest-proxy-auth.c
|
|
|
b59e85 |
index 0cb6d7c77695..79f21e0101aa 100644
|
|
|
b59e85 |
--- a/rest/rest-proxy-auth.c
|
|
|
b59e85 |
+++ b/rest/rest-proxy-auth.c
|
|
|
b59e85 |
@@ -135,6 +135,23 @@ rest_proxy_auth_unpause (RestProxyAuth *auth)
|
|
|
b59e85 |
auth->priv->paused = FALSE;
|
|
|
b59e85 |
}
|
|
|
b59e85 |
|
|
|
b59e85 |
+/**
|
|
|
b59e85 |
+ * rest_proxy_auth_cancel:
|
|
|
b59e85 |
+ * @auth: a #RestProxyAuth
|
|
|
b59e85 |
+ *
|
|
|
b59e85 |
+ * Cancel the authentication process
|
|
|
b59e85 |
+ * by cancelling the associated #SoupMessage.
|
|
|
b59e85 |
+ * It results in returning #GError REST_PROXY_ERROR_CANCELLED
|
|
|
b59e85 |
+ * to the function that requested the authentication.
|
|
|
b59e85 |
+ */
|
|
|
b59e85 |
+void
|
|
|
b59e85 |
+rest_proxy_auth_cancel (RestProxyAuth *auth)
|
|
|
b59e85 |
+{
|
|
|
b59e85 |
+ g_return_if_fail (REST_IS_PROXY_AUTH (auth));
|
|
|
b59e85 |
+
|
|
|
b59e85 |
+ soup_session_cancel_message (auth->priv->session, auth->priv->message, SOUP_STATUS_CANCELLED);
|
|
|
b59e85 |
+}
|
|
|
b59e85 |
+
|
|
|
b59e85 |
G_GNUC_INTERNAL gboolean rest_proxy_auth_is_paused (RestProxyAuth *auth)
|
|
|
b59e85 |
{
|
|
|
b59e85 |
g_return_val_if_fail (REST_IS_PROXY_AUTH (auth), FALSE);
|
|
|
b59e85 |
diff --git a/rest/rest-proxy-auth.h b/rest/rest-proxy-auth.h
|
|
|
b59e85 |
index 6358e1a16b35..816aaa9007b7 100644
|
|
|
b59e85 |
--- a/rest/rest-proxy-auth.h
|
|
|
b59e85 |
+++ b/rest/rest-proxy-auth.h
|
|
|
b59e85 |
@@ -66,6 +66,7 @@ GType rest_proxy_auth_get_type (void);
|
|
|
b59e85 |
|
|
|
b59e85 |
void rest_proxy_auth_pause (RestProxyAuth *auth);
|
|
|
b59e85 |
void rest_proxy_auth_unpause (RestProxyAuth *auth);
|
|
|
b59e85 |
+void rest_proxy_auth_cancel (RestProxyAuth *auth);
|
|
|
b59e85 |
|
|
|
b59e85 |
G_END_DECLS
|
|
|
b59e85 |
|
|
|
b59e85 |
--
|
|
|
b59e85 |
2.5.0
|
|
|
b59e85 |
|