aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorHeinrich Ko <Heinrich.Ko@am.sony.com>2010-11-18 14:07:57 -0800
committerDaniel Stenberg <daniel@haxx.se>2010-12-06 14:41:18 +0100
commit315e5277dc297407d98e0b017fc325e86657738a (patch)
treea8fc228e24ec407188fe5dc5070646495b34f0e1 /lib
parent5c7c9a768d009319520142fcaee1dea33625060f (diff)
ossl_connect_common: detect connection re-use
ossl_connect_common() now checks whether or not 'struct connectdata->state' is equal 'ssl_connection_complete' and if so, will return CURLE_OK with 'done' set to 'TRUE'. This check prevents ossl_connect_common() from creating a new ssl connection on an existing ssl session which causes openssl to fail when it tries to parse an encrypted TLS packet since the cipher data was effectively thrown away when the new ssl connection was created. Bug: http://curl.haxx.se/mail/lib-2010-11/0169.html
Diffstat (limited to 'lib')
-rw-r--r--lib/ssluse.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/lib/ssluse.c b/lib/ssluse.c
index d0eaadede..d8f776018 100644
--- a/lib/ssluse.c
+++ b/lib/ssluse.c
@@ -2371,6 +2371,12 @@ ossl_connect_common(struct connectdata *conn,
long timeout_ms;
int what;
+ /* check if the connection has already been established */
+ if(ssl_connection_complete == connssl->state) {
+ *done = TRUE;
+ return CURLE_OK;
+ }
+
if(ssl_connect_1==connssl->connecting_state) {
/* Find out how much more time we're allowed */
timeout_ms = Curl_timeleft(conn, NULL, TRUE);