diff --git a/callbacks.go b/callbacks.go index d09fedc..4544730 100644 --- a/callbacks.go +++ b/callbacks.go @@ -121,6 +121,10 @@ func onBeginHeaderCallback(ptr unsafe.Pointer, streamID C.int) C.int { //log.Printf("stream %d begin headers", int(streamID)) conn := (*Conn)(unsafe.Pointer(uintptr(ptr))) + var TLS tls.ConnectionState + if tlsconn, ok := conn.conn.(*tls.Conn); ok { + TLS = tlsconn.ConnectionState() + } // client if !conn.isServer { s, ok := conn.streams[int(streamID)] @@ -128,10 +132,6 @@ func onBeginHeaderCallback(ptr unsafe.Pointer, streamID C.int) C.int { //log.Println("onBeginHeaderCallback end") return NGHTTP2_ERR_TEMPORAL_CALLBACK_FAILURE } - var TLS tls.ConnectionState - if tlsconn, ok := conn.conn.(*tls.Conn); ok { - TLS = tlsconn.ConnectionState() - } s.response = &http.Response{ Proto: "HTTP/2", ProtoMajor: 2, @@ -156,6 +156,7 @@ func onBeginHeaderCallback(ptr unsafe.Pointer, streamID C.int) C.int { Proto: "HTTP/2", ProtoMajor: 2, ProtoMinor: 0, + TLS: &TLS, }, } s.request.Body = s.bp