server: Populate Request.Host field

This commit is contained in:
Adnan Maolood 2021-02-20 18:12:51 -05:00
parent fadb2aed97
commit 15f3e764c5
2 changed files with 4 additions and 1 deletions

View File

@ -23,7 +23,9 @@ type Request struct {
// For international domain names, Host may be in Punycode or // For international domain names, Host may be in Punycode or
// Unicode form. Use golang.org/x/net/idna to convert it to // Unicode form. Use golang.org/x/net/idna to convert it to
// either format if needed. // either format if needed.
// This field is ignored by the Gemini server. //
// For server requests, Host specifies the host on which the URL
// is sought.
Host string Host string
// For client requests, Certificate optionally specifies the // For client requests, Certificate optionally specifies the

View File

@ -291,6 +291,7 @@ func (srv *Server) respond(conn net.Conn) {
if tlsConn, ok := conn.(*tls.Conn); ok { if tlsConn, ok := conn.(*tls.Conn); ok {
state := tlsConn.ConnectionState() state := tlsConn.ConnectionState()
req.TLS = &state req.TLS = &state
req.Host = state.ServerName
} }
// Store remote address // Store remote address