1
0
mirror of https://gitlab.xiph.org/xiph/icecast-server.git synced 2024-09-22 04:15:54 -04:00

Fix a bug where a shoutcast source client (nsvtools) does not wait for the

OK response. Icecast was dropping the connection preventing the stream

svn path=/icecast/trunk/icecast/; revision=10076
This commit is contained in:
Karl Heyes 2005-09-26 16:34:51 +00:00
parent 1926d8866a
commit f869415cf7

View File

@ -872,7 +872,7 @@ static void _handle_shoutcast_compatible (client_queue_t *node)
if (node->shoutcast == 1)
{
char *source_password, *ptr;
char *source_password, *ptr, *headers;
mount_proxy *mountinfo = config_find_mount (config, config->shoutcast_mount);
if (mountinfo && mountinfo->password)
@ -883,8 +883,14 @@ static void _handle_shoutcast_compatible (client_queue_t *node)
/* Get rid of trailing \r\n or \n after password */
ptr = strstr (client->refbuf->data, "\r\n");
if (ptr == NULL)
if (ptr)
headers = ptr+2;
else
{
ptr = strstr (client->refbuf->data, "\n");
if (ptr)
headers = ptr+1;
}
if (ptr == NULL)
{
@ -901,9 +907,9 @@ static void _handle_shoutcast_compatible (client_queue_t *node)
/* send this non-blocking but if there is only a partial write
* then leave to header timeout */
sock_write (client->con->sock, "OK2\r\n");
memset (client->refbuf->data, 0, client->refbuf->len);
node->offset -= (headers - client->refbuf->data);
memmove (client->refbuf->data, headers, node->offset+1);
node->shoutcast = 2;
node->offset = 0;
/* we've checked the password, now send it back for reading headers */
_add_request_queue (node);
free (source_password);