mirror of
https://github.com/weechat/weechat.git
synced 2026-06-26 12:56:37 +02:00
relay: stop URL address before the first question mark if colon is not found (issue #2066)
This commit is contained in:
@@ -252,6 +252,9 @@ relay_remote_get_address (const char *url)
|
||||
return NULL;
|
||||
|
||||
pos = strchr (ptr_start, ':');
|
||||
if (!pos)
|
||||
pos = strchr (ptr_start, '?');
|
||||
|
||||
return (pos) ?
|
||||
weechat_strndup (ptr_start, pos - ptr_start) : strdup (ptr_start);
|
||||
}
|
||||
|
||||
@@ -127,6 +127,8 @@ TEST(RelayRemote, GetAddress)
|
||||
STRCMP_EQUAL("example.com", relay_remote_get_address ("https://example.com"));
|
||||
STRCMP_EQUAL("example.com", relay_remote_get_address ("https://example.com:8000"));
|
||||
STRCMP_EQUAL("example.com", relay_remote_get_address ("https://example.com:8000/"));
|
||||
STRCMP_EQUAL("example.com", relay_remote_get_address ("https://example.com:8000/?option=1"));
|
||||
STRCMP_EQUAL("example.com", relay_remote_get_address ("https://example.com?option=1"));
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
Reference in New Issue
Block a user