Skip to content

Commit

Permalink
Don't stop dissecting long lasting HTTP connections after 10 seconds …
Browse files Browse the repository at this point in the history
…timeout (#720)

* Set HTTP as protocol after parsing of first message

* Remove unnecessary local variable dissected
  • Loading branch information
nimrod-up9 committed Jan 30, 2022
1 parent d0ef6c9 commit c2739a6
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions tap/extensions/http/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,6 @@ func (d dissecting) Dissect(b *bufio.Reader, isClient bool, tcpID *api.TcpID, co
http2Assembler = createHTTP2Assembler(b)
}

dissected := false
switchingProtocolsHTTP2 := false
for {
if switchingProtocolsHTTP2 {
Expand All @@ -121,7 +120,7 @@ func (d dissecting) Dissect(b *bufio.Reader, isClient bool, tcpID *api.TcpID, co
} else if err != nil {
continue
}
dissected = true
superIdentifier.Protocol = &http11protocol
} else if isClient {
var req *http.Request
switchingProtocolsHTTP2, req, err = handleHTTP1ClientStream(b, tcpID, counterPair, superTimer, emitter, options)
Expand All @@ -130,7 +129,7 @@ func (d dissecting) Dissect(b *bufio.Reader, isClient bool, tcpID *api.TcpID, co
} else if err != nil {
continue
}
dissected = true
superIdentifier.Protocol = &http11protocol

// In case of an HTTP2 upgrade, duplicate the HTTP1 request into HTTP2 with stream ID 1
if switchingProtocolsHTTP2 {
Expand Down Expand Up @@ -161,14 +160,14 @@ func (d dissecting) Dissect(b *bufio.Reader, isClient bool, tcpID *api.TcpID, co
} else if err != nil {
continue
}
dissected = true
superIdentifier.Protocol = &http11protocol
}
}

if !dissected {
if superIdentifier.Protocol == nil {
return err
}
superIdentifier.Protocol = &http11protocol

return nil
}

Expand Down

0 comments on commit c2739a6

Please sign in to comment.