[libgdata] [core] Use HTTPS URIs wherever possible



commit 77c94bf6d165db7e3c2f85b714e6955f9f410bba
Author: Philip Withnall <philip tecnocode co uk>
Date:   Mon Jan 18 00:01:26 2010 +0000

    [core] Use HTTPS URIs wherever possible
    
    Use HTTPS request URIs wherever services support them, as sensitive data
    could potentially be transmitted. So far, only the Calendar, Contacts and
    PicasaWeb services support HTTPS.
    
    If the LIBGDATA_FORCE_HTTP environment variable is defined, all requests
    (except authentication requests, which must always be HTTPS) will be forced
    to be HTTP, for debugging purposes.

 README                                             |    7 +++
 gdata/atom/gdata-link.c                            |    6 +-
 gdata/gdata-private.h                              |    2 +
 gdata/gdata-service.c                              |   24 +++++++++
 gdata/services/calendar/gdata-calendar-service.c   |   41 ++++++++++++---
 gdata/services/contacts/gdata-contacts-service.c   |   23 +++++++--
 .../documents/gdata-documents-presentation.c       |    3 +-
 gdata/services/documents/gdata-documents-service.c |   52 ++++++++++++--------
 .../documents/gdata-documents-spreadsheet.c        |   11 +++--
 gdata/services/documents/gdata-documents-text.c    |    3 +-
 gdata/services/picasaweb/gdata-picasaweb-service.c |    2 +-
 11 files changed, 129 insertions(+), 45 deletions(-)
---
diff --git a/README b/README
index b69acd2..5fe0bb4 100644
--- a/README
+++ b/README
@@ -21,6 +21,13 @@ Dependencies
 If compiling with --enable-gnome (for GNOME support):
 * libsoup-gnome-2.4
 
+Environment variables
+=====================
+
+If the environment variable LIBGDATA_FORCE_HTTP is defined, libgdata will
+force the use of HTTP for requests which would otherwise normally use
+HTTPS. This allows the network traffic to be debugged more easily.
+
 Licensing
 =========
 
diff --git a/gdata/atom/gdata-link.c b/gdata/atom/gdata-link.c
index 408df88..2cf9165 100644
--- a/gdata/atom/gdata-link.c
+++ b/gdata/atom/gdata-link.c
@@ -107,7 +107,7 @@ gdata_link_class_init (GDataLinkClass *klass)
 	g_object_class_install_property (gobject_class, PROP_RELATION_TYPE,
 				g_param_spec_string ("relation-type",
 					"Relation type", "The link relation type.",
-					"http://www.iana.org/assignments/relation/alternate";,
+					GDATA_LINK_ALTERNATE,
 					G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
 
 	/**
@@ -181,7 +181,7 @@ gdata_link_init (GDataLink *self)
 {
 	self->priv = G_TYPE_INSTANCE_GET_PRIVATE (self, GDATA_TYPE_LINK, GDataLinkPrivate);
 	self->priv->length = -1;
-	self->priv->relation_type = g_strdup ("http://www.iana.org/assignments/relation/alternate";);
+	self->priv->relation_type = g_strdup (GDATA_LINK_ALTERNATE);
 }
 
 static void
@@ -467,7 +467,7 @@ gdata_link_set_relation_type (GDataLink *self, const gchar *relation_type)
 	 */
 	g_free (self->priv->relation_type);
 	if (relation_type == NULL)
-		self->priv->relation_type = g_strdup ("http://www.iana.org/assignments/relation/alternate";);
+		self->priv->relation_type = g_strdup (GDATA_LINK_ALTERNATE);
 	else if (strchr ((char*) relation_type, ':') == NULL)
 		self->priv->relation_type = g_strconcat ("http://www.iana.org/assignments/relation/";, (const gchar*) relation_type, NULL);
 	else
diff --git a/gdata/gdata-private.h b/gdata/gdata-private.h
index 4114469..1c57a1c 100644
--- a/gdata/gdata-private.h
+++ b/gdata/gdata-private.h
@@ -38,6 +38,8 @@ void _gdata_service_query_async (GDataService *self, const gchar *feed_uri, GDat
 				 GDataQueryProgressCallback progress_callback, gpointer progress_user_data,
 				 GAsyncReadyCallback callback, gpointer user_data, GSimpleAsyncThreadFunc query_thread);
 
+const gchar *_gdata_service_get_scheme (void);
+
 #include "gdata-query.h"
 void _gdata_query_set_next_uri (GDataQuery *self, const gchar *next_uri);
 void _gdata_query_set_previous_uri (GDataQuery *self, const gchar *previous_uri);
diff --git a/gdata/gdata-service.c b/gdata/gdata-service.c
index d5cefa5..6804739 100644
--- a/gdata/gdata-service.c
+++ b/gdata/gdata-service.c
@@ -1739,3 +1739,27 @@ _gdata_service_get_session (GDataService *self)
 {
 	return self->priv->session;
 }
+
+/*
+ * _gdata_service_get_scheme:
+ *
+ * Returns the name of the scheme to use (either "http" or "https") for network operations if a request should use HTTPS. This allows
+ * requests to normally use HTTPS, but have the option of using HTTP for debugging purposes. If a request should normally use HTTP, that
+ * should be hard-coded in the relevant code, and this function needn't be called.
+ *
+ * Return value: the scheme to use
+ *
+ * Since: 0.6.0
+ */
+const gchar *
+_gdata_service_get_scheme (void)
+{
+	static gint force_http = -1;
+
+	if (force_http == -1)
+		force_http = (g_getenv ("LIBGDATA_FORCE_HTTP") != NULL);
+
+	if (force_http)
+		return "http";
+	return "https";
+}
diff --git a/gdata/services/calendar/gdata-calendar-service.c b/gdata/services/calendar/gdata-calendar-service.c
index 66093bf..ea296a8 100644
--- a/gdata/services/calendar/gdata-calendar-service.c
+++ b/gdata/services/calendar/gdata-calendar-service.c
@@ -100,6 +100,9 @@ GDataFeed *
 gdata_calendar_service_query_all_calendars (GDataCalendarService *self, GDataQuery *query, GCancellable *cancellable,
 					    GDataQueryProgressCallback progress_callback, gpointer progress_user_data, GError **error)
 {
+	GDataFeed *feed;
+	gchar *request_uri;
+
 	/* Ensure we're authenticated first */
 	if (gdata_service_is_authenticated (GDATA_SERVICE (self)) == FALSE) {
 		g_set_error_literal (error, GDATA_SERVICE_ERROR, GDATA_SERVICE_ERROR_AUTHENTICATION_REQUIRED,
@@ -107,8 +110,12 @@ gdata_calendar_service_query_all_calendars (GDataCalendarService *self, GDataQue
 		return NULL;
 	}
 
-	return gdata_service_query (GDATA_SERVICE (self), "http://www.google.com/calendar/feeds/default/allcalendars/full";, query,
-				    GDATA_TYPE_CALENDAR_CALENDAR, cancellable, progress_callback, progress_user_data, error);
+	request_uri = g_strconcat (_gdata_service_get_scheme (), "://www.google.com/calendar/feeds/default/allcalendars/full", NULL);
+	feed = gdata_service_query (GDATA_SERVICE (self), request_uri, query, GDATA_TYPE_CALENDAR_CALENDAR,
+	                            cancellable, progress_callback, progress_user_data, error);
+	g_free (request_uri);
+
+	return feed;
 }
 
 /**
@@ -133,6 +140,8 @@ gdata_calendar_service_query_all_calendars_async (GDataCalendarService *self, GD
 						  GDataQueryProgressCallback progress_callback, gpointer progress_user_data,
 						  GAsyncReadyCallback callback, gpointer user_data)
 {
+	gchar *request_uri;
+
 	/* Ensure we're authenticated first */
 	if (gdata_service_is_authenticated (GDATA_SERVICE (self)) == FALSE) {
 		g_simple_async_report_error_in_idle (G_OBJECT (self), callback, user_data,
@@ -141,8 +150,10 @@ gdata_calendar_service_query_all_calendars_async (GDataCalendarService *self, GD
 		return;
 	}
 
-	gdata_service_query_async (GDATA_SERVICE (self), "http://www.google.com/calendar/feeds/default/allcalendars/full";, query,
-				   GDATA_TYPE_CALENDAR_CALENDAR, cancellable, progress_callback, progress_user_data, callback, user_data);
+	request_uri = g_strconcat (_gdata_service_get_scheme (), "://www.google.com/calendar/feeds/default/allcalendars/full", NULL);
+	gdata_service_query_async (GDATA_SERVICE (self), request_uri, query, GDATA_TYPE_CALENDAR_CALENDAR,
+	                           cancellable, progress_callback, progress_user_data, callback, user_data);
+	g_free (request_uri);
 }
 
 /**
@@ -166,6 +177,9 @@ GDataFeed *
 gdata_calendar_service_query_own_calendars (GDataCalendarService *self, GDataQuery *query, GCancellable *cancellable,
 					    GDataQueryProgressCallback progress_callback, gpointer progress_user_data, GError **error)
 {
+	GDataFeed *feed;
+	gchar *request_uri;
+
 	/* Ensure we're authenticated first */
 	if (gdata_service_is_authenticated (GDATA_SERVICE (self)) == FALSE) {
 		g_set_error_literal (error, GDATA_SERVICE_ERROR, GDATA_SERVICE_ERROR_AUTHENTICATION_REQUIRED,
@@ -173,8 +187,12 @@ gdata_calendar_service_query_own_calendars (GDataCalendarService *self, GDataQue
 		return NULL;
 	}
 
-	return gdata_service_query (GDATA_SERVICE (self), "http://www.google.com/calendar/feeds/default/owncalendars/full";, query,
-				    GDATA_TYPE_CALENDAR_CALENDAR, cancellable, progress_callback, progress_user_data, error);
+	request_uri = g_strconcat (_gdata_service_get_scheme (), "://www.google.com/calendar/feeds/default/owncalendars/full", NULL);
+	feed = gdata_service_query (GDATA_SERVICE (self), request_uri, query, GDATA_TYPE_CALENDAR_CALENDAR, cancellable,
+	                            progress_callback, progress_user_data, error);
+	g_free (request_uri);
+
+	return feed;
 }
 
 /**
@@ -199,6 +217,8 @@ gdata_calendar_service_query_own_calendars_async (GDataCalendarService *self, GD
 						  GDataQueryProgressCallback progress_callback, gpointer progress_user_data,
 						  GAsyncReadyCallback callback, gpointer user_data)
 {
+	gchar *request_uri;
+
 	/* Ensure we're authenticated first */
 	if (gdata_service_is_authenticated (GDATA_SERVICE (self)) == FALSE) {
 		g_simple_async_report_error_in_idle (G_OBJECT (self), callback, user_data,
@@ -207,8 +227,10 @@ gdata_calendar_service_query_own_calendars_async (GDataCalendarService *self, GD
 		return;
 	}
 
-	gdata_service_query_async (GDATA_SERVICE (self), "http://www.google.com/calendar/feeds/default/owncalendars/full";, query,
-				   GDATA_TYPE_CALENDAR_CALENDAR, cancellable, progress_callback, progress_user_data, callback, user_data);
+	request_uri = g_strconcat (_gdata_service_get_scheme (), "://www.google.com/calendar/feeds/default/owncalendars/full", NULL);
+	gdata_service_query_async (GDATA_SERVICE (self), request_uri, query, GDATA_TYPE_CALENDAR_CALENDAR,
+	                           cancellable, progress_callback, progress_user_data, callback, user_data);
+	g_free (request_uri);
 }
 
 /**
@@ -281,7 +303,8 @@ gdata_calendar_service_insert_event (GDataCalendarService *self, GDataCalendarEv
 	g_return_val_if_fail (GDATA_IS_CALENDAR_SERVICE (self), NULL);
 	g_return_val_if_fail (GDATA_IS_CALENDAR_EVENT (event), NULL);
 
-	uri = g_strdup_printf ("http://www.google.com/calendar/feeds/%s/private/full";, gdata_service_get_username (GDATA_SERVICE (self)));
+	uri = g_strdup_printf ("%s://www.google.com/calendar/feeds/%s/private/full",
+	                       _gdata_service_get_scheme (), gdata_service_get_username (GDATA_SERVICE (self)));
 
 	entry = gdata_service_insert_entry (GDATA_SERVICE (self), uri, GDATA_ENTRY (event), cancellable, error);
 	g_free (uri);
diff --git a/gdata/services/contacts/gdata-contacts-service.c b/gdata/services/contacts/gdata-contacts-service.c
index bafee17..e83de47 100644
--- a/gdata/services/contacts/gdata-contacts-service.c
+++ b/gdata/services/contacts/gdata-contacts-service.c
@@ -99,6 +99,9 @@ GDataFeed *
 gdata_contacts_service_query_contacts (GDataContactsService *self, GDataQuery *query, GCancellable *cancellable,
 				       GDataQueryProgressCallback progress_callback, gpointer progress_user_data, GError **error)
 {
+	GDataFeed *feed;
+	gchar *request_uri;
+
 	/* Ensure we're authenticated first */
 	if (gdata_service_is_authenticated (GDATA_SERVICE (self)) == FALSE) {
 		g_set_error_literal (error, GDATA_SERVICE_ERROR, GDATA_SERVICE_ERROR_AUTHENTICATION_REQUIRED,
@@ -106,8 +109,12 @@ gdata_contacts_service_query_contacts (GDataContactsService *self, GDataQuery *q
 		return NULL;
 	}
 
-	return gdata_service_query (GDATA_SERVICE (self), "http://www.google.com/m8/feeds/contacts/default/full";, GDATA_QUERY (query),
-				    GDATA_TYPE_CONTACTS_CONTACT, cancellable, progress_callback, progress_user_data, error);
+	request_uri = g_strconcat (_gdata_service_get_scheme (), "://www.google.com/m8/feeds/contacts/default/full", NULL);
+	feed = gdata_service_query (GDATA_SERVICE (self), request_uri, GDATA_QUERY (query),
+	                            GDATA_TYPE_CONTACTS_CONTACT, cancellable, progress_callback, progress_user_data, error);
+	g_free (request_uri);
+
+	return feed;
 }
 
 /**
@@ -133,6 +140,8 @@ gdata_contacts_service_query_contacts_async (GDataContactsService *self, GDataQu
 					     GDataQueryProgressCallback progress_callback, gpointer progress_user_data,
 					     GAsyncReadyCallback callback, gpointer user_data)
 {
+	gchar *request_uri;
+
 	/* Ensure we're authenticated first */
 	if (gdata_service_is_authenticated (GDATA_SERVICE (self)) == FALSE) {
 		g_simple_async_report_error_in_idle (G_OBJECT (self), callback, user_data,
@@ -141,8 +150,10 @@ gdata_contacts_service_query_contacts_async (GDataContactsService *self, GDataQu
 		return;
 	}
 
-	gdata_service_query_async (GDATA_SERVICE (self), "http://www.google.com/m8/feeds/contacts/default/full";, GDATA_QUERY (query),
-				   GDATA_TYPE_CONTACTS_CONTACT, cancellable, progress_callback, progress_user_data, callback, user_data);
+	request_uri = g_strconcat (_gdata_service_get_scheme (), "://www.google.com/m8/feeds/contacts/default/full", NULL);
+	gdata_service_query_async (GDATA_SERVICE (self), request_uri, GDATA_QUERY (query),
+	                           GDATA_TYPE_CONTACTS_CONTACT, cancellable, progress_callback, progress_user_data, callback, user_data);
+	g_free (request_uri);
 }
 
 /**
@@ -170,7 +181,9 @@ gdata_contacts_service_insert_contact (GDataContactsService *self, GDataContacts
 	g_return_val_if_fail (GDATA_IS_CONTACTS_SERVICE (self), NULL);
 	g_return_val_if_fail (GDATA_IS_CONTACTS_CONTACT (contact), NULL);
 
-	uri = g_strdup_printf ("http://www.google.com/m8/feeds/contacts/%s/full";, gdata_service_get_username (GDATA_SERVICE (self)));
+	uri = g_strdup_printf ("%s://www.google.com/m8/feeds/contacts/%s/full",
+	                       _gdata_service_get_scheme (),
+	                       gdata_service_get_username (GDATA_SERVICE (self)));
 	entry = gdata_service_insert_entry (GDATA_SERVICE (self), uri, GDATA_ENTRY (contact), cancellable, error);
 	g_free (uri);
 
diff --git a/gdata/services/documents/gdata-documents-presentation.c b/gdata/services/documents/gdata-documents-presentation.c
index cfd8b6b..1203f38 100644
--- a/gdata/services/documents/gdata-documents-presentation.c
+++ b/gdata/services/documents/gdata-documents-presentation.c
@@ -167,5 +167,6 @@ gdata_documents_presentation_get_download_uri (GDataDocumentsPresentation *self,
 	document_id = gdata_documents_entry_get_document_id (GDATA_DOCUMENTS_ENTRY (self));
 	g_assert (document_id != NULL);
 
-	return g_strdup_printf ("http://docs.google.com/feeds/download/presentations/Export?exportFormat=%s&docID=%s";, export_formats[export_format], document_id);
+	return g_strdup_printf ("%s://docs.google.com/feeds/download/presentations/Export?exportFormat=%s&docID=%s",
+	                        _gdata_service_get_scheme (), export_formats[export_format], document_id);
 }
diff --git a/gdata/services/documents/gdata-documents-service.c b/gdata/services/documents/gdata-documents-service.c
index 92b393b..4f38b7c 100644
--- a/gdata/services/documents/gdata-documents-service.c
+++ b/gdata/services/documents/gdata-documents-service.c
@@ -182,6 +182,9 @@ gdata_documents_service_query_documents (GDataDocumentsService *self, GDataDocum
 					 GDataQueryProgressCallback progress_callback, gpointer progress_user_data,
 					 GError **error)
 {
+	GDataFeed *feed;
+	gchar *request_uri;
+
 	/* Ensure we're authenticated first */
 	if (gdata_service_is_authenticated (GDATA_SERVICE (self)) == FALSE) {
 		g_set_error_literal (error, GDATA_SERVICE_ERROR, GDATA_SERVICE_ERROR_AUTHENTICATION_REQUIRED,
@@ -190,15 +193,16 @@ gdata_documents_service_query_documents (GDataDocumentsService *self, GDataDocum
 	}
 
 	/* If we want to query for documents contained in a folder, the URI is different */
-	if (query != NULL && gdata_documents_query_get_folder_id (query) != NULL) {
-		return GDATA_DOCUMENTS_FEED (gdata_service_query (GDATA_SERVICE (self), "http://docs.google.com/feeds/folders/private/full";,
-								  GDATA_QUERY (query), GDATA_TYPE_DOCUMENTS_ENTRY, cancellable, progress_callback,
-								  progress_user_data, error));
-	}
+	if (query != NULL && gdata_documents_query_get_folder_id (query) != NULL)
+		request_uri = g_strconcat (_gdata_service_get_scheme (), "://docs.google.com/feeds/folders/private/full", NULL);
+	else
+		request_uri = g_strconcat (_gdata_service_get_scheme (), "://docs.google.com/feeds/documents/private/full", NULL);
 
-	return GDATA_DOCUMENTS_FEED (gdata_service_query (GDATA_SERVICE (self), "http://docs.google.com/feeds/documents/private/full";,
-							  GDATA_QUERY (query), GDATA_TYPE_DOCUMENTS_ENTRY, cancellable, progress_callback,
-							  progress_user_data, error));
+	feed = gdata_service_query (GDATA_SERVICE (self), request_uri, GDATA_QUERY (query), GDATA_TYPE_DOCUMENTS_ENTRY, cancellable,
+	                            progress_callback, progress_user_data, error);
+	g_free (request_uri);
+
+	return GDATA_DOCUMENTS_FEED (feed);
 }
 
 /**
@@ -229,7 +233,7 @@ gdata_documents_service_query_single_document (GDataDocumentsService *self, GTyp
 	GDataDocumentsEntry *document;
 	SoupMessage *message;
 	GDataDocumentsQuery *query;
-	gchar *resource_id;
+	gchar *resource_id, *request_uri;
 
 	g_return_val_if_fail (GDATA_IS_DOCUMENTS_SERVICE (self), NULL);
 	g_return_val_if_fail (document_id != NULL, NULL);
@@ -251,8 +255,9 @@ gdata_documents_service_query_single_document (GDataDocumentsService *self, GTyp
 	gdata_query_set_entry_id (GDATA_QUERY (query), resource_id);
 	g_free (resource_id);
 
-	message = _gdata_service_query (GDATA_SERVICE (self), "http://docs.google.com/feeds/documents/private/full";, GDATA_QUERY (query),
-					cancellable, NULL, NULL, error);
+	request_uri = g_strconcat (_gdata_service_get_scheme (), "://docs.google.com/feeds/documents/private/full", NULL);
+	message = _gdata_service_query (GDATA_SERVICE (self), request_uri, GDATA_QUERY (query), cancellable, NULL, NULL, error);
+	g_free (request_uri);
 	g_object_unref (query);
 
 	if (message == NULL)
@@ -289,6 +294,8 @@ gdata_documents_service_query_documents_async (GDataDocumentsService *self, GDat
 					       GDataQueryProgressCallback progress_callback, gpointer progress_user_data,
 					       GAsyncReadyCallback callback, gpointer user_data)
 {
+	gchar *request_uri;
+
 	/* Ensure we're authenticated first */
 	if (gdata_service_is_authenticated (GDATA_SERVICE (self)) == FALSE) {
 		g_simple_async_report_error_in_idle (G_OBJECT (self), callback, user_data,
@@ -297,8 +304,10 @@ gdata_documents_service_query_documents_async (GDataDocumentsService *self, GDat
 		return;
 	}
 
-	gdata_service_query_async (GDATA_SERVICE (self), "http://docs.google.com/feeds/documents/private/full";, GDATA_QUERY (query),
-				   GDATA_TYPE_DOCUMENTS_ENTRY, cancellable, progress_callback, progress_user_data, callback, user_data);
+	request_uri = g_strconcat (_gdata_service_get_scheme (), "://docs.google.com/feeds/documents/private/full", NULL);
+	gdata_service_query_async (GDATA_SERVICE (self), request_uri, GDATA_QUERY (query), GDATA_TYPE_DOCUMENTS_ENTRY,
+	                           cancellable, progress_callback, progress_user_data, callback, user_data);
+	g_free (request_uri);
 }
 
 /*
@@ -579,7 +588,7 @@ gdata_documents_service_move_document_to_folder (GDataDocumentsService *self, GD
 
 	folder_id = gdata_documents_entry_get_document_id (GDATA_DOCUMENTS_ENTRY (folder));
 	g_assert (folder_id != NULL);
-	uri = g_strconcat ("http://docs.google.com/feeds/folders/private/full/folder%3A";, folder_id, NULL);
+	uri = g_strconcat (_gdata_service_get_scheme (), "://docs.google.com/feeds/folders/private/full/folder%3A", folder_id, NULL);
 
 	message = soup_message_new (SOUP_METHOD_POST, uri);
 	g_free (uri);
@@ -656,7 +665,7 @@ GDataDocumentsEntry *
 gdata_documents_service_remove_document_from_folder (GDataDocumentsService *self, GDataDocumentsEntry *document, GDataDocumentsFolder *folder,
 						     GCancellable *cancellable, GError **error)
 {
-	const gchar *folder_id, *document_id;
+	const gchar *folder_id, *document_id, *uri_template;
 	GDataServiceClass *klass;
 	SoupMessage *message;
 	guint status;
@@ -680,16 +689,17 @@ gdata_documents_service_remove_document_from_folder (GDataDocumentsService *self
 	g_assert (document_id != NULL);
 
 	if (GDATA_IS_DOCUMENTS_PRESENTATION (document))
-		uri = g_strdup_printf ("http://docs.google.com/feeds/folders/private/full/folder%%3A%s/presentation%%3A%s";, folder_id, document_id);
+		uri_template = "%s://docs.google.com/feeds/folders/private/full/folder%%3A%s/presentation%%3A%s";
 	else if (GDATA_IS_DOCUMENTS_SPREADSHEET (document))
-		uri = g_strdup_printf ("http://docs.google.com/feeds/folders/private/full/folder%%3A%s/spreadsheet%%3A%s";, folder_id, document_id);
+		uri_template = "%s://docs.google.com/feeds/folders/private/full/folder%%3A%s/spreadsheet%%3A%s";
 	else if (GDATA_IS_DOCUMENTS_TEXT (document))
-		uri = g_strdup_printf ("http://docs.google.com/feeds/folders/private/full/folder%%3A%s/document%%3A%s";, folder_id, document_id);
+		uri_template = "%s://docs.google.com/feeds/folders/private/full/folder%%3A%s/document%%3A%s";
 	else if (GDATA_IS_DOCUMENTS_FOLDER (document))
-		uri = g_strdup_printf ("http://docs.google.com/feeds/folders/private/full/folder%%3A%s/folder%%3A%s";, folder_id, document_id);
+		uri_template = "%s://docs.google.com/feeds/folders/private/full/folder%%3A%s/folder%%3A%s";
 	else
 		g_assert_not_reached ();
 
+	uri = g_strdup_printf (uri_template, _gdata_service_get_scheme (), folder_id, document_id);
 	message = soup_message_new (SOUP_METHOD_DELETE, uri);
 	g_free (uri);
 
@@ -751,11 +761,11 @@ gdata_documents_service_get_upload_uri (GDataDocumentsFolder *folder)
 	if (folder != NULL) {
 		const gchar *folder_id = gdata_documents_entry_get_document_id (GDATA_DOCUMENTS_ENTRY (folder));
 		g_assert (folder_id != NULL);
-		return g_strconcat ("http://docs.google.com/feeds/folders/private/full/folder%3A";, folder_id, NULL);
+		return g_strconcat (_gdata_service_get_scheme (), "://docs.google.com/feeds/folders/private/full/folder%3A", folder_id, NULL);
 	}
 
 	/* Otherwise return the default upload URI */
-	return g_strdup ("http://docs.google.com/feeds/documents/private/full";);
+	return g_strconcat (_gdata_service_get_scheme (), "://docs.google.com/feeds/documents/private/full", NULL);
 }
 
 GDataService *
diff --git a/gdata/services/documents/gdata-documents-spreadsheet.c b/gdata/services/documents/gdata-documents-spreadsheet.c
index 99ede51..7629004 100644
--- a/gdata/services/documents/gdata-documents-spreadsheet.c
+++ b/gdata/services/documents/gdata-documents-spreadsheet.c
@@ -192,8 +192,11 @@ gdata_documents_spreadsheet_get_download_uri (GDataDocumentsSpreadsheet *self, G
 
 	fmcmd = export_formats[export_format].fmcmd;
 
-	if (gid != -1)
-		return g_strdup_printf ("http://spreadsheets.google.com/feeds/download/spreadsheets/Export?key=%s&fmcmd=%s&gid=%d";, document_id, fmcmd, gid);
-	else
-		return g_strdup_printf ("http://spreadsheets.google.com/feeds/download/spreadsheets/Export?key=%s&fmcmd=%s";, document_id, fmcmd);
+	if (gid != -1) {
+		return g_strdup_printf ("%s://spreadsheets.google.com/feeds/download/spreadsheets/Export?key=%s&fmcmd=%s&gid=%d",
+		                        _gdata_service_get_scheme (), document_id, fmcmd, gid);
+	} else {
+		return g_strdup_printf ("%s://spreadsheets.google.com/feeds/download/spreadsheets/Export?key=%s&fmcmd=%s",
+		                        _gdata_service_get_scheme (), document_id, fmcmd);
+	}
 }
diff --git a/gdata/services/documents/gdata-documents-text.c b/gdata/services/documents/gdata-documents-text.c
index 8ae323f..07718d4 100644
--- a/gdata/services/documents/gdata-documents-text.c
+++ b/gdata/services/documents/gdata-documents-text.c
@@ -170,5 +170,6 @@ gdata_documents_text_get_download_uri (GDataDocumentsText *self, GDataDocumentsT
 	document_id = gdata_documents_entry_get_document_id (GDATA_DOCUMENTS_ENTRY (self));
 	g_assert (document_id != NULL);
 
-	return g_strdup_printf ("http://docs.google.com/feeds/download/documents/Export?exportFormat=%s&docID=%s";, export_formats[export_format], document_id);
+	return g_strdup_printf ("%s://docs.google.com/feeds/download/documents/Export?exportFormat=%s&docID=%s",
+	                        _gdata_service_get_scheme (), export_formats[export_format], document_id);
 }
diff --git a/gdata/services/picasaweb/gdata-picasaweb-service.c b/gdata/services/picasaweb/gdata-picasaweb-service.c
index 6dab5b4..5957708 100644
--- a/gdata/services/picasaweb/gdata-picasaweb-service.c
+++ b/gdata/services/picasaweb/gdata-picasaweb-service.c
@@ -628,6 +628,6 @@ gdata_picasaweb_service_insert_album (GDataPicasaWebService *self, GDataPicasaWe
 	g_object_unref (album_kind);
 
 	return GDATA_PICASAWEB_ALBUM (gdata_service_insert_entry (GDATA_SERVICE (self), "http://picasaweb.google.com/data/feed/api/user/default";,
-								  GDATA_ENTRY (album), cancellable, error));
+	                                                          GDATA_ENTRY (album), cancellable, error));
 }
 



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