Skip to content

Commit

Permalink
Merge branch 'refraction-networking:master' into master
Browse files Browse the repository at this point in the history
  • Loading branch information
alphax-hue3682 authored Jan 22, 2025
2 parents 0cd845d + a157e2d commit 58bc148
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 1 deletion.
2 changes: 1 addition & 1 deletion u_packet_packer.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
38 changes: 38 additions & 0 deletions u_parrot_test.go
Original file line number Diff line number Diff line change
@@ -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)
}

}

0 comments on commit 58bc148

Please sign in to comment.