Thu, 26 Nov 2009 22:21:12 +0000
net.server_event: Hide starttls function when the connection is not SSL-enabled
net/server_event.lua | file | annotate | diff | comparison | revisions |
--- a/net/server_event.lua Thu Nov 26 22:19:49 2009 +0000 +++ b/net/server_event.lua Thu Nov 26 22:21:12 2009 +0000 @@ -374,6 +374,12 @@ function interface_mt:set_sslctx(sslctx) self._sslctx = sslctx; + if sslctx then + self.starttls = nil; -- use starttls() of interface_mt + else + self.starttls = false; -- prevent starttls() + end + end end function interface_mt:starttls() @@ -458,6 +464,9 @@ _sslctx = sslctx; -- parameters _usingssl = false; -- client is using ssl; } + if not sslctx then + interface.starttls = false -- don't allow TLS + end interface.id = tostring(interface):match("%x+$"); interface.writecallback = function( event ) -- called on write events --vdebug( "new client write event, id/ip/port:", interface, ip, port )