Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions handshake_messages.go
Original file line number Diff line number Diff line change
Expand Up @@ -242,10 +242,11 @@ func (m *clientHelloMsg) marshalMsgReorderOuterExts(echInner bool, outerExts []u
}
}
if len(m.alpnProtocols) > 0 {
// RFC 7301, Section 3.1
if echInner {
// ALPN extension copy is skipped because in ECH inner, the ALPN might be different
if echInner && false {
echOuterExts = append(echOuterExts, extensionALPN)
} else {
// RFC 7301, Section 3.1
exts.AddUint16(extensionALPN)
exts.AddUint16LengthPrefixed(func(exts *cryptobyte.Builder) {
exts.AddUint16LengthPrefixed(func(exts *cryptobyte.Builder) {
Expand Down
8 changes: 6 additions & 2 deletions u_tls_extensions.go
Original file line number Diff line number Diff line change
Expand Up @@ -611,8 +611,12 @@ type ALPNExtension struct {
}

func (e *ALPNExtension) writeToUConn(uc *UConn) error {
uc.config.NextProtos = e.AlpnProtocols
uc.HandshakeState.Hello.AlpnProtocols = e.AlpnProtocols
// Do not overwrite NextProtos in config if Encrypted Client Hello is used.
// Config ALPN will be written to inner Hello
if uc.config.EncryptedClientHelloConfigList == nil {
uc.config.NextProtos = e.AlpnProtocols
uc.HandshakeState.Hello.AlpnProtocols = e.AlpnProtocols
}
return nil
}

Expand Down