Return non-blocking socket from openconnect_open_https()
authorDavid Woodhouse <David.Woodhouse@intel.com>
Sat, 12 May 2012 19:31:29 +0000 (12:31 -0700)
committerDavid Woodhouse <David.Woodhouse@intel.com>
Sat, 12 May 2012 19:31:31 +0000 (12:31 -0700)
All the callers just set it to blocking mode again immediately, but we're
working on that...

Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
cstp.c
http.c
ssl.c

diff --git a/cstp.c b/cstp.c
index 8caf3ee..dc826b8 100644 (file)
--- a/cstp.c
+++ b/cstp.c
@@ -111,6 +111,9 @@ static int start_cstp_connection(struct openconnect_info *vpninfo)
        }
 
  retry:
+       /* We don't cope with nonblocking mode... yet */
+       fcntl(vpninfo->ssl_fd, F_SETFL, fcntl(vpninfo->ssl_fd, F_GETFL) & ~O_NONBLOCK);
+
        openconnect_SSL_printf(vpninfo, "CONNECT /CSCOSSLC/tunnel HTTP/1.1\r\n");
        openconnect_SSL_printf(vpninfo, "Host: %s\r\n", vpninfo->hostname);
        openconnect_SSL_printf(vpninfo, "User-Agent: %s\r\n", vpninfo->useragent);
diff --git a/http.c b/http.c
index c817fb5..82d864a 100644 (file)
--- a/http.c
+++ b/http.c
@@ -640,6 +640,9 @@ int openconnect_obtain_cookie(struct openconnect_info *vpninfo)
                return -EINVAL;
        }
 
+       /* We don't cope with nonblocking mode... yet */
+       fcntl(vpninfo->ssl_fd, F_SETFL, fcntl(vpninfo->ssl_fd, F_GETFL) & ~O_NONBLOCK);
+
        /*
         * It would be nice to use cURL for this, but we really need to guarantee
         * that we'll be using OpenSSL (for the TPM stuff), and it doesn't seem
diff --git a/ssl.c b/ssl.c
index 9738e6c..9ee182f 100644 (file)
--- a/ssl.c
+++ b/ssl.c
@@ -1173,9 +1173,6 @@ int openconnect_open_https(struct openconnect_info *vpninfo)
        vpn_progress(vpninfo, PRG_INFO, _("Connected to HTTPS on %s\n"),
                     vpninfo->hostname);
 
-       /* Stick it back in blocking mode for now... */
-       fcntl(ssl_sock, F_SETFL, fcntl(ssl_sock, F_GETFL) & ~O_NONBLOCK);
-
        return 0;
 }