[libsoup] soup-gnutls: return SOUP_SSL_ERROR, not G_IO_ERROR, on handshake failure



commit e05f2ca2c316ce888af00ea4d8cc0fb86f92edaf
Author: Dan Winship <danw gnome org>
Date:   Sat May 22 16:59:21 2010 -0400

    soup-gnutls: return SOUP_SSL_ERROR, not G_IO_ERROR, on handshake failure
    
    Part of https://bugzilla.gnome.org/show_bug.cgi?id=615535

 libsoup/soup-gnutls.c |    7 ++++---
 libsoup/soup-misc.h   |    3 ++-
 2 files changed, 6 insertions(+), 4 deletions(-)
---
diff --git a/libsoup/soup-gnutls.c b/libsoup/soup-gnutls.c
index ac22d95..79211f5 100644
--- a/libsoup/soup-gnutls.c
+++ b/libsoup/soup-gnutls.c
@@ -163,9 +163,10 @@ again:
 	}
 
 	if (result < 0) {
-		g_set_error (err, G_IO_CHANNEL_ERROR,
-			     G_IO_CHANNEL_ERROR_FAILED,
-			     "Unable to handshake");
+		g_set_error (err, SOUP_SSL_ERROR,
+			     SOUP_SSL_ERROR_HANDSHAKE_FAILED,
+			     "SSL handshake failed: %s",
+			     gnutls_strerror (result));
 		return G_IO_STATUS_ERROR;
 	}
 
diff --git a/libsoup/soup-misc.h b/libsoup/soup-misc.h
index 9e7f00d..45c8883 100644
--- a/libsoup/soup-misc.h
+++ b/libsoup/soup-misc.h
@@ -61,7 +61,8 @@ GQuark soup_ssl_error_quark (void);
 typedef enum {
 	SOUP_SSL_ERROR_HANDSHAKE_NEEDS_READ,
 	SOUP_SSL_ERROR_HANDSHAKE_NEEDS_WRITE,
-	SOUP_SSL_ERROR_CERTIFICATE
+	SOUP_SSL_ERROR_CERTIFICATE,
+	SOUP_SSL_ERROR_HANDSHAKE_FAILED
 } SoupSSLError;
 
 typedef enum {



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