1
0
mirror of https://gitlab.xiph.org/xiph/icecast-server.git synced 2024-12-04 14:46:30 -05:00

Better file-serving, rationalisation of some paths

svn path=/trunk/icecast/; revision=4181
This commit is contained in:
Michael Smith 2002-12-30 15:42:38 +00:00
parent 3783c61e92
commit 5275ab34b9
2 changed files with 25 additions and 2 deletions

View File

@ -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);

View File

@ -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))) {