Don't stop dissecting long lasting HTTP connections after 10 seconds timeout (#720)

* Set HTTP as protocol after parsing of first message

* Remove unnecessary local variable dissected
This commit is contained in:
Nimrod Gilboa Markevich
2022-01-30 14:28:51 +02:00
committed by GitHub
parent d0ef6c9f97
commit c2739a68c2

View File

@@ -100,7 +100,6 @@ func (d dissecting) Dissect(b *bufio.Reader, isClient bool, tcpID *api.TcpID, co
http2Assembler = createHTTP2Assembler(b) http2Assembler = createHTTP2Assembler(b)
} }
dissected := false
switchingProtocolsHTTP2 := false switchingProtocolsHTTP2 := false
for { for {
if switchingProtocolsHTTP2 { if switchingProtocolsHTTP2 {
@@ -121,7 +120,7 @@ func (d dissecting) Dissect(b *bufio.Reader, isClient bool, tcpID *api.TcpID, co
} else if err != nil { } else if err != nil {
continue continue
} }
dissected = true superIdentifier.Protocol = &http11protocol
} else if isClient { } else if isClient {
var req *http.Request var req *http.Request
switchingProtocolsHTTP2, req, err = handleHTTP1ClientStream(b, tcpID, counterPair, superTimer, emitter, options) switchingProtocolsHTTP2, req, err = handleHTTP1ClientStream(b, tcpID, counterPair, superTimer, emitter, options)
@@ -130,7 +129,7 @@ func (d dissecting) Dissect(b *bufio.Reader, isClient bool, tcpID *api.TcpID, co
} else if err != nil { } else if err != nil {
continue continue
} }
dissected = true superIdentifier.Protocol = &http11protocol
// In case of an HTTP2 upgrade, duplicate the HTTP1 request into HTTP2 with stream ID 1 // In case of an HTTP2 upgrade, duplicate the HTTP1 request into HTTP2 with stream ID 1
if switchingProtocolsHTTP2 { if switchingProtocolsHTTP2 {
@@ -161,14 +160,14 @@ func (d dissecting) Dissect(b *bufio.Reader, isClient bool, tcpID *api.TcpID, co
} else if err != nil { } else if err != nil {
continue continue
} }
dissected = true superIdentifier.Protocol = &http11protocol
} }
} }
if !dissected { if superIdentifier.Protocol == nil {
return err return err
} }
superIdentifier.Protocol = &http11protocol
return nil return nil
} }