From 0ba02103ef3cf8e4435ff94f545a2e5fd0101d8e Mon Sep 17 00:00:00 2001 From: Konstantin Grachev Date: Mon, 25 Jan 2021 03:27:53 +0300 Subject: [PATCH] Restrict disable Feature Negotiation --- src/Config/ClientConfig.php | 2 ++ src/Connection.php | 6 +++--- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/Config/ClientConfig.php b/src/Config/ClientConfig.php index df5b9fc..353ada2 100644 --- a/src/Config/ClientConfig.php +++ b/src/Config/ClientConfig.php @@ -81,6 +81,8 @@ final class ClientConfig implements JsonSerializable // A string identifying the agent for this client in the spirit of HTTP. public string $userAgent = '', ) { + $this->featureNegotiation = true; // Always enabled + if ('' === $this->hostname) { $this->hostname = (static fn (mixed $h): string => \is_string($h) ? $h : '')(gethostname()); } diff --git a/src/Connection.php b/src/Connection.php index 95ed223..ecf6e94 100644 --- a/src/Connection.php +++ b/src/Connection.php @@ -29,6 +29,8 @@ use const PHP_EOL; /** * @internal + * + * @property ConnectionConfig $connectionConfig */ abstract class Connection { @@ -77,9 +79,7 @@ abstract class Connection $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) { $this->response()->okOrFail();