Changeset

4888:c3e17766aead

net.server_select: Return error when SSL handshake fails immediately (thanks Zash)
author Matthew Wild <mwild1@gmail.com>
date Fri, 18 May 2012 00:27:06 +0100
parents 4887:4dd61fe04db4
children 4889:0c5091b8b833
files net/server_select.lua
diffstat 1 files changed, 6 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/net/server_select.lua	Thu May 17 21:25:41 2012 +0200
+++ b/net/server_select.lua	Fri May 18 00:27:06 2012 +0100
@@ -550,7 +550,7 @@
 				out_put( "server.lua: ssl handshake error: ", tostring(err or "handshake too long") )
 				disconnect( handler, "ssl handshake failed" )
 				_ = handler and handler:close( true )	 -- forced disconnect
-				return false	-- handshake failed
+                               return false, err -- handshake failed
 			end
 		)
 	end
@@ -594,7 +594,7 @@
 
 			handler.readbuffer = handshake
 			handler.sendbuffer = handshake
-			handshake( socket ) -- do handshake
+                       return handshake( socket ) -- do handshake
 		end
 	end
 
@@ -610,7 +610,10 @@
 	if sslctx and luasec then
 		out_put "server.lua: auto-starting ssl negotiation..."
 		handler.autostart_ssl = true;
-		handler:starttls(sslctx);
+               local ok, err = handler:starttls(sslctx);
+               if ok == false then
+                       return nil, nil, err
+               end
 	end
 
 	return handler, socket