mirror of
https://gitlab.xiph.org/xiph/icecast-server.git
synced 2024-12-04 14:46:30 -05:00
Send the correct mimetype on client request.
svn path=/trunk/icecast/; revision=3716
This commit is contained in:
parent
638ccabd55
commit
b45b6853da
@ -310,7 +310,7 @@ static void *_handle_connection(void *arg)
|
|||||||
if (global.running != ICE_RUNNING) break;
|
if (global.running != ICE_RUNNING) break;
|
||||||
|
|
||||||
/* grab a connection and set the socket to blocking */
|
/* grab a connection and set the socket to blocking */
|
||||||
while (con = _get_connection()) {
|
while ((con = _get_connection())) {
|
||||||
stats_event_inc(NULL, "connections");
|
stats_event_inc(NULL, "connections");
|
||||||
|
|
||||||
sock_set_blocking(con->sock, SOCK_BLOCK);
|
sock_set_blocking(con->sock, SOCK_BLOCK);
|
||||||
@ -483,7 +483,7 @@ static void *_handle_connection(void *arg)
|
|||||||
|
|
||||||
if (parser->req_type == httpp_req_get) {
|
if (parser->req_type == httpp_req_get) {
|
||||||
client->respcode = 200;
|
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 */
|
/* iterate through source http headers and send to client */
|
||||||
avl_tree_rlock(source->parser->vars);
|
avl_tree_rlock(source->parser->vars);
|
||||||
node = avl_get_first(source->parser->vars);
|
node = avl_get_first(source->parser->vars);
|
||||||
|
14
src/format.c
14
src/format.c
@ -26,6 +26,20 @@ format_type_t format_get_type(char *contenttype)
|
|||||||
return -1;
|
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 *format_get_plugin(format_type_t type, char *mount)
|
||||||
{
|
{
|
||||||
format_plugin_t *plugin;
|
format_plugin_t *plugin;
|
||||||
|
@ -34,6 +34,7 @@ typedef struct _format_plugin_tag
|
|||||||
} format_plugin_t;
|
} format_plugin_t;
|
||||||
|
|
||||||
format_type_t format_get_type(char *contenttype);
|
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);
|
format_plugin_t *format_get_plugin(format_type_t type, char *mount);
|
||||||
|
|
||||||
#endif /* __FORMAT_H__ */
|
#endif /* __FORMAT_H__ */
|
||||||
|
Loading…
Reference in New Issue
Block a user