[libgdata] core: Ensure HTTPS URIs are used when deleting entries



commit fde18bd82a883d5955c19b12b40770c62ed40e89
Author: Philip Withnall <philip tecnocode co uk>
Date:   Sat Aug 20 17:40:06 2011 +0100

    core: Ensure HTTPS URIs are used when deleting entries
    
    Apparently YouTube videos have started returning HTTP URIs for their edit
    links (which I'd consider as a bug on the server side), but we have to work
    around this and use HTTPS in order to avoid leaking auth. credentials.

 gdata/gdata-service.c |    8 ++++++--
 1 files changed, 6 insertions(+), 2 deletions(-)
---
diff --git a/gdata/gdata-service.c b/gdata/gdata-service.c
index d0e1f3e..d714e16 100644
--- a/gdata/gdata-service.c
+++ b/gdata/gdata-service.c
@@ -1692,6 +1692,7 @@ gdata_service_delete_entry (GDataService *self, GDataAuthorizationDomain *domain
 	GDataLink *_link;
 	SoupMessage *message;
 	guint status;
+	gchar *fixed_uri;
 
 	g_return_val_if_fail (GDATA_IS_SERVICE (self), FALSE);
 	g_return_val_if_fail (domain == NULL || GDATA_IS_AUTHORIZATION_DOMAIN (domain), FALSE);
@@ -1699,10 +1700,13 @@ gdata_service_delete_entry (GDataService *self, GDataAuthorizationDomain *domain
 	g_return_val_if_fail (cancellable == NULL || G_IS_CANCELLABLE (cancellable), FALSE);
 	g_return_val_if_fail (error == NULL || *error == NULL, FALSE);
 
-	/* Get the edit URI */
+	/* Get the edit URI. We have to fix it to always use HTTPS as YouTube videos appear to incorrectly return a HTTP URI as their edit URI. */
 	_link = gdata_entry_look_up_link (entry, GDATA_LINK_EDIT);
 	g_assert (_link != NULL);
-	message = _gdata_service_build_message (self, domain, SOUP_METHOD_DELETE, gdata_link_get_uri (_link), gdata_entry_get_etag (entry), TRUE);
+
+	fixed_uri = _gdata_service_fix_uri_scheme (gdata_link_get_uri (_link));
+	message = _gdata_service_build_message (self, domain, SOUP_METHOD_DELETE, fixed_uri, gdata_entry_get_etag (entry), TRUE);
+	g_free (fixed_uri);
 
 	/* Send the message */
 	status = _gdata_service_send_message (self, message, cancellable, error);



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