Skip to content

Commit

Permalink
Merge branch 'main' into multiple-result-sets
Browse files Browse the repository at this point in the history
  • Loading branch information
zim32 committed Jul 2, 2022
2 parents 0c85df6 + 2238cc6 commit 55ba6df
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## 0.0.22

- Check server supports SSL

## 0.0.21

- Fix _lastError reset in _forceClose() and used after
Expand Down
9 changes: 9 additions & 0 deletions lib/src/mysql_client/connection.dart
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ class MySQLConnection {
final bool _secure;
final List<int> _incompleteBufferData = [];
Object? _lastError;
int _serverCapabilities = 0;

MySQLConnection._({
required Socket socket,
Expand Down Expand Up @@ -282,6 +283,14 @@ class MySQLConnection {
throw MySQLClientException("Expected MySQLPacketInitialHandshake packet");
}

_serverCapabilities = payload.capabilityFlags;

if (_secure && (_serverCapabilities & mysqlCapFlagClientSsl == 0)) {
throw MySQLClientException(
"Server does not support SSL connection. Pass secure: false to createConnection or enable SSL support",
);
}

if (_secure) {
// it secure = true, initiate ssl connection
Future<void> initiateSSL() async {
Expand Down

0 comments on commit 55ba6df

Please sign in to comment.