Skip to content

Commit

Permalink
broker: add context to responses that look like HTTP
Browse files Browse the repository at this point in the history
  • Loading branch information
twmb committed Oct 21, 2021
1 parent 1d51332 commit a8dbd2f
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions pkg/kgo/broker.go
Original file line number Diff line number Diff line change
Expand Up @@ -1047,6 +1047,9 @@ func (cxn *brokerCxn) parseReadSize(sizeBuf []byte) (int32, error) {
return 0, fmt.Errorf("invalid negative response size %d", size)
}
if maxSize := cxn.b.cl.cfg.maxBrokerReadBytes; size > maxSize {
if maxSize == 0x48545450 { // "HTTP"
return 0, fmt.Errorf("invalid large response size %d > limit %d; the four size bytes are 'HTTP' in ascii, the beginning of an HTTP response; is your broker port correct?", size, maxSize)
}
// A TLS alert is 21, and a TLS alert has the version
// following, where all major versions are 03xx. We
// look for an alert and major version byte to suspect
Expand Down

0 comments on commit a8dbd2f

Please sign in to comment.