tags 847556 + patch
thanks

Hi again,

I took a look at the code and came up with a patch which fixes the SSL
connection problem (attached).

The patch simply specifies the hostname-port pair in one
BIO_set_conn_hostname() call, similar to what I've found in the
OpenSSL manuals. Alternatively, one can use BIO_set_conn_port(), but
still she'd have to convert the port value from an integer to a string
first.

The problem with the current code is that the
BIO_ctrl(iBio,BIO_C_SET_CONNECT,3,(char *)&pUrlData->port) no longer
sets the connection port, but sets the IP family instead in OpenSSL
1.1.

Cheers!
-- 
Sergei Golovan
Index: src/http_ssl.c
==================================================================
--- src/http_ssl.c
+++ src/http_ssl.c
@@ -293,12 +293,14 @@
 #endif
 
   SSL_set_mode(ssl, SSL_MODE_AUTO_RETRY);
 
   if( !pUrlData->useProxy ){
-    BIO_set_conn_hostname(iBio, pUrlData->name);
-    BIO_ctrl(iBio,BIO_C_SET_CONNECT,3,(char *)&pUrlData->port);
+    char *connStr;
+    connStr = mprintf("%s:%d", pUrlData->name, pUrlData->port);
+    BIO_set_conn_hostname(iBio, connStr);
+    free(connStr);
     if( BIO_do_connect(iBio)<=0 ){
       ssl_set_errmsg("SSL: cannot connect to host %s:%d (%s)",
           pUrlData->name, pUrlData->port, ERR_reason_error_string(ERR_get_error()));
       ssl_close();
       return 1;

Reply via email to