Reset the SSL handshake after connecting to the SOCKS proxy
authorFederico Mena Quintero <federico@novell.com>
Wed, 2 Jun 2010 19:18:00 +0000 (14:18 -0500)
committerFederico Mena Quintero <federico@novell.com>
Wed, 2 Jun 2010 22:49:11 +0000 (17:49 -0500)
Apparently it matters whether the socket had been written to,
while doing the connection to the proxy.  Now it works fine.

Signed-off-by: Federico Mena Quintero <federico@novell.com>
camel/camel-tcp-stream-ssl.c

index 8ffc1c9..8400c90 100644 (file)
@@ -1186,6 +1186,20 @@ connect_to_socks4_proxy (CamelTcpStreamSSL *ssl, const gchar *proxy_host, gint p
                if (!fd) {
                        d (g_print ("  could not enable SSL\n"));
                        goto error;
+               } else {
+                       d (g_print ("  SSL_ResetHandshake\n"));
+                       if (SSL_ResetHandshake (fd, FALSE) == SECFailure) {
+                               set_errno (PR_GetError ());
+                               d (g_print ("  failed\n"));
+                               goto error;
+                       }
+
+                       d (g_print ("  SSL_ForceHandshake\n"));
+                       if (SSL_ForceHandshake (fd) == SECFailure) {
+                               set_errno (PR_GetError ());
+                               d (g_print ("  failed\n"));
+                               goto error;
+                       }
                }
        }