aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorcorvid <devnull@localhost>2016-07-07 14:47:25 +0000
committercorvid <devnull@localhost>2016-07-07 14:47:25 +0000
commitda86576c107e0692fb3f55dc097f5e14cc4527ff (patch)
tree83a1dbdf7ab71301e82a6a02bd8bb87c9e86d410
parentbd99337e366388866dfae20ecdc2e5ae58011320 (diff)
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.
-rw-r--r--src/IO/http.c9
-rw-r--r--src/IO/tls.c16
-rw-r--r--src/IO/tls.h2
3 files changed, 13 insertions, 14 deletions
diff --git a/src/IO/http.c b/src/IO/http.c
index 760497ec..faec1d4a 100644
--- a/src/IO/http.c
+++ b/src/IO/http.c
@@ -495,8 +495,7 @@ static void Http_send_query(SocketData_t *S)
}
/*
- * 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 @@ static void Http_connect_tls(ChainLink *info)
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 @@ void a_Http_ccc(int Op, int Branch, int Dir, ChainLink *Info,
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));
diff --git a/src/IO/tls.c b/src/IO/tls.c
index 5785d64b..905abe26 100644
--- a/src/IO/tls.c
+++ b/src/IO/tls.c
@@ -96,7 +96,7 @@ static Dlist *servers;
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 @@ static void Tls_fatal_error_msg(int error_type)
* 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 @@ static void Tls_connect(int fd, int connkey)
_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(int fd, int connkey)
}
}
-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 @@ void a_Tls_handshake(int fd, const DilloUrl *url)
a_Tls_reset_server_state(url);
a_Http_connect_done(fd, success);
} else {
- Tls_connect(fd, connkey);
+ Tls_handshake(fd, connkey);
}
}
diff --git a/src/IO/tls.h b/src/IO/tls.h
index 9bc89de5..af01202f 100644
--- a/src/IO/tls.h
+++ b/src/IO/tls.h
@@ -20,7 +20,7 @@ int a_Tls_connect_ready(const DilloUrl *url);
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);