mirror of
https://gitlab.xiph.org/xiph/icecast-server.git
synced 2025-02-02 15:07:36 -05:00
added a content-length for flash-based players. This will allow for them to stream mp3 from icecast.
svn path=/icecast/trunk/icecast/; revision=8160
This commit is contained in:
parent
89bffcd104
commit
a01317753d
@ -586,14 +586,35 @@ static void format_mp3_send_headers(format_plugin_t *self,
|
|||||||
source_t *source, client_t *client)
|
source_t *source, client_t *client)
|
||||||
{
|
{
|
||||||
int bytes;
|
int bytes;
|
||||||
|
char *content_length;
|
||||||
|
|
||||||
mp3_client_data *mp3data = client->format_data;
|
mp3_client_data *mp3data = client->format_data;
|
||||||
|
|
||||||
client->respcode = 200;
|
client->respcode = 200;
|
||||||
|
|
||||||
|
/* This little bit of code is for compatability with
|
||||||
|
flash mp3 streaming. Flash requires a content-length
|
||||||
|
in order for it to stream mp3s, and so based off a
|
||||||
|
trial and error effort, the following number was derived.
|
||||||
|
It is the largest content-length that we can send, anything
|
||||||
|
larger causes flash streaming not to work. Note that it
|
||||||
|
is also possible that other flash-based players may not
|
||||||
|
send this request header (x-flash-version), but given the
|
||||||
|
sampleset I had access to, this should suffice. */
|
||||||
|
if (httpp_getvar(client->parser, "x-flash-version")) {
|
||||||
|
content_length = "Content-Length: 347122319\r\n";
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
content_length = "";
|
||||||
|
}
|
||||||
|
|
||||||
/* TODO: This may need to be ICY/1.0 for shoutcast-compatibility? */
|
/* TODO: This may need to be ICY/1.0 for shoutcast-compatibility? */
|
||||||
bytes = sock_write(client->con->sock,
|
bytes = sock_write(client->con->sock,
|
||||||
"HTTP/1.0 200 OK\r\n"
|
"HTTP/1.0 200 OK\r\n"
|
||||||
"Content-Type: %s\r\n",
|
"Content-Type: %s\r\n"
|
||||||
format_get_mimetype(source->format->type));
|
"%s",
|
||||||
|
format_get_mimetype(source->format->type),
|
||||||
|
content_length);
|
||||||
|
|
||||||
if (bytes > 0)
|
if (bytes > 0)
|
||||||
client->con->sent_bytes += bytes;
|
client->con->sent_bytes += bytes;
|
||||||
|
Loading…
Reference in New Issue
Block a user