Restrict disable Feature Negotiation

This commit is contained in:
2021-01-25 03:27:53 +03:00
parent da4331127b
commit 0ba02103ef
2 changed files with 5 additions and 3 deletions

View File

@ -81,6 +81,8 @@ final class ClientConfig implements JsonSerializable
// A string identifying the agent for this client in the spirit of HTTP. // A string identifying the agent for this client in the spirit of HTTP.
public string $userAgent = '', public string $userAgent = '',
) { ) {
$this->featureNegotiation = true; // Always enabled
if ('' === $this->hostname) { if ('' === $this->hostname) {
$this->hostname = (static fn (mixed $h): string => \is_string($h) ? $h : '')(gethostname()); $this->hostname = (static fn (mixed $h): string => \is_string($h) ? $h : '')(gethostname());
} }

View File

@ -29,6 +29,8 @@ use const PHP_EOL;
/** /**
* @internal * @internal
*
* @property ConnectionConfig $connectionConfig
*/ */
abstract class Connection abstract class Connection
{ {
@ -77,9 +79,7 @@ abstract class Connection
$response = $this->command('IDENTIFY', data: $body)->response(); $response = $this->command('IDENTIFY', data: $body)->response();
if ($this->clientConfig->featureNegotiation) {
$this->connectionConfig = ConnectionConfig::fromArray($response->toArray()); $this->connectionConfig = ConnectionConfig::fromArray($response->toArray());
}
if ($this->connectionConfig->snappy || $this->connectionConfig->deflate) { if ($this->connectionConfig->snappy || $this->connectionConfig->deflate) {
$this->response()->okOrFail(); $this->response()->okOrFail();