c260e0
From 9a84abe8bd4951f8674e172acf1335d3be961d73 Mon Sep 17 00:00:00 2001
c260e0
From: Martin Frodl <mfrodl@redhat.com>
c260e0
Date: Mon, 24 Oct 2016 17:44:45 +0200
c260e0
Subject: [PATCH] nss: fix tight loop in non-blocking TLS handhsake over proxy
c260e0
c260e0
... in case the handshake completes before entering
c260e0
CURLM_STATE_PROTOCONNECT
c260e0
c260e0
Bug: https://bugzilla.redhat.com/1388162
c260e0
c260e0
Upstream-commit: eb84412b33aa9cbe109d3e2874f9dbba48043263
c260e0
Signed-off-by: Kamil Dudka <kdudka@redhat.com>
c260e0
---
c260e0
 lib/nss.c | 5 ++++-
c260e0
 1 file changed, 4 insertions(+), 1 deletion(-)
c260e0
c260e0
diff --git a/lib/nss.c b/lib/nss.c
c260e0
index 36c100d..848ce86 100644
c260e0
--- a/lib/nss.c
c260e0
+++ b/lib/nss.c
c260e0
@@ -1603,8 +1603,11 @@ static CURLcode nss_connect_common(struct connectdata *conn, int sockindex,
c260e0
   const bool blocking = (done == NULL);
c260e0
   CURLcode rv;
c260e0
 
c260e0
-  if(connssl->state == ssl_connection_complete)
c260e0
+  if(connssl->state == ssl_connection_complete) {
c260e0
+    if(!blocking)
c260e0
+      *done = TRUE;
c260e0
     return CURLE_OK;
c260e0
+  }
c260e0
 
c260e0
   if(connssl->connecting_state == ssl_connect_1) {
c260e0
     rv = nss_setup_connect(conn, sockindex);
c260e0
-- 
c260e0
2.7.4
c260e0