Mention that Request methods don't work for clients

This commit is contained in:
Adnan Maolood 2021-02-28 21:59:17 -05:00
parent 4b92c71839
commit ad5d78f08f

View File

@ -95,12 +95,14 @@ func (r *Request) Write(w io.Writer) error {
} }
// Conn returns the network connection on which the request was received. // Conn returns the network connection on which the request was received.
// Conn returns nil for client requests.
func (r *Request) Conn() net.Conn { func (r *Request) Conn() net.Conn {
return r.conn return r.conn
} }
// TLS returns information about the TLS connection on which the // TLS returns information about the TLS connection on which the
// request was received. // request was received.
// TLS returns nil for client requests.
func (r *Request) TLS() *tls.ConnectionState { func (r *Request) TLS() *tls.ConnectionState {
if r.tls == nil { if r.tls == nil {
if tlsConn, ok := r.conn.(*tls.Conn); ok { if tlsConn, ok := r.conn.(*tls.Conn); ok {
@ -113,6 +115,7 @@ func (r *Request) TLS() *tls.ConnectionState {
// ServerName returns the value of the TLS Server Name Indication extension // ServerName returns the value of the TLS Server Name Indication extension
// sent by the client. // sent by the client.
// ServerName returns an empty string for client requests.
func (r *Request) ServerName() string { func (r *Request) ServerName() string {
if tls := r.TLS(); tls != nil { if tls := r.TLS(); tls != nil {
return tls.ServerName return tls.ServerName