Skip to content

Commit 5b199e0

Browse files
committed
network: Handle network separator correctly
Signed-off-by: Hiroshi Hatake <hiroshi@chronosphere.io>
1 parent b6810ab commit 5b199e0

1 file changed

Lines changed: 12 additions & 2 deletions

File tree

src/flb_network.c

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -161,6 +161,7 @@ int flb_net_host_set(const char *plugin_name, struct flb_net_host *host, const c
161161
int len;
162162
int olen;
163163
const char *s, *e, *u;
164+
const char *separator;
164165

165166
memset(host, '\0', sizeof(struct flb_net_host));
166167

@@ -174,7 +175,16 @@ int flb_net_host_set(const char *plugin_name, struct flb_net_host *host, const c
174175
return -1;
175176
}
176177

177-
s = address + len;
178+
separator = strchr(address, ':');
179+
if (separator != NULL &&
180+
separator != address &&
181+
separator[1] == '/' &&
182+
separator[2] == '/') {
183+
s = separator + 3;
184+
}
185+
else {
186+
s = address + len;
187+
}
178188
if (*s == '[') {
179189
/* IPv6 address (RFC 3986) */
180190
e = strchr(++s, ']');
@@ -2344,4 +2354,4 @@ uint64_t flb_net_htonll(uint64_t value)
23442354
#else
23452355
return value;
23462356
#endif
2347-
}
2357+
}

0 commit comments

Comments
 (0)