@@ -210,12 +210,13 @@ func (mc *mysqlConn) readHandshakePacket() (data []byte, plugin string, err erro
210
210
if len (data ) > pos {
211
211
// character set [1 byte]
212
212
// status flags [2 bytes]
213
- pos += 1 + 2
213
+ pos += 3
214
214
// capability flags (upper 2 bytes) [2 bytes]
215
215
mc .flags |= clientFlag (binary .LittleEndian .Uint16 (data [pos :pos + 2 ])) << 16
216
+ pos += 2
216
217
// length of auth-plugin-data [1 byte]
217
218
// reserved (all [00]) [10 bytes]
218
- pos += 2 + 1 + 10
219
+ pos += 11
219
220
220
221
// second part of the password cipher [minimum 13 bytes],
221
222
// where len=MAX(13, length of auth-plugin-data - 8)
@@ -266,7 +267,7 @@ func (mc *mysqlConn) writeHandshakeResponsePacket(authResp []byte, plugin string
266
267
mc .flags & clientConnectAttrs |
267
268
mc .flags & clientLongFlag
268
269
269
- serverSupportClientConnectAttrs := mc .flags & clientConnectAttrs != 0
270
+ sendConnectAttrs := mc .flags & clientConnectAttrs != 0
270
271
271
272
if mc .cfg .ClientFoundRows {
272
273
clientFlags |= clientFoundRows
@@ -299,9 +300,9 @@ func (mc *mysqlConn) writeHandshakeResponsePacket(authResp []byte, plugin string
299
300
pktLen += n + 1
300
301
}
301
302
302
- var connAttrsLEI []byte
303
303
// encode length of the connection attributes
304
- if serverSupportClientConnectAttrs {
304
+ var connAttrsLEI []byte
305
+ if sendConnectAttrs {
305
306
var connAttrsLEIBuf [9 ]byte
306
307
connAttrsLen := len (mc .connector .encodedAttributes )
307
308
connAttrsLEI = appendLengthEncodedInteger (connAttrsLEIBuf [:0 ], uint64 (connAttrsLen ))
@@ -389,7 +390,7 @@ func (mc *mysqlConn) writeHandshakeResponsePacket(authResp []byte, plugin string
389
390
pos ++
390
391
391
392
// Connection Attributes
392
- if serverSupportClientConnectAttrs {
393
+ if sendConnectAttrs {
393
394
pos += copy (data [pos :], connAttrsLEI )
394
395
pos += copy (data [pos :], []byte (mc .connector .encodedAttributes ))
395
396
}
0 commit comments