mirror of
https://gitlab.xiph.org/xiph/icecast-server.git
synced 2024-12-04 14:46:30 -05:00
Allow full URLs to be returned by the master server. close #1878
svn path=/icecast/trunk/icecast/; revision=18799
This commit is contained in:
parent
40bc1e7659
commit
1f833eb244
28
src/slave.c
28
src/slave.c
@ -39,6 +39,7 @@
|
|||||||
|
|
||||||
#include "compat.h"
|
#include "compat.h"
|
||||||
|
|
||||||
|
#include <libxml/uri.h>
|
||||||
#include "thread/thread.h"
|
#include "thread/thread.h"
|
||||||
#include "avl/avl.h"
|
#include "avl/avl.h"
|
||||||
#include "net/sock.h"
|
#include "net/sock.h"
|
||||||
@ -666,18 +667,37 @@ static int update_from_master(ice_config_t *config)
|
|||||||
if (!strlen(buf))
|
if (!strlen(buf))
|
||||||
continue;
|
continue;
|
||||||
DEBUG2 ("read %d from master \"%s\"", count++, buf);
|
DEBUG2 ("read %d from master \"%s\"", count++, buf);
|
||||||
|
xmlURIPtr parsed_uri = xmlParseURI(buf);
|
||||||
|
if (parsed_uri == NULL) {
|
||||||
|
DEBUG0("Error while parsing line from master. Ignoring line.");
|
||||||
|
continue;
|
||||||
|
}
|
||||||
r = calloc (1, sizeof (relay_server));
|
r = calloc (1, sizeof (relay_server));
|
||||||
if (r)
|
if (r)
|
||||||
{
|
{
|
||||||
r->server = (char *)xmlCharStrdup (master);
|
if (parsed_uri->server != NULL)
|
||||||
r->port = port;
|
{
|
||||||
r->mount = (char *)xmlCharStrdup (buf);
|
r->server = strdup(parsed_uri->server);
|
||||||
r->localmount = (char *)xmlCharStrdup (buf);
|
if (parsed_uri->port == 0)
|
||||||
|
r->port = 80;
|
||||||
|
else
|
||||||
|
r->port = parsed_uri->port;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
r->server = (char *)xmlCharStrdup (master);
|
||||||
|
r->port = port;
|
||||||
|
}
|
||||||
|
|
||||||
|
r->mount = strdup(parsed_uri->path);
|
||||||
|
r->localmount = strdup(parsed_uri->path);
|
||||||
r->mp3metadata = 1;
|
r->mp3metadata = 1;
|
||||||
r->on_demand = on_demand;
|
r->on_demand = on_demand;
|
||||||
r->next = new_relays;
|
r->next = new_relays;
|
||||||
|
DEBUG3 ("Added relay host=\"%s\", port=%d, mount=\"%s\"", r->server, r->port, r->mount);
|
||||||
new_relays = r;
|
new_relays = r;
|
||||||
}
|
}
|
||||||
|
xmlFreeURI(parsed_uri);
|
||||||
}
|
}
|
||||||
sock_close (mastersock);
|
sock_close (mastersock);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user