forked from quic-go/quic-go
use the correct HTTP/3 ALPN when using draft-34
This commit is contained in:
@@ -32,6 +32,7 @@ var (
|
|||||||
const (
|
const (
|
||||||
nextProtoH3Draft29 = "h3-29"
|
nextProtoH3Draft29 = "h3-29"
|
||||||
nextProtoH3Draft32 = "h3-32"
|
nextProtoH3Draft32 = "h3-32"
|
||||||
|
nextProtoH3Draft34 = "h3-34"
|
||||||
streamTypeControlStream = 0
|
streamTypeControlStream = 0
|
||||||
streamTypePushStream = 1
|
streamTypePushStream = 1
|
||||||
)
|
)
|
||||||
@@ -43,6 +44,9 @@ func versionToALPN(v protocol.VersionNumber) string {
|
|||||||
if v == protocol.VersionDraft32 {
|
if v == protocol.VersionDraft32 {
|
||||||
return nextProtoH3Draft32
|
return nextProtoH3Draft32
|
||||||
}
|
}
|
||||||
|
if v == protocol.VersionDraft34 {
|
||||||
|
return nextProtoH3Draft34
|
||||||
|
}
|
||||||
return ""
|
return ""
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -145,9 +149,14 @@ func (s *Server) serveImpl(tlsConf *tls.Config, conn net.PacketConn) error {
|
|||||||
GetConfigForClient: func(ch *tls.ClientHelloInfo) (*tls.Config, error) {
|
GetConfigForClient: func(ch *tls.ClientHelloInfo) (*tls.Config, error) {
|
||||||
// determine the ALPN from the QUIC version used
|
// determine the ALPN from the QUIC version used
|
||||||
proto := nextProtoH3Draft29
|
proto := nextProtoH3Draft29
|
||||||
if qconn, ok := ch.Conn.(handshake.ConnWithVersion); ok && qconn.GetQUICVersion() == quic.VersionDraft32 {
|
if qconn, ok := ch.Conn.(handshake.ConnWithVersion); ok {
|
||||||
|
if qconn.GetQUICVersion() == quic.VersionDraft32 {
|
||||||
proto = nextProtoH3Draft32
|
proto = nextProtoH3Draft32
|
||||||
}
|
}
|
||||||
|
if qconn.GetQUICVersion() == protocol.VersionDraft34 {
|
||||||
|
proto = nextProtoH3Draft34
|
||||||
|
}
|
||||||
|
}
|
||||||
config := tlsConf
|
config := tlsConf
|
||||||
if tlsConf.GetConfigForClient != nil {
|
if tlsConf.GetConfigForClient != nil {
|
||||||
getConfigForClient := tlsConf.GetConfigForClient
|
getConfigForClient := tlsConf.GetConfigForClient
|
||||||
|
|||||||
Reference in New Issue
Block a user