Don't uselessly g_warn when TLS isn't available
authorDan Winship <danw@gnome.org>
Fri, 10 Dec 2010 11:53:48 +0000 (12:53 +0100)
committerDan Winship <danw@gnome.org>
Fri, 10 Dec 2010 11:53:48 +0000 (12:53 +0100)
We g_warn if we can't read the provided SOUP_SESSION_SSL_CA_FILE
(since we have no other way to indicate the error to the app). But
don't warn if the problem is just that the TLS backend isn't available,
since that will cause equally-obvious failures later on that don't
require g_warnings.

libsoup/soup-ssl.c

index 71c4dc1..74d87f2 100644 (file)
@@ -34,8 +34,10 @@ soup_ssl_get_client_credentials (const char *ca_file)
 
                creds->ca_list = g_tls_certificate_list_new_from_file (ca_file, &error);
                if (error) {
-                       g_warning ("Could not set SSL credentials from '%s': %s",
-                                  ca_file, error->message);
+                       if (!g_error_matches (error, G_TLS_ERROR, G_TLS_ERROR_UNAVAILABLE)) {
+                               g_warning ("Could not set SSL credentials from '%s': %s",
+                                          ca_file, error->message);
+                       }
                        g_error_free (error);
                }
                creds->validation_flags = G_TLS_CERTIFICATE_VALIDATE_ALL;