diff --git a/src/cfgfile.c b/src/cfgfile.c index b8a973fd..e486212d 100644 --- a/src/cfgfile.c +++ b/src/cfgfile.c @@ -1101,7 +1101,7 @@ static void _parse_root(xmlDocPtr doc, "legacy-global-source", AUTH_TYPE_STATIC, "source", source_password, NULL, - "source,put,get", 0, "*"); + "source,put,get,delete", 0, "*"); } } else { ICECAST_LOG_ERROR("Can not find nor create default mount, but " @@ -1990,7 +1990,7 @@ static void _parse_authentication(xmlDocPtr doc, xmlNodePtr node, if (admin_password && admin_username) __append_old_style_auth(&old_style, "legacy-admin", AUTH_TYPE_STATIC, - admin_username, admin_password, NULL, "get,post,head,stats,options", 1, "*"); + admin_username, admin_password, NULL, "get,post,head,stats,options,delete", 1, "*"); if (relay_password && relay_username) __append_old_style_auth(&old_style, "legacy-relay", AUTH_TYPE_STATIC, diff --git a/src/connection.c b/src/connection.c index c533c15e..ef6c56e4 100644 --- a/src/connection.c +++ b/src/connection.c @@ -1066,6 +1066,21 @@ static void _handle_get_request(client_t *client) { } } +static void _handle_delete_request(client_t *client) { + source_t *source; + + avl_tree_wlock(global.source_tree); + source = source_find_mount_raw(client->uri); + if (source) { + source->running = 0; + avl_tree_unlock(global.source_tree); + client_send_204(client); + } else { + avl_tree_unlock(global.source_tree); + client_send_error_by_id(client, ICECAST_ERROR_CON_UNKNOWN_REQUEST); + } +} + static void _handle_shoutcast_compatible(client_queue_t *node) { char *http_compliant; @@ -1328,6 +1343,9 @@ static void _handle_authed_client(client_t *client, void *userdata, auth_result case httpp_req_options: _handle_get_request(client); break; + case httpp_req_delete: + _handle_delete_request(client); + break; default: ICECAST_LOG_ERROR("Wrong request type from client"); client_send_error_by_id(client, ICECAST_ERROR_CON_UNKNOWN_REQUEST);