Commit f869415c authored by Karl Heyes's avatar Karl Heyes
Browse files

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
parent 1926d886
......@@ -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;
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);
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