epiphany r8852 - trunk/embed/webkit



Author: xan
Date: Fri Mar  6 06:31:35 2009
New Revision: 8852
URL: http://svn.gnome.org/viewvc/epiphany?rev=8852&view=rev

Log:
webkit-embed.c: set security information.

Patch by Mario SÃnchez Prada.

Libsoup lacks the needed security API to do this properly, so for now
just set SECURITY_HIGH when a site with 'https' protocol reaches
load-committed. This at least means we are actually using SSL,
otherwise libosup would have failed to load.

Bug #551106

Modified:
   trunk/embed/webkit/webkit-embed.c

Modified: trunk/embed/webkit/webkit-embed.c
==============================================================================
--- trunk/embed/webkit/webkit-embed.c	(original)
+++ trunk/embed/webkit/webkit-embed.c	Fri Mar  6 06:31:35 2009
@@ -3,6 +3,7 @@
 /*
  *  Copyright  2007 Xan Lopez
  *  Copyright  2008 Jan Alonzo
+ *  Copyright  2009 Igalia S.L.
  *
  *  This program is free software; you can redistribute it and/or modify
  *  it under the terms of the GNU General Public License as published by
@@ -209,6 +210,7 @@
                    EphyEmbed *embed)
 {
   const gchar* uri;
+  EphyEmbedSecurityLevel security_level;
 
   uri = webkit_web_frame_get_uri (web_frame);
   ephy_base_embed_location_changed (EPHY_BASE_EMBED (embed),
@@ -219,6 +221,18 @@
                          uri,
                          FALSE,
                          FALSE);
+
+  /*
+   * FIXME: as a temporary workaround while soup lacks the needed
+   * security API, determine security level based on the existence of
+   * a 'https' prefix for the URI
+   */
+  if (uri && g_str_has_prefix (uri, "https"))
+    security_level = EPHY_EMBED_STATE_IS_SECURE_HIGH;
+  else
+    security_level = EPHY_EMBED_STATE_IS_UNKNOWN;
+
+  ephy_base_embed_set_security_level (EPHY_BASE_EMBED (embed), security_level);
 }
 
 static void
@@ -591,7 +605,16 @@
                          EphyEmbedSecurityLevel *level,
                          char **description)
 {
-  if (level) *level = EPHY_EMBED_STATE_IS_UNKNOWN;
+  if (level) {
+    const gchar *uri = ephy_embed_get_address (embed);
+
+    /* FIXME: as a temporary workaround, determine security level
+       based on the existence of a 'https' prefix for the URI */
+    if (uri && g_str_has_prefix(uri, "https"))
+      *level = EPHY_EMBED_STATE_IS_SECURE_HIGH;
+    else
+      *level = EPHY_EMBED_STATE_IS_UNKNOWN;
+  }
 }
 
 static void



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