使用 golang 的net/http包和 SPDY。有一點讓我很困惑:該*tls.Conn的 TLSNextProto功能無法全部閱讀。任何讀取嘗試都會收到“對等方重置連接”錯誤。運行以下程序,然后https://localhost:8080/使用啟用了 SPDY 的 Chrome訪問。我是否以錯誤的方式使用 TLS 連接對象?請幫忙。package mainimport ( "crypto/tls" "log" "net/http")func main() { server := &http.Server{ Addr: ":8080", TLSConfig: &tls.Config{ NextProtos: []string{"spdy/3"}, }, TLSNextProto: map[string]func(*http.Server, *tls.Conn, http.Handler){ "spdy/3": func(s *http.Server, conn *tls.Conn, h http.Handler) { buf := make([]byte, 1) if n, err := conn.Read(buf); err != nil { log.Panicf("%v|%v\n", n, err) } }, }, } err := server.ListenAndServeTLS("/path/to/host.cert", "/path/to/host.key") if err != nil { log.Fatal(err) }}
- 1 回答
- 0 關注
- 345 瀏覽
添加回答
舉報
0/150
提交
取消