[libsoup] Fix error code when trying to https with --disable-ssl
- From: Dan Winship <danw src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [libsoup] Fix error code when trying to https with --disable-ssl
- Date: Sun, 9 Aug 2009 15:25:39 +0000 (UTC)
commit caaa22bcfb062ce99c0f784500f7507ad0246c73
Author: Dan Winship <danw gnome org>
Date: Sun Aug 9 11:23:55 2009 -0400
Fix error code when trying to https with --disable-ssl
http://bugzilla.gnome.org/show_bug.cgi?id=590464
libsoup/soup-nossl.c | 15 +++++++++++----
libsoup/soup-status.c | 4 ++++
tests/proxy-test.c | 6 +++---
3 files changed, 18 insertions(+), 7 deletions(-)
---
diff --git a/libsoup/soup-nossl.c b/libsoup/soup-nossl.c
index 744049c..926854d 100644
--- a/libsoup/soup-nossl.c
+++ b/libsoup/soup-nossl.c
@@ -27,25 +27,32 @@ soup_ssl_wrap_iochannel (GIOChannel *sock, gboolean non_blocking,
SoupSSLCredentials *
soup_ssl_get_client_credentials (const char *ca_file)
{
- return NULL;
+ /* We need to return something non-NULL, so SoupSocket will
+ * realize it's supposed to do SSL. If we returned NULL here,
+ * we'd eventually end up trying to speak plain http to an
+ * https server, probably resulting in a SOUP_STATUS_IO_ERROR
+ * or SOUP_STATUS_MALFORMED instead of SOUP_STATUS_SSL_FAILED.
+ */
+ return g_malloc (1);
}
void
soup_ssl_free_client_credentials (SoupSSLCredentials *client_creds)
{
- ;
+ g_free (client_creds);
}
SoupSSLCredentials *
soup_ssl_get_server_credentials (const char *cert_file, const char *key_file)
{
- return NULL;
+ /* See soup_ssl_get_client_credentials() */
+ return g_malloc (1);
}
void
soup_ssl_free_server_credentials (SoupSSLCredentials *server_creds)
{
- ;
+ g_free (server_creds);
}
#endif /* ! HAVE_SSL */
diff --git a/libsoup/soup-status.c b/libsoup/soup-status.c
index 9138260..11422ac 100644
--- a/libsoup/soup-status.c
+++ b/libsoup/soup-status.c
@@ -178,7 +178,11 @@ static const struct {
{ SOUP_STATUS_CANT_RESOLVE_PROXY, "Cannot resolve proxy hostname" },
{ SOUP_STATUS_CANT_CONNECT, "Cannot connect to destination" },
{ SOUP_STATUS_CANT_CONNECT_PROXY, "Cannot connect to proxy" },
+#ifdef HAVE_SSL
{ SOUP_STATUS_SSL_FAILED, "SSL handshake failed" },
+#else
+ { SOUP_STATUS_SSL_FAILED, "SSL support not available" },
+#endif
{ SOUP_STATUS_IO_ERROR, "Connection terminated unexpectedly" },
{ SOUP_STATUS_MALFORMED, "Message Corrupt" },
diff --git a/tests/proxy-test.c b/tests/proxy-test.c
index 8f57c1f..8be846b 100644
--- a/tests/proxy-test.c
+++ b/tests/proxy-test.c
@@ -125,15 +125,15 @@ run_test (int i, gboolean sync)
https_url = g_strconcat (HTTPS_SERVER, tests[i].url, NULL);
}
test_url (http_url, SIMPLE_PROXY, tests[i].final_status, sync);
-#if HAVE_SSL
+#ifdef HAVE_SSL
test_url (https_url, SIMPLE_PROXY, tests[i].final_status, sync);
#endif
test_url (http_url, AUTH_PROXY, tests[i].final_status, sync);
-#if HAVE_SSL
+#ifdef HAVE_SSL
test_url (https_url, AUTH_PROXY, tests[i].final_status, sync);
#endif
test_url (http_url, UNAUTH_PROXY, tests[i].final_status, sync);
-#if HAVE_SSL
+#ifdef HAVE_SSL
test_url (https_url, UNAUTH_PROXY, tests[i].final_status, sync);
#endif
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]