[xiph-cvs] cvs commit: icecast/src connection.c source.c
Michael Smith
msmith at xiph.org
Mon Dec 30 23:49:34 PST 2002
msmith 02/12/31 02:49:34
Modified: src connection.c source.c
Log:
New year's bonus feature:
configurable fallbacks, now working.
Revision Changes Path
1.38 +42 -0 icecast/src/connection.c
Index: connection.c
===================================================================
RCS file: /usr/local/cvsroot/icecast/src/connection.c,v
retrieving revision 1.37
retrieving revision 1.38
diff -u -r1.37 -r1.38
--- connection.c 31 Dec 2002 06:28:38 -0000 1.37
+++ connection.c 31 Dec 2002 07:49:34 -0000 1.38
@@ -419,6 +419,42 @@
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;
@@ -575,6 +611,12 @@
if(strcmp(uri, "/admin/metadata") == 0) {
DEBUG0("Got metadata update request");
handle_metadata_request(client);
+ return;
+ }
+
+ if(strcmp(uri, "/admin/fallbacks") == 0) {
+ DEBUG0("Got fallback request");
+ handle_fallback_request(client);
return;
}
<p><p>1.27 +1 -0 icecast/src/source.c
Index: source.c
===================================================================
RCS file: /usr/local/cvsroot/icecast/src/source.c,v
retrieving revision 1.26
retrieving revision 1.27
diff -u -r1.26 -r1.27
--- source.c 30 Dec 2002 15:19:46 -0000 1.26
+++ source.c 31 Dec 2002 07:49:34 -0000 1.27
@@ -45,6 +45,7 @@
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;
<p><p>--- >8 ----
List archives: http://www.xiph.org/archives/
Ogg project homepage: http://www.xiph.org/ogg/
To unsubscribe from this list, send a message to 'cvs-request at xiph.org'
containing only the word 'unsubscribe' in the body. No subject is needed.
Unsubscribe messages sent to the list will be ignored/filtered.
More information about the commits
mailing list