Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
ruanhaishen
redis
Commits
6bf9b144
Unverified
Commit
6bf9b144
authored
Jun 30, 2023
by
DevineLiu
Committed by
GitHub
Jun 29, 2023
Browse files
redis-cli: Support URIs with IPv6 (#11834)
Co-authored-by:
hrliu
<
hrliu@alauda.io
>
parent
07ed0eaf
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/cli_common.c
View file @
6bf9b144
...
...
@@ -352,9 +352,19 @@ void parseRedisUri(const char *uri, const char* tool_name, cliConnInfo *connInfo
path
=
strchr
(
curr
,
'/'
);
if
(
*
curr
!=
'/'
)
{
host
=
path
?
path
-
1
:
end
;
if
((
port
=
strchr
(
curr
,
':'
)))
{
connInfo
->
hostport
=
atoi
(
port
+
1
);
host
=
port
-
1
;
if
(
*
curr
==
'['
)
{
curr
+=
1
;
if
((
port
=
strchr
(
curr
,
']'
)))
{
if
(
*
(
port
+
1
)
==
':'
)
{
connInfo
->
hostport
=
atoi
(
port
+
2
);
}
host
=
port
-
1
;
}
}
else
{
if
((
port
=
strchr
(
curr
,
':'
)))
{
connInfo
->
hostport
=
atoi
(
port
+
1
);
host
=
port
-
1
;
}
}
sdsfree
(
connInfo
->
hostip
);
connInfo
->
hostip
=
sdsnewlen
(
curr
,
host
-
curr
+
1
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment