Skip to content

Commit d38f5e1

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

File tree

3 files changed

+7
-0
lines changed

3 files changed

+7
-0
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
}

0 commit comments

Comments
 (0)