1
0
mirror of https://gitlab.xiph.org/xiph/icecast-server.git synced 2024-09-22 04:15:54 -04:00

New year's bonus feature:

configurable fallbacks, now working.

svn path=/trunk/icecast/; revision=4192
This commit is contained in:
Michael Smith 2002-12-31 07:49:34 +00:00
parent ab8c8c6893
commit 11a1d83e1a
2 changed files with 43 additions and 0 deletions

View File

@ -419,6 +419,42 @@ static int _check_source_pass(http_parser_t *parser)
return ret;
}
static void handle_fallback_request(client_t *client)
{
source_t *source;
char *mount, *value, *old;
int bytes;
if(!_check_source_pass(client->parser)) {
INFO0("Bad or missing password on fallback configuration request");
client_send_401(client);
return;
}
mount = httpp_get_query_param(client->parser, "mount");
value = httpp_get_query_param(client->parser, "fallback");
if(value == NULL || mount == NULL) {
client_send_400(client, "Missing parameter");
return;
}
avl_tree_rlock(global.source_tree);
source = source_find_mount(mount);
avl_tree_unlock(global.source_tree);
old = source->fallback_mount;
source->fallback_mount = strdup(value);
free(old);
client->respcode = 200;
bytes = sock_write(client->con->sock,
"HTTP/1.0 200 OK\r\nContent-Type: text/html\r\n\r\n"
"Fallback configured");
if(bytes > 0) client->con->sent_bytes = bytes;
client_destroy(client);
}
static void handle_metadata_request(client_t *client)
{
source_t *source;
@ -578,6 +614,12 @@ static void _handle_get_request(connection_t *con,
return;
}
if(strcmp(uri, "/admin/fallbacks") == 0) {
DEBUG0("Got fallback request");
handle_fallback_request(client);
return;
}
/* Here we are parsing the URI request to see
** if the extension is .xsl, if so, then process
** this request as an XSLT request

View File

@ -45,6 +45,7 @@ source_t *source_create(client_t *client, connection_t *con, http_parser_t *pars
src = (source_t *)malloc(sizeof(source_t));
src->client = client;
src->mount = (char *)strdup(mount);
src->fallback_mount = NULL;
src->format = format_get_plugin(type, src->mount);
src->con = con;
src->parser = parser;