changeset 4630:29831152e985

a little renaming in tls The handshake stuff should be named handshake. What should you call initialize/setup plus handshake, then? I don't know, but 'connect' for now, anyway.
author corvid
date Do, 07 Jul 2016 14:47:25 +0000
parents d4b595bd6fd8
children 7b560d2b5e4b
files src/IO/http.c src/IO/tls.c src/IO/tls.h
diffstat 3 files changed, 13 insertions(+), 14 deletions(-) [+]
line wrap: on
line diff
--- a/src/IO/http.c	Do Jul 07 14:15:03 2016 +0000
+++ b/src/IO/http.c	Do Jul 07 14:47:25 2016 +0000
@@ -495,8 +495,7 @@
 }
 
 /*
- * Prepare an HTTPS connection.  If necessary, tunnel it through a proxy.
- * Then perform the TLS handshake.
+ * Prepare an HTTPS connection.  If necessary, tunnel through a proxy first.
  */
 static void Http_connect_tls(ChainLink *info)
 {
@@ -514,8 +513,8 @@
       dFree(dbuf);
       dFree(connect_str);
    } else {
-      MSG_BW(S->web, 1, "TLS handshake...");
-      a_Tls_handshake(S->SockFD, S->url);
+      MSG_BW(S->web, 1, "Secure connection negotiation...");
+      a_Tls_connect(S->SockFD, S->url);
    }
 }
 
@@ -944,7 +943,7 @@
                          sd->https_proxy_reply->str);
                      dStr_free(sd->https_proxy_reply, 1);
                      sd->https_proxy_reply = NULL;
-                     a_Tls_handshake(sd->SockFD, sd->url);
+                     a_Tls_connect(sd->SockFD, sd->url);
                   } else {
                      MSG_BW(sd->web, 1, "Can't connect through proxy to %s",
                             URL_HOST(sd->url));
--- a/src/IO/tls.c	Do Jul 07 14:15:03 2016 +0000
+++ b/src/IO/tls.c	Do Jul 07 14:47:25 2016 +0000
@@ -96,7 +96,7 @@
 static Dlist *cert_authorities;
 static Dlist *fd_map;
 
-static void Tls_connect_cb(int fd, void *vconnkey);
+static void Tls_handshake_cb(int fd, void *vconnkey);
 
 /*
  * Compare by FD.
@@ -916,7 +916,7 @@
  * Connect, set a callback if it's still not completed. If completed, check
  * the certificate and report back to http.
  */
-static void Tls_connect(int fd, int connkey)
+static void Tls_handshake(int fd, int connkey)
 {
    int ret;
    bool_t ongoing = FALSE, failed = TRUE;
@@ -937,7 +937,7 @@
          _MSG("iowatching fd %d for tls -- want %s\n", fd,
              ret == MBEDTLS_ERR_SSL_WANT_READ ? "read" : "write");
          a_IOwatch_remove_fd(fd, -1);
-         a_IOwatch_add_fd(fd, want, Tls_connect_cb, INT2VOIDP(connkey));
+         a_IOwatch_add_fd(fd, want, Tls_handshake_cb, INT2VOIDP(connkey));
          ongoing = TRUE;
          failed = FALSE;
       } else if (ret == 0) {
@@ -1007,15 +1007,15 @@
    }
 }
 
-static void Tls_connect_cb(int fd, void *vconnkey)
+static void Tls_handshake_cb(int fd, void *vconnkey)
 {
-   Tls_connect(fd, VOIDP2INT(vconnkey));
+   Tls_handshake(fd, VOIDP2INT(vconnkey));
 }
 
 /*
- * Perform the TLS handshake on an open socket.
+ * Make TLS connection over a connect()ed socket.
  */
-void a_Tls_handshake(int fd, const DilloUrl *url)
+void a_Tls_connect(int fd, const DilloUrl *url)
 {
    mbedtls_ssl_context *ssl = dNew0(mbedtls_ssl_context, 1);
    bool_t success = TRUE;
@@ -1051,7 +1051,7 @@
       a_Tls_reset_server_state(url);
       a_Http_connect_done(fd, success);
    } else {
-      Tls_connect(fd, connkey);
+      Tls_handshake(fd, connkey);
    }
 }
 
--- a/src/IO/tls.h	Do Jul 07 14:15:03 2016 +0000
+++ b/src/IO/tls.h	Do Jul 07 14:47:25 2016 +0000
@@ -20,7 +20,7 @@
 void a_Tls_reset_server_state(const DilloUrl *url);
 
 /* Use to initiate a TLS connection. */
-void a_Tls_handshake(int fd, const DilloUrl *url);
+void a_Tls_connect(int fd, const DilloUrl *url);
 
 void *a_Tls_connection(int fd);