HTTP and Listener improvements and bugfixes (#17)

* listener revamp

* improvements to conn lifetimes
This commit is contained in:
Pat Whittingslow
2026-01-11 10:29:16 -03:00
committed by GitHub
parent be194ad7ea
commit 151133dfb4
8 changed files with 145 additions and 77 deletions
+11 -7
View File
@@ -30,9 +30,13 @@ func TestCap(t *testing.T) {
Flags: tcp.FlagFIN, //tcp.FlagSYN | tcp.FlagACK | tcp.FlagPSH,
})
var hdr httpraw.Header
hdr.SetProtocol("HTTP/1.1")
hdr.SetStatus("200", "OK")
hdr.Set("Cookie", "ABC=123")
pkt, _ = hdr.AppendResponse(pkt)
pkt, err := hdr.AppendResponse(pkt)
if err != nil {
t.Fatal(err)
}
pkt = append(pkt, httpBody...)
var pbreak PacketBreakdown
frames, err := pbreak.CaptureEthernet(nil, pkt, 0)
@@ -233,12 +237,12 @@ func TestRightAlignedFields(t *testing.T) {
// with right-aligned fields that have trailing bits.
func TestAppendFieldRightAligned(t *testing.T) {
testCases := []struct {
name string
pkt []byte
fieldBitStart int
bitlen int
rightAligned bool
wantData []byte
name string
pkt []byte
fieldBitStart int
bitlen int
rightAligned bool
wantData []byte
}{
{
// IPv6 Traffic Class: bits 4-11 (8 bits spanning bytes 0-1)