Skip to content

Protocol.parseTargetHostAndSlot() is IPV4 oriented #982

@allanwax

Description

@allanwax

The code which splits the host part from the port part is very IPV4 oriented and thus it just splits on a :. To handle IPV6 cases it should be something like:

...
int colon = messageInfo[2].lastIndexOf(":");
...
response[1] = messageInfo[2].substring(0, colon-1);
response[2] = messageInfo[2].substring(colon+1);

Since IPV6 uses colons to separate the parts and Jedis uses a colon to separate host from port, using the index of the last colon will select the host-port divider whether it's IPV4 or IPV6.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions