Commit 5275ab34 authored by Michael Smith's avatar Michael Smith

Better file-serving, rationalisation of some paths

svn path=/trunk/icecast/; revision=4181
parent 3783c61e
......@@ -561,6 +561,26 @@ static void _handle_get_request(connection_t *con,
if(bytes > 0) client->con->sent_bytes = bytes;
client_destroy(client);
}
else if(config_get_config()->fileserve) {
fullpath = util_get_path_from_normalised_uri(sourceuri);
if(stat(fullpath, &statbuf) == 0) {
fserve_client_create(client, fullpath);
free(fullpath);
}
else {
free(fullpath);
fullpath = util_get_path_from_normalised_uri(uri);
if(stat(fullpath, &statbuf) == 0) {
fserve_client_create(client, fullpath);
free(fullpath);
}
else {
free(fullpath);
client_send_404(client,
"The file you requested could not be found");
}
}
}
else {
client_send_404(client, "The file you requested could not be found");
}
......@@ -569,7 +589,7 @@ static void _handle_get_request(connection_t *con,
return;
}
if (strcmp(uri, "/allstreams.txt") == 0) {
if (strcmp(uri, "/admin/streamlist") == 0) {
if (!_check_relay_pass(parser)) {
INFO0("Client attempted to fetch allstreams.txt with bad password");
client_send_401(client);
......
......@@ -100,7 +100,10 @@ static void *_slave_thread(void *arg) {
strcat(authheader, ":");
strcat(authheader, password);
data = util_base64_encode(authheader);
sock_write(mastersock, "GET /allstreams.txt HTTP/1.0\r\nAuthorization: Basic %s\r\n\r\n", data);
sock_write(mastersock,
"GET /admin/streamlist HTTP/1.0\r\n"
"Authorization: Basic %s\r\n"
"\r\n", data);
free(authheader);
free(data);
while (sock_read_line(mastersock, buf, sizeof(buf))) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment