1
0
mirror of https://gitlab.xiph.org/xiph/icecast-server.git synced 2024-06-16 06:15:24 +00:00

Feature: Allow <resource> to match on a specific listen-socket

This commit is contained in:
Philipp Schafft 2018-06-30 14:06:05 +00:00
parent 2febabcddd
commit d9e96a55e7
3 changed files with 11 additions and 0 deletions

View File

@ -596,6 +596,7 @@ static void config_clear_resource(resource_t *resource)
xmlFree(resource->vhost);
xmlFree(resource->module);
xmlFree(resource->handler);
free(resource->listen_socket);
free(resource);
resource = nextresource;
}
@ -2007,6 +2008,12 @@ static void _parse_resource(xmlDocPtr doc,
resource->bind_address = (char *)xmlGetProp(node, XMLSTR("bind-address"));
temp = (char *)xmlGetProp(node, XMLSTR("listen-socket"));
if (temp) {
resource->listen_socket = config_href_to_id(temp);
xmlFree(temp);
}
resource->vhost = (char *)xmlGetProp(node, XMLSTR("vhost"));
resource->module = (char *)xmlGetProp(node, XMLSTR("module"));

View File

@ -139,6 +139,7 @@ typedef struct _resource {
char *destination;
int port;
char *bind_address;
char *listen_socket;
char *vhost;
char *module;
char *handler;

View File

@ -1176,6 +1176,9 @@ static int _handle_resources(client_t *client, char **uri)
if (resource->bind_address != NULL && serverhost != NULL && strcmp(resource->bind_address, serverhost) != 0)
continue;
if (resource->listen_socket != NULL && (listen_sock->id == NULL || strcmp(resource->listen_socket, listen_sock->id) != 0))
continue;
/* Check for the vhost to match. */
if (resource->vhost != NULL && vhost != NULL && strcmp(resource->vhost, vhost) != 0)
continue;