processResponse method
After receiving the handshake packet, if all is well, an _AuthHandler
is created and returned to handle authentication.
Currently, if the client protocol version is not 4.1, an exception is thrown.
Implementation
@override
HandlerResponse processResponse(Buffer response) {
checkResponse(response);
readResponseBuffer(response);
if ((serverCapabilities & CLIENT_PROTOCOL_41) == 0) {
throw MySqlClientError('Unsupported protocol (must be 4.1 or newer');
}
if ((serverCapabilities & CLIENT_SECURE_CONNECTION) == 0) {
throw MySqlClientError('Old Password AUthentication is not supported');
}
var clientFlags = CLIENT_PROTOCOL_41 |
CLIENT_LONG_PASSWORD |
CLIENT_LONG_FLAG |
CLIENT_TRANSACTIONS |
CLIENT_SECURE_CONNECTION |
CLIENT_MULTI_RESULTS;
if (serverCapabilities & CLIENT_PLUGIN_AUTH != 0) {
clientFlags |= CLIENT_PLUGIN_AUTH;
}
if (useCompression && (serverCapabilities & CLIENT_COMPRESS) != 0) {
log.shout('Compression enabled');
clientFlags |= CLIENT_COMPRESS;
} else {
useCompression = false;
}
if (useSSL && (serverCapabilities & CLIENT_SSL) != 0) {
log.shout('SSL enabled');
clientFlags |= CLIENT_SSL | CLIENT_SECURE_CONNECTION;
} else {
useSSL = false;
}
if (useSSL) {
return HandlerResponse(
nextHandler: SSLHandler(
clientFlags,
_maxPacketSize,
_characterSet,
AuthHandler(
_user,
_password,
_db,
scrambleBuffer,
clientFlags,
_maxPacketSize,
_characterSet,
_authPlugin,
)));
}
return HandlerResponse(
nextHandler: AuthHandler(_user, _password, _db, scrambleBuffer,
clientFlags, _maxPacketSize, _characterSet, _authPlugin));
}