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:
parent
7b5bafdf55
commit
d75d1d6a7a
@ -1692,15 +1692,16 @@ static void _parse_paths(xmlDocPtr doc, xmlNodePtr node,
|
|||||||
alias = malloc(sizeof(aliases));
|
alias = malloc(sizeof(aliases));
|
||||||
alias->next = NULL;
|
alias->next = NULL;
|
||||||
alias->source = (char *)xmlGetProp(node, XMLSTR("source"));
|
alias->source = (char *)xmlGetProp(node, XMLSTR("source"));
|
||||||
if(alias->source == NULL) {
|
|
||||||
free(alias);
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
alias->destination = (char *)xmlGetProp(node, XMLSTR("destination"));
|
alias->destination = (char *)xmlGetProp(node, XMLSTR("destination"));
|
||||||
if (!alias->destination)
|
if (!alias->destination)
|
||||||
alias->destination = (char *)xmlGetProp(node, XMLSTR("dest"));
|
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->source);
|
||||||
|
xmlFree(alias->destination);
|
||||||
free(alias);
|
free(alias);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
@ -1269,7 +1269,8 @@ static int _handle_aliases(client_t *client, char **uri) {
|
|||||||
(alias->port == -1 || alias->port == serverport) &&
|
(alias->port == -1 || alias->port == serverport) &&
|
||||||
(alias->bind_address == NULL || (serverhost != NULL && strcmp(alias->bind_address, serverhost) == 0)) &&
|
(alias->bind_address == NULL || (serverhost != NULL && strcmp(alias->bind_address, serverhost) == 0)) &&
|
||||||
(alias->vhost == NULL || (vhost != NULL && strcmp(alias->vhost, vhost) == 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)
|
if (alias->omode != OMODE_DEFAULT)
|
||||||
client->mode = alias->omode;
|
client->mode = alias->omode;
|
||||||
ICECAST_LOG_DEBUG("alias has made %s into %s", *uri, new_uri);
|
ICECAST_LOG_DEBUG("alias has made %s into %s", *uri, new_uri);
|
||||||
|
Loading…
Reference in New Issue
Block a user