Commit d75d1d6a authored by Philipp Schafft's avatar Philipp Schafft 🦁

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
parent 7b5bafdf
......@@ -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;
}
......
......@@ -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);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment