request: Add ServerName helper method

This commit is contained in:
Adnan Maolood 2021-02-27 14:02:30 -05:00
parent a396ec77e4
commit 82bdffc1eb

View File

@ -110,3 +110,12 @@ func (r *Request) TLS() *tls.ConnectionState {
}
return r.tls
}
// ServerName returns the value of the TLS Server Name Indication extension
// sent by the client.
func (r *Request) ServerName() string {
if tls := r.TLS(); tls != nil {
return tls.ServerName
}
return ""
}