~elektito/hodhod

572f1585497440750f07712f28acdcd0b82a7878 — Mostafa Razavi 1 year, 3 months ago cf8257b
Check hostname against SNI
1 files changed, 7 insertions(+), 0 deletions(-)

M main.go
M main.go => main.go +7 -0
@@ 95,6 95,13 @@ func handleConn(conn net.Conn, cfg *hodhod.Config) {
		conn.Write([]byte("59 Bad Request\r\n"))
		return
	}

	tlsConn := conn.(*tls.Conn)
	if tlsConn.ConnectionState().ServerName != urlParsed.Hostname() {
		conn.Write([]byte("53 URL hostname does not match SNI\r\n"))
		return
	}

	req := hodhod.Request{
		Url:        urlParsed,
		RemoteAddr: conn.RemoteAddr().String(),