Skip to content

Commit

Permalink
Fix WebdisConnection with IPv4 hosts.
Browse files Browse the repository at this point in the history
Apparently something changed since last time in cURL internals and now
an IPv4 wrapped by square brackets (which are used for IPv6 addresses)
returns a malformed request error.

m
  • Loading branch information
nrk committed Sep 4, 2020
1 parent 880ad09 commit fdf663e
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ the URI when using the "redis" scheme and a "username:password" pair is present.
Values retrieved from the userinfo fragment always override the ones specified
in `username` and `password` if those fields are present in the query string.

- __FIX__: `Predis\Connection\WebdisConnection` was unable to connect to Webdis
when using an IPv4 address in the URL and this is probably due to some change in
cURL internals since the last time we tested it.


v1.1.4 (2020-08-31)
================================================================================
Expand Down
2 changes: 1 addition & 1 deletion src/Connection/WebdisConnection.php
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ private function createCurl()
$parameters = $this->getParameters();
$timeout = (isset($parameters->timeout) ? (float) $parameters->timeout : 5.0) * 1000;

if (filter_var($host = $parameters->host, FILTER_VALIDATE_IP)) {
if (filter_var($host = $parameters->host, FILTER_VALIDATE_IP, FILTER_FLAG_IPV6)) {
$host = "[$host]";
}

Expand Down

0 comments on commit fdf663e

Please sign in to comment.