~elektito/hodhod

9df4cf13bff9add643345f5857d047c681ffe02e — Mostafa Razavi 1 year, 2 months ago 3c5a1b5
Fix bug where SNI never matched hostname

Apparently we needed to read SNI at a later stage. Reading it that
early, the field was just an empty string.
1 files changed, 2 insertions(+), 1 deletions(-)

M main.go
M main.go => main.go +2 -1
@@ 106,7 106,6 @@ func handleConn(conn net.Conn, cfg *hodhod.Config) {
	defer conn.Close()

	tlsConn := conn.(*tls.Conn)
	sni := tlsConn.ConnectionState().ServerName

	err := conn.SetDeadline(time.Now().Add(ConnectionTimeout))
	if err != nil {


@@ 123,6 122,8 @@ func handleConn(conn net.Conn, cfg *hodhod.Config) {
		return
	}

	sni := tlsConn.ConnectionState().ServerName

	urlStr := s.Text()
	urlParsed, err := url.Parse(urlStr)
	if err != nil {