Skip to content

Commit 55ba6df

Browse files
author
zim32
committed
Merge branch 'main' into multiple-result-sets
2 parents 0c85df6 + 2238cc6 commit 55ba6df

File tree

2 files changed

+13
-0
lines changed

2 files changed

+13
-0
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
## 0.0.22
2+
3+
- Check server supports SSL
4+
15
## 0.0.21
26

37
- Fix _lastError reset in _forceClose() and used after

lib/src/mysql_client/connection.dart

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ class MySQLConnection {
3232
final bool _secure;
3333
final List<int> _incompleteBufferData = [];
3434
Object? _lastError;
35+
int _serverCapabilities = 0;
3536

3637
MySQLConnection._({
3738
required Socket socket,
@@ -282,6 +283,14 @@ class MySQLConnection {
282283
throw MySQLClientException("Expected MySQLPacketInitialHandshake packet");
283284
}
284285

286+
_serverCapabilities = payload.capabilityFlags;
287+
288+
if (_secure && (_serverCapabilities & mysqlCapFlagClientSsl == 0)) {
289+
throw MySQLClientException(
290+
"Server does not support SSL connection. Pass secure: false to createConnection or enable SSL support",
291+
);
292+
}
293+
285294
if (_secure) {
286295
// it secure = true, initiate ssl connection
287296
Future<void> initiateSSL() async {

0 commit comments

Comments
 (0)