Skip to content

Commit 72d8e81

Browse files
committed
fix: handshake error with mysql server 8.0.34 when ssl is enabled
1 parent 161b2dd commit 72d8e81

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

asyncmy/connection.pyx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -750,9 +750,10 @@ class Connection:
750750
if self._user is None:
751751
raise ValueError("Did not specify a username")
752752

753+
charset_id = charset_by_name(self._charset).id
753754
if self._ssl_context:
754755
# capablities, max packet, charset
755-
data = IIB.pack(self._client_flag, 16777216, 33)
756+
data = IIB.pack(self._client_flag, MAX_PACKET_LEN, charset_id)
756757
data += b'\x00' * (32 - len(data))
757758

758759
self.write_packet(data)
@@ -776,7 +777,6 @@ class Connection:
776777
sock=raw_sock, ssl=self._ssl_context,
777778
server_hostname=self._host,
778779
)
779-
charset_id = charset_by_name(self._charset).id
780780
if isinstance(self._user, str):
781781
self._user = self._user.encode(self._encoding)
782782

0 commit comments

Comments
 (0)