1
0
mirror of https://gitlab.xiph.org/xiph/icecast-server.git synced 2025-01-03 14:56:34 -05:00

Feature: Allow <resource> to have only one of source and destination

This allows <resource> (former <alias>) to have only one of the
attribues source and destination. In that case other parameters
will be applied to the client but uri is not mapped.

See #2097
This commit is contained in:
Philipp Schafft 2014-12-20 18:48:03 +00:00
parent 7b5bafdf55
commit d75d1d6a7a
2 changed files with 8 additions and 6 deletions

View File

@ -1692,15 +1692,16 @@ static void _parse_paths(xmlDocPtr doc, xmlNodePtr node,
alias = malloc(sizeof(aliases));
alias->next = NULL;
alias->source = (char *)xmlGetProp(node, XMLSTR("source"));
if(alias->source == NULL) {
free(alias);
continue;
}
alias->destination = (char *)xmlGetProp(node, XMLSTR("destination"));
if (!alias->destination)
alias->destination = (char *)xmlGetProp(node, XMLSTR("dest"));
if(alias->destination == NULL) {
if (!alias->source && alias->destination) {
alias->source = alias->destination;
alias->destination = NULL;
} else if(!alias->source && !alias->destination) {
xmlFree(alias->source);
xmlFree(alias->destination);
free(alias);
continue;
}

View File

@ -1269,7 +1269,8 @@ static int _handle_aliases(client_t *client, char **uri) {
(alias->port == -1 || alias->port == serverport) &&
(alias->bind_address == NULL || (serverhost != NULL && strcmp(alias->bind_address, serverhost) == 0)) &&
(alias->vhost == NULL || (vhost != NULL && strcmp(alias->vhost, vhost) == 0)) ) {
new_uri = strdup(alias->destination);
if (alias->destination)
new_uri = strdup(alias->destination);
if (alias->omode != OMODE_DEFAULT)
client->mode = alias->omode;
ICECAST_LOG_DEBUG("alias has made %s into %s", *uri, new_uri);