mirror of
https://gitlab.xiph.org/xiph/icecast-server.git
synced 2024-12-04 14:46:30 -05:00
Update: Make the alias dereferencing loop more easy
This commit is contained in:
parent
306cc58d74
commit
6c0b0e2976
@ -1107,11 +1107,28 @@ static int _handle_aliases(client_t *client, char **uri)
|
|||||||
|
|
||||||
alias = config->aliases;
|
alias = config->aliases;
|
||||||
|
|
||||||
while (alias) {
|
/* We now go thru all aliases and see if any matches. */
|
||||||
if (strcmp(*uri, alias->source) == 0 &&
|
for (; alias; alias = alias->next) {
|
||||||
(alias->port == -1 || alias->port == serverport) &&
|
/* We check for several aspects, if they DO NOT match, we continue with our search. */
|
||||||
(alias->bind_address == NULL || (serverhost != NULL && strcmp(alias->bind_address, serverhost) == 0)) &&
|
|
||||||
(alias->vhost == NULL || (vhost != NULL && strcmp(alias->vhost, vhost) == 0)) ) {
|
/* Check for the URI to match. */
|
||||||
|
if (strcmp(*uri, alias->source) != 0)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
/* Check for the server's port to match. */
|
||||||
|
if (alias->port != -1 && alias->port != serverport)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
/* Check for the server's bind address to match. */
|
||||||
|
if (alias->bind_address != NULL && serverhost != NULL && strcmp(alias->bind_address, serverhost) != 0)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
/* Check for the vhost to match. */
|
||||||
|
if (alias->vhost != NULL && vhost != NULL && strcmp(alias->vhost, vhost) != 0)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
/* Ok, we found a matching entry. */
|
||||||
|
|
||||||
if (alias->destination)
|
if (alias->destination)
|
||||||
new_uri = strdup(alias->destination);
|
new_uri = strdup(alias->destination);
|
||||||
if (alias->omode != OMODE_DEFAULT)
|
if (alias->omode != OMODE_DEFAULT)
|
||||||
@ -1119,8 +1136,6 @@ static int _handle_aliases(client_t *client, char **uri)
|
|||||||
ICECAST_LOG_DEBUG("alias has made %s into %s", *uri, new_uri);
|
ICECAST_LOG_DEBUG("alias has made %s into %s", *uri, new_uri);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
alias = alias->next;
|
|
||||||
}
|
|
||||||
|
|
||||||
config_release_config();
|
config_release_config();
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user