[libgdata: 3/11] contacts: Ensure that contact entry URIs use HTTPS



commit ea2a695ba86a1cc0a7564d2cb0021917049dfa23
Author: Philip Withnall <philip tecnocode co uk>
Date:   Sat Jul 2 10:24:56 2011 +0100

    contacts: Ensure that contact entry URIs use HTTPS

 gdata/services/contacts/gdata-contacts-contact.c |   13 ++++++++++++-
 1 files changed, 12 insertions(+), 1 deletions(-)
---
diff --git a/gdata/services/contacts/gdata-contacts-contact.c b/gdata/services/contacts/gdata-contacts-contact.c
index 2d4f991..1aa63dc 100644
--- a/gdata/services/contacts/gdata-contacts-contact.c
+++ b/gdata/services/contacts/gdata-contacts-contact.c
@@ -1174,7 +1174,18 @@ static gchar *
 get_entry_uri (const gchar *id)
 {
 	const gchar *base_pos;
-	gchar *uri = g_strdup (id);
+	gchar *uri;
+
+	/* Ensure it uses the HTTPS protocol */
+	if (g_str_has_prefix (id, "http://";) == TRUE) {
+		guint id_length = strlen (id);
+
+		uri = g_malloc (id_length + 2);
+		strcpy (uri, "https://";);
+		strcpy (uri + strlen ("https://";), id + strlen ("http://";));
+	} else {
+		uri = g_strdup (id);
+	}
 
 	/* The service API sometimes stubbornly insists on using the "base" view instead of the "full" view, which we have
 	 * to fix, or our extended attributes are never visible */



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]