[librest] Allow to disable libsoup strict SSL check



commit d8db409a6c6d431504cd0a8825a306281bcd10a0
Author: Christophe Fergeau <cfergeau redhat com>
Date:   Fri Jun 8 17:08:35 2012 +0200

    Allow to disable libsoup strict SSL check
    
    This is needed in order to access REST services over https using
    self-signed certificates.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=663786

 rest/rest-proxy.c |   28 +++++++++++++++++++++++++++-
 1 files changed, 27 insertions(+), 1 deletions(-)
---
diff --git a/rest/rest-proxy.c b/rest/rest-proxy.c
index b23d29e..4aed44d 100644
--- a/rest/rest-proxy.c
+++ b/rest/rest-proxy.c
@@ -58,7 +58,8 @@ enum
   PROP_USER_AGENT,
   PROP_DISABLE_COOKIES,
   PROP_USERNAME,
-  PROP_PASSWORD
+  PROP_PASSWORD,
+  PROP_SSL_STRICT
 };
 
 static gboolean _rest_proxy_simple_run_valist (RestProxy *proxy, 
@@ -105,6 +106,14 @@ rest_proxy_get_property (GObject   *object,
     case PROP_PASSWORD:
       g_value_set_string (value, priv->password);
       break;
+    case PROP_SSL_STRICT: {
+      gboolean ssl_strict;
+      g_object_get (G_OBJECT(priv->session),
+                    "ssl-strict", &ssl_strict,
+                    NULL);
+      g_value_set_boolean (value, ssl_strict);
+      break;
+    }
   default:
     G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
   }
@@ -149,6 +158,14 @@ rest_proxy_set_property (GObject      *object,
       g_free (priv->password);
       priv->password = g_value_dup_string (value);
       break;
+    case PROP_SSL_STRICT:
+      g_object_set (G_OBJECT(priv->session),
+                    "ssl-strict", g_value_get_boolean (value),
+                    NULL);
+      g_object_set (G_OBJECT(priv->session_sync),
+                    "ssl-strict", g_value_get_boolean (value),
+                    NULL);
+      break;
   default:
     G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
   }
@@ -295,6 +312,15 @@ rest_proxy_class_init (RestProxyClass *klass)
   g_object_class_install_property (object_class,
                                    PROP_PASSWORD,
                                    pspec);
+
+  pspec = g_param_spec_boolean ("ssl-strict",
+                                "Strictly validate SSL certificates",
+                                "Whether certificate errors should be considered a connection error",
+                                TRUE,
+                                G_PARAM_READWRITE);
+  g_object_class_install_property (object_class,
+                                   PROP_SSL_STRICT,
+                                   pspec);
 }
 
 static void



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