projects
/
m6w6
/
libmemcached
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
|
github
raw
|
patch
| inline |
side by side
(parent:
46bddd2
)
accept [IPv6] on memcached_servers_parse
106/head
author
Remi Collet
<remi@remirepo.net>
Tue, 26 Jan 2021 13:34:18 +0000
(14:34 +0100)
committer
Remi Collet
<remi@remirepo.net>
Tue, 26 Jan 2021 13:34:18 +0000
(14:34 +0100)
src/libmemcached/parse.cc
patch
|
blob
|
history
diff --git
a/src/libmemcached/parse.cc
b/src/libmemcached/parse.cc
index 12431222e3dfea0c72215484d1ebb28af13d7815..5bf6fac297102b9b99e18ee46035824e57d879b8 100644
(file)
--- a/
src/libmemcached/parse.cc
+++ b/
src/libmemcached/parse.cc
@@
-44,8
+44,17
@@
memcached_server_list_st memcached_servers_parse(const char *server_strings) {
begin_ptr = end_ptr;
}
- ptr = strchr(buffer, ':');
-
+ ptr = strchr(buffer, '[');
+ if (ptr) {
+ ptr2 = strchr(ptr+1, ']');
+ }
+ if (ptr && ptr2) {
+ // [IPv6]:port
+ ptr = strchr(ptr2+1, ':');
+ } else {
+ // IPv4:port or name:port
+ ptr = strchr(buffer, ':');
+ }
in_port_t port = 0;
if (ptr) {
ptr[0] = 0;