server: Don't always assume TLS is used
This commit is contained in:
parent
df1794c803
commit
c329a2487e
@ -204,8 +204,10 @@ func (s *Server) respond(conn net.Conn) {
|
|||||||
w.WriteStatus(StatusBadRequest)
|
w.WriteStatus(StatusBadRequest)
|
||||||
} else {
|
} else {
|
||||||
// Store information about the TLS connection
|
// Store information about the TLS connection
|
||||||
connState := conn.(*tls.Conn).ConnectionState()
|
var connState tls.ConnectionState
|
||||||
var cert *tls.Certificate
|
var cert *tls.Certificate
|
||||||
|
if tlsConn, ok := conn.(*tls.Conn); ok {
|
||||||
|
connState = tlsConn.ConnectionState()
|
||||||
if len(connState.PeerCertificates) > 0 {
|
if len(connState.PeerCertificates) > 0 {
|
||||||
peerCert := connState.PeerCertificates[0]
|
peerCert := connState.PeerCertificates[0]
|
||||||
// Store the TLS certificate
|
// Store the TLS certificate
|
||||||
@ -214,6 +216,7 @@ func (s *Server) respond(conn net.Conn) {
|
|||||||
Leaf: peerCert,
|
Leaf: peerCert,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
req := &Request{
|
req := &Request{
|
||||||
URL: url,
|
URL: url,
|
||||||
|
Loading…
Reference in New Issue
Block a user