Comparison

net/server_epoll.lua @ 9847:adc0672b700e

net.server_epoll: Add support for SNI (#409)
author Kim Alvefur <zash@zash.se>
date Sun, 10 Mar 2019 19:35:34 +0100
parent 9835:20bf5b47c1fb
child 9853:9aea8dbb105d
comparison
equal deleted inserted replaced
9846:9a0da809ed4a 9847:adc0672b700e
507 self:destroy(); 507 self:destroy();
508 return conn, err; 508 return conn, err;
509 end 509 end
510 conn:settimeout(0); 510 conn:settimeout(0);
511 self.conn = conn; 511 self.conn = conn;
512 if conn.sni then
513 if self.servername then
514 conn:sni(self.servername);
515 elseif self._server and self._server.hosts then
516 conn:sni(self._server.hosts, true);
517 end
518 end
512 self:on("starttls"); 519 self:on("starttls");
513 self.ondrain = nil; 520 self.ondrain = nil;
514 self.onwritable = interface.tlshandskake; 521 self.onwritable = interface.tlshandskake;
515 self.onreadable = interface.tlshandskake; 522 self.onreadable = interface.tlshandskake;
516 return self:init(); 523 return self:init();
647 listeners = listeners; 654 listeners = listeners;
648 read_size = config and config.read_size; 655 read_size = config and config.read_size;
649 onreadable = interface.onacceptable; 656 onreadable = interface.onacceptable;
650 tls_ctx = config and config.tls_ctx; 657 tls_ctx = config and config.tls_ctx;
651 tls_direct = config and config.tls_direct; 658 tls_direct = config and config.tls_direct;
659 hosts = config and config.sni_hosts;
652 sockname = addr; 660 sockname = addr;
653 sockport = port; 661 sockport = port;
654 }, interface_mt); 662 }, interface_mt);
655 server:add(true, false); 663 server:add(true, false);
656 return server; 664 return server;