Merge branch 'refraction-networking:master' into master

This commit is contained in:
alphax-hue3682 2025-01-22 05:52:21 +03:30 committed by GitHub
commit 58bc14813a
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 39 additions and 1 deletions

View file

@ -250,7 +250,7 @@ func (p *uPacketPacker) MarshalInitialPacketPayload(pl payload, v protocol.Versi
return nil, err
}
if p.uSpec.InitialPacketSpec.FrameBuilder == nil || len(p.uSpec.InitialPacketSpec.FrameBuilder.(QUICFrames)) == 0 {
if qf, ok := p.uSpec.InitialPacketSpec.FrameBuilder.(QUICFrames); p.uSpec.InitialPacketSpec.FrameBuilder == nil || ok && len(qf) == 0 {
qfs := QUICFrames{}
for _, frame := range qchframes {
if cryptoFrame, ok := frame.(*clienthellod.CRYPTO); ok {

38
u_parrot_test.go Normal file
View file

@ -0,0 +1,38 @@
package quic
import (
"context"
"net"
"testing"
"time"
tls "github.com/refraction-networking/utls"
)
func testDialPanic(t *testing.T, id QUICID) {
quicSpec, err := QUICID2Spec(id)
if err != nil {
t.Fatal(err)
}
pktConn, err := net.ListenUDP("udp", nil)
if err != nil {
t.Fatal(err)
}
tr := &UTransport{Transport: &Transport{Conn: pktConn}, QUICSpec: &quicSpec}
ctx, cancel := context.WithTimeout(context.Background(), time.Second)
defer cancel()
tr.Dial(ctx, &net.UDPAddr{IP: net.IP{127, 0, 0, 1}, Port: 1234}, &tls.Config{}, &Config{})
}
func TestDialPanic(t *testing.T) {
for _, s := range []QUICID{QUICChrome_115, QUICFirefox_116} {
testDialPanic(t, s)
}
}