[gnome-online-accounts/gnome-3-10] oauth2: Clean up
- From: Debarshi Ray <debarshir src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-online-accounts/gnome-3-10] oauth2: Clean up
- Date: Fri, 18 Oct 2013 12:09:25 +0000 (UTC)
commit e52d671808139e8bce90e87f81486288267b645f
Author: Debarshi Ray <debarshir gnome org>
Date: Thu Oct 17 16:26:16 2013 +0200
oauth2: Clean up
Consolidate the ways in which the query and fragment are accessed.
Fixes: https://bugzilla.gnome.org/710363
src/goabackend/goaoauth2provider.c | 12 ++++++++----
1 files changed, 8 insertions(+), 4 deletions(-)
---
diff --git a/src/goabackend/goaoauth2provider.c b/src/goabackend/goaoauth2provider.c
index 8efdea5..3a5fdf9 100644
--- a/src/goabackend/goaoauth2provider.c
+++ b/src/goabackend/goaoauth2provider.c
@@ -888,9 +888,13 @@ on_web_view_navigation_policy_decision_requested (WebKitWebView *web
{
SoupMessage *message;
SoupURI *uri;
+ const gchar *fragment;
+ const gchar *query;
message = webkit_network_request_get_message (request);
uri = soup_message_get_uri (message);
+ fragment = soup_uri_get_fragment (uri);
+ query = soup_uri_get_query (uri);
/* Two cases:
* 1) we can have either the auth code in the query part of the
@@ -898,11 +902,11 @@ on_web_view_navigation_policy_decision_requested (WebKitWebView *web
* 2) the access_token and other information directly in the
* fragment part of the URI.
*/
- if (soup_uri_get_query (uri) != NULL)
+ if (query != NULL)
{
GHashTable *key_value_pairs;
- key_value_pairs = soup_form_decode (uri->query);
+ key_value_pairs = soup_form_decode (query);
priv->authorization_code = g_strdup (g_hash_table_lookup (key_value_pairs, "code"));
if (priv->authorization_code != NULL)
@@ -927,13 +931,13 @@ on_web_view_navigation_policy_decision_requested (WebKitWebView *web
g_hash_table_unref (key_value_pairs);
webkit_web_policy_decision_ignore (policy_decision);
}
- else if (soup_uri_get_fragment (uri) != NULL)
+ else if (fragment != NULL)
{
GHashTable *key_value_pairs;
/* fragment is encoded into a key/value pairs for the token and
* expiration values, using the same syntax as a URL query */
- key_value_pairs = soup_form_decode (soup_uri_get_fragment (uri));
+ key_value_pairs = soup_form_decode (fragment);
/* We might use oauth2_proxy_extract_access_token() here but
* we can also extract other information.
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]