aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorDaniel Stenberg <daniel@haxx.se>2008-04-14 15:26:34 +0000
committerDaniel Stenberg <daniel@haxx.se>2008-04-14 15:26:34 +0000
commit6a33a4456e58a9332ebb9135c93bfca9266bb6f7 (patch)
tree4c592e3db612ec308aacc3a2b3826960734ce419 /lib
parente0c2a39ad4624f5c6ddae4ac535cdaa55dcb4ce1 (diff)
- Stefan Krause reported a case where the OpenSSL handshake phase wasn't
properly acknowledging the timeout values, like if you pulled the network plug in the midst of it.
Diffstat (limited to 'lib')
-rw-r--r--lib/ssluse.c31
1 files changed, 19 insertions, 12 deletions
diff --git a/lib/ssluse.c b/lib/ssluse.c
index 503452db9..6d013a291 100644
--- a/lib/ssluse.c
+++ b/lib/ssluse.c
@@ -1497,8 +1497,7 @@ ossl_connect_step1(struct connectdata *conn,
}
static CURLcode
-ossl_connect_step2(struct connectdata *conn,
- int sockindex, long *timeout_ms)
+ossl_connect_step2(struct connectdata *conn, int sockindex)
{
struct SessionHandle *data = conn->data;
int err;
@@ -1508,15 +1507,6 @@ ossl_connect_step2(struct connectdata *conn,
|| ssl_connect_2_reading == connssl->connecting_state
|| ssl_connect_2_writing == connssl->connecting_state);
- /* Find out how much more time we're allowed */
- *timeout_ms = Curl_timeleft(conn, NULL, TRUE);
-
- if(*timeout_ms < 0) {
- /* no need to continue if time already is up */
- failf(data, "SSL connection timeout");
- return CURLE_OPERATION_TIMEDOUT;
- }
-
err = SSL_connect(connssl->handle);
/* 1 is fine
@@ -1767,6 +1757,14 @@ ossl_connect_common(struct connectdata *conn,
long timeout_ms;
if(ssl_connect_1==connssl->connecting_state) {
+ /* Find out how much more time we're allowed */
+ timeout_ms = Curl_timeleft(conn, NULL, TRUE);
+
+ if(timeout_ms < 0) {
+ /* no need to continue if time already is up */
+ failf(data, "SSL connection timeout");
+ return CURLE_OPERATION_TIMEDOUT;
+ }
retcode = ossl_connect_step1(conn, sockindex);
if(retcode)
return retcode;
@@ -1777,6 +1775,15 @@ ossl_connect_common(struct connectdata *conn,
ssl_connect_2_reading == connssl->connecting_state ||
ssl_connect_2_writing == connssl->connecting_state) {
+ /* check allowed time left */
+ timeout_ms = Curl_timeleft(conn, NULL, TRUE);
+
+ if(timeout_ms < 0) {
+ /* no need to continue if time already is up */
+ failf(data, "SSL connection timeout");
+ return CURLE_OPERATION_TIMEDOUT;
+ }
+
/* if ssl is expecting something, check if it's available. */
if(connssl->connecting_state == ssl_connect_2_reading
|| connssl->connecting_state == ssl_connect_2_writing) {
@@ -1812,7 +1819,7 @@ ossl_connect_common(struct connectdata *conn,
}
/* get the timeout from step2 to avoid computing it twice. */
- retcode = ossl_connect_step2(conn, sockindex, &timeout_ms);
+ retcode = ossl_connect_step2(conn, sockindex);
if(retcode)
return retcode;