File tree Expand file tree Collapse file tree 1 file changed +7
-5
lines changed Expand file tree Collapse file tree 1 file changed +7
-5
lines changed Original file line number Diff line number Diff line change @@ -245,12 +245,14 @@ type Server struct {
245
245
// ServeHTTP is the entry point for all HTTP requests.
246
246
func (s * Server ) ServeHTTP (w http.ResponseWriter , r * http.Request ) {
247
247
// If there are listener wrappers that process tls connections but don't return a *tls.Conn, this field will be nil.
248
- // Can be removed if https://github.com/golang/go/pull/56110 is ever merged.
248
+ // TODO: Can be removed if https://github.com/golang/go/pull/56110 is ever merged.
249
249
if r .TLS == nil {
250
- conn := r .Context ().Value (ConnCtxKey ).(net.Conn )
251
- if csc , ok := conn .(connectionStateConn ); ok {
252
- r .TLS = new (tls.ConnectionState )
253
- * r .TLS = csc .ConnectionState ()
250
+ // not all requests have a conn (like virtual requests) - see #5698
251
+ if conn , ok := r .Context ().Value (ConnCtxKey ).(net.Conn ); ok {
252
+ if csc , ok := conn .(connectionStateConn ); ok {
253
+ r .TLS = new (tls.ConnectionState )
254
+ * r .TLS = csc .ConnectionState ()
255
+ }
254
256
}
255
257
}
256
258
You can’t perform that action at this time.
0 commit comments