set TLS for server/client

merge_conn
fangdingjun 6 years ago
parent 5e853f2807
commit 9e67ffde41

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

Loading…
Cancel
Save