Skip to content

Commit bb89501

Browse files
Fix for buggy clients
1 parent 61becf6 commit bb89501

File tree

4 files changed

+10
-2
lines changed

4 files changed

+10
-2
lines changed

proxy/protocol/request_v1.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,9 @@ func (r *Request) decode(pd packetDecoder) (err error) {
4242
if version, err = pd.getInt16(); err != nil {
4343
return err
4444
}
45+
if version == -1 {
46+
version = r.Body.version()
47+
}
4548
if r.Body.key() != key || r.Body.version() != version {
4649
return PacketDecodingError{fmt.Sprintf("expected request key,version %d,%d but got %d,%d", r.Body.key(), r.Body.version(), key, version)}
4750
}

proxy/protocol/request_v2.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,9 @@ func (r *RequestV2) decode(pd packetDecoder) (err error) {
4242
if version, err = pd.getInt16(); err != nil {
4343
return err
4444
}
45+
if version == -1 {
46+
version = r.Body.version()
47+
}
4548
if r.Body.key() != key || r.Body.version() != version {
4649
return PacketDecodingError{fmt.Sprintf("expected request key,version %d,%d but got %d,%d", r.Body.key(), r.Body.version(), key, version)}
4750
}

proxy/protocol/responses.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -401,6 +401,7 @@ func modifyApiVersionsResponse(decodedStruct *Struct, fn config.NetAddressMappin
401401

402402
values := []any{int16(17), int16(0), int16(1)}
403403

404+
// version 3+ of the api versions response
404405
if len(schema.GetFields()) > 3 {
405406
values = append(values, []rawTaggedField{})
406407
}

proxy/sasl_local.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,12 @@ import (
44
"bytes"
55
"encoding/binary"
66
"fmt"
7+
"io"
8+
"time"
9+
710
"github.com/grepplabs/kafka-proxy/pkg/apis"
811
"github.com/grepplabs/kafka-proxy/proxy/protocol"
912
"github.com/pkg/errors"
10-
"io"
11-
"time"
1213
)
1314

1415
type LocalSasl struct {

0 commit comments

Comments
 (0)