aboutsummaryrefslogtreecommitdiff
path: root/src/net/http/server.go
diff options
context:
space:
mode:
Diffstat (limited to 'src/net/http/server.go')
-rw-r--r--src/net/http/server.go12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/net/http/server.go b/src/net/http/server.go
index 49a9d30207..f2bedb7d6a 100644
--- a/src/net/http/server.go
+++ b/src/net/http/server.go
@@ -1924,6 +1924,10 @@ func isCommonNetReadError(err error) bool {
return false
}
+type connectionStater interface {
+ ConnectionState() tls.ConnectionState
+}
+
// Serve a new connection.
func (c *conn) serve(ctx context.Context) {
if ra := c.rwc.RemoteAddr(); ra != nil {
@@ -1996,6 +2000,14 @@ func (c *conn) serve(ctx context.Context) {
// HTTP/1.x from here on.
+ // Set Request.TLS if the conn is not a *tls.Conn, but implements ConnectionState.
+ if c.tlsState == nil {
+ if tc, ok := c.rwc.(connectionStater); ok {
+ c.tlsState = new(tls.ConnectionState)
+ *c.tlsState = tc.ConnectionState()
+ }
+ }
+
ctx, cancelCtx := context.WithCancel(ctx)
c.cancelCtx = cancelCtx
defer cancelCtx()