@@ -210,12 +210,13 @@ func (mc *mysqlConn) readHandshakePacket() (data []byte, plugin string, err erro
210210 if len (data ) > pos {
211211 // character set [1 byte]
212212 // status flags [2 bytes]
213- pos += 1 + 2
213+ pos += 3
214214 // capability flags (upper 2 bytes) [2 bytes]
215215 mc .flags |= clientFlag (binary .LittleEndian .Uint16 (data [pos :pos + 2 ])) << 16
216+ pos += 2
216217 // length of auth-plugin-data [1 byte]
217218 // reserved (all [00]) [10 bytes]
218- pos += 2 + 1 + 10
219+ pos += 11
219220
220221 // second part of the password cipher [minimum 13 bytes],
221222 // where len=MAX(13, length of auth-plugin-data - 8)
@@ -266,7 +267,7 @@ func (mc *mysqlConn) writeHandshakeResponsePacket(authResp []byte, plugin string
266267 mc .flags & clientConnectAttrs |
267268 mc .flags & clientLongFlag
268269
269- serverSupportClientConnectAttrs := mc .flags & clientConnectAttrs != 0
270+ sendConnectAttrs := mc .flags & clientConnectAttrs != 0
270271
271272 if mc .cfg .ClientFoundRows {
272273 clientFlags |= clientFoundRows
@@ -299,9 +300,9 @@ func (mc *mysqlConn) writeHandshakeResponsePacket(authResp []byte, plugin string
299300 pktLen += n + 1
300301 }
301302
302- var connAttrsLEI []byte
303303 // encode length of the connection attributes
304- if serverSupportClientConnectAttrs {
304+ var connAttrsLEI []byte
305+ if sendConnectAttrs {
305306 var connAttrsLEIBuf [9 ]byte
306307 connAttrsLen := len (mc .connector .encodedAttributes )
307308 connAttrsLEI = appendLengthEncodedInteger (connAttrsLEIBuf [:0 ], uint64 (connAttrsLen ))
@@ -389,7 +390,7 @@ func (mc *mysqlConn) writeHandshakeResponsePacket(authResp []byte, plugin string
389390 pos ++
390391
391392 // Connection Attributes
392- if serverSupportClientConnectAttrs {
393+ if sendConnectAttrs {
393394 pos += copy (data [pos :], connAttrsLEI )
394395 pos += copy (data [pos :], []byte (mc .connector .encodedAttributes ))
395396 }
0 commit comments