From 72d8e81920a8aebf202626651bd866a8dd0d613e Mon Sep 17 00:00:00 2001 From: Cycloctane Date: Mon, 26 Aug 2024 16:27:01 +0000 Subject: [PATCH 1/2] fix: handshake error with mysql server 8.0.34 when ssl is enabled --- asyncmy/connection.pyx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/asyncmy/connection.pyx b/asyncmy/connection.pyx index 4768a43..fd380f2 100644 --- a/asyncmy/connection.pyx +++ b/asyncmy/connection.pyx @@ -750,9 +750,10 @@ class Connection: if self._user is None: raise ValueError("Did not specify a username") + charset_id = charset_by_name(self._charset).id if self._ssl_context: # capablities, max packet, charset - data = IIB.pack(self._client_flag, 16777216, 33) + data = IIB.pack(self._client_flag, MAX_PACKET_LEN, charset_id) data += b'\x00' * (32 - len(data)) self.write_packet(data) @@ -776,7 +777,6 @@ class Connection: sock=raw_sock, ssl=self._ssl_context, server_hostname=self._host, ) - charset_id = charset_by_name(self._charset).id if isinstance(self._user, str): self._user = self._user.encode(self._encoding) From 3b863dc90a3a1c45dc2fa1fffaf5bcd53bd20235 Mon Sep 17 00:00:00 2001 From: Cycloctane Date: Mon, 30 Sep 2024 10:23:43 +0000 Subject: [PATCH 2/2] Update changelog --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 9b247bb..69ee05b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,7 @@ - Fix ssl context pass bool. - Fix missing `*.whl` for Python 3.12 (#94) +- Fix SSL handshake error with MySQL server v8.0.34+. (#80) ### 0.2.9