aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Stenberg <daniel@haxx.se>2001-10-30 15:21:45 +0000
committerDaniel Stenberg <daniel@haxx.se>2001-10-30 15:21:45 +0000
commitdbd32278f869331683fcf15c4c04fc6c3e0d1611 (patch)
tree1407f21863b21e7507d8a05af34417ba9657b4d5
parent6d35984286908e199e2ec9516ebbe322745bf2c2 (diff)
Added an additional SSL check for a dead socket before we re-use an SSL
connection. The simple socket-check is not enough in these cases.
-rw-r--r--lib/url.c16
1 files changed, 12 insertions, 4 deletions
diff --git a/lib/url.c b/lib/url.c
index e16766fce..bd01136d8 100644
--- a/lib/url.c
+++ b/lib/url.c
@@ -935,7 +935,7 @@ CURLcode Curl_disconnect(struct connectdata *conn)
* be dead. Most commonly this happens when the server has closed the
* connection due to inactivity.
*/
-static bool SocketIsDead(int sock)
+static bool SocketIsDead(struct connectdata *conn, int sock)
{
int sval;
bool ret_val = TRUE;
@@ -949,9 +949,17 @@ static bool SocketIsDead(int sock)
to.tv_usec = 1;
sval = select(sock + 1, &check_set, 0, 0, &to);
- if(sval == 0)
+ if(sval == 0) {
/* timeout */
- ret_val = FALSE;
+ ret_val = FALSE;
+#ifdef USE_SSLEAY
+ /* the socket seems fine, but is the SSL later fine too? */
+ if(conn->ssl.use) {
+ if(SSL_get_shutdown(conn->ssl.handle))
+ return TRUE; /* this connection is dead! */
+ }
+#endif
+ }
return ret_val;
}
@@ -994,7 +1002,7 @@ ConnectionExists(struct SessionHandle *data,
continue;
}
}
- dead = SocketIsDead(check->firstsocket);
+ dead = SocketIsDead(check, check->firstsocket);
if(dead) {
infof(data, "Connection %d seems to be dead!\n", i);
Curl_disconnect(check); /* disconnect resources */