mirror of
https://github.com/weechat/weechat.git
synced 2026-07-01 07:16:37 +02:00
relay/api: fix connection to remote using an IPv6 address with square brackets (closes #2156)
This commit is contained in:
@@ -57,13 +57,17 @@ relay_remote_network_get_url_resource (struct t_relay_remote *remote,
|
||||
const char *resource)
|
||||
{
|
||||
char *url;
|
||||
int colon_in_address;
|
||||
|
||||
if (!remote || !remote->address || !resource || !resource[0])
|
||||
return NULL;
|
||||
|
||||
weechat_asprintf (&url, "%s://%s:%d/api/%s",
|
||||
colon_in_address = (strchr (remote->address, ':')) ? 1 : 0;
|
||||
weechat_asprintf (&url, "%s://%s%s%s:%d/api/%s",
|
||||
(remote->tls) ? "https" : "http",
|
||||
(colon_in_address) ? "[" : "",
|
||||
remote->address,
|
||||
(colon_in_address) ? "]" : "",
|
||||
remote->port,
|
||||
resource);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user