Commit b45b6853 authored by Michael Smith's avatar Michael Smith

Send the correct mimetype on client request.

svn path=/trunk/icecast/; revision=3716
parent 638ccabd
......@@ -310,7 +310,7 @@ static void *_handle_connection(void *arg)
if (global.running != ICE_RUNNING) break;
/* grab a connection and set the socket to blocking */
while (con = _get_connection()) {
while ((con = _get_connection())) {
stats_event_inc(NULL, "connections");
sock_set_blocking(con->sock, SOCK_BLOCK);
......@@ -483,7 +483,7 @@ static void *_handle_connection(void *arg)
if (parser->req_type == httpp_req_get) {
client->respcode = 200;
sock_write(client->con->sock, "HTTP/1.0 200 OK\r\nContent-Type: application/x-ogg\r\n");
sock_write(client->con->sock, "HTTP/1.0 200 OK\r\nContent-Type: %s\r\n", format_get_mimetype(source->format->type));
/* iterate through source http headers and send to client */
avl_tree_rlock(source->parser->vars);
node = avl_get_first(source->parser->vars);
......
......@@ -26,6 +26,20 @@ format_type_t format_get_type(char *contenttype)
return -1;
}
char *format_get_mimetype(format_type_t type)
{
switch(type) {
case FORMAT_TYPE_VORBIS:
return "application/x-ogg";
break;
case FORMAT_TYPE_MP3:
return "audio/mpeg";
break;
default:
return NULL;
}
}
format_plugin_t *format_get_plugin(format_type_t type, char *mount)
{
format_plugin_t *plugin;
......
......@@ -34,6 +34,7 @@ typedef struct _format_plugin_tag
} format_plugin_t;
format_type_t format_get_type(char *contenttype);
char *format_get_mimetype(format_type_t type);
format_plugin_t *format_get_plugin(format_type_t type, char *mount);
#endif /* __FORMAT_H__ */
......
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